Skip to content

Commit

Permalink
Updates max tokens for OpenAI prompt generation
Browse files Browse the repository at this point in the history
  • Loading branch information
soramimi committed Jun 16, 2024
1 parent a000dc5 commit ba65b6a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
7 changes: 5 additions & 2 deletions src/CommitMessageGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,9 @@ GeneratedCommitMessage CommitMessageGenerator::parse_openai_response(std::string
if (r.match("{stop_reason")) {
if (r.string() == "end_turn") {
ok1 = true;
} else {
ok1 = false;
error_status_ = r.string();
}
} else if (r.match("{content[{text")) {
text = decode_json_string(r.string());
Expand Down Expand Up @@ -340,7 +343,7 @@ std::string CommitMessageGenerator::generatePromptJSON(GenerativeAI::Model const
{"role": "user", "content": "%s"}
]
,
"max_tokens": 100,
"max_tokens": 200,
"temperature": 0.7
})---";
json = strformat(json)(model.name.toStdString())(encode_json_string(prompt));
Expand Down Expand Up @@ -374,7 +377,7 @@ GeneratedCommitMessage CommitMessageGenerator::generate(GitPtr g)
{
constexpr int max_message_count = 5;

constexpr bool save_log = true;
constexpr bool save_log = false;

if (0) { // for debugging JSON parsing
return test();
Expand Down
5 changes: 4 additions & 1 deletion src/GenerativeAI.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,10 @@ static std::vector<Model> available_models()
models.emplace_back("claude-3-haiku-20240307");
models.emplace_back("claude-3-sonnet-20240229");
models.emplace_back("claude-3-opus-20240229");
models.emplace_back("gemini-pro");
models.emplace_back("gemini-1.0-ultra");
models.emplace_back("gemini-1.0-pro");
models.emplace_back("gemini-1.0-flash");
models.emplace_back("gemini-1.0-nano");
return models;
}

Expand Down

0 comments on commit ba65b6a

Please sign in to comment.