Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion framework/codemodder-base/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ dependencies {
api(libs.javaparser.symbolsolver.model)
api(libs.javadiff)
api(libs.jtokkit)
api("com.azure:azure-ai-openai:1.0.0-beta.10")
api("com.azure:azure-ai-openai:1.0.0-beta.16")
api("io.github.classgraph:classgraph:4.8.160")

implementation(libs.tuples)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,8 @@ private BinaryThreatAnalysis analyzeThreat(
// If the estimated token count, which doesn't include the function (~100 tokens) or the reply
// (~200 tokens), is close to the max, then assume the code is safe (for now).
int tokenCount =
model.tokens(List.of(systemMessage.getContent(), userMessage.getContent().toString()));
model.tokens(
List.of(systemMessage.getStringContent(), userMessage.getContent().toString()));
if (tokenCount > model.contextWindow() - 300) {
return new BinaryThreatAnalysis(
"Ignoring file: estimated prompt token count (" + tokenCount + ") is too high.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,8 @@ private boolean estimatedToExceedContextWindow(final CodemodInvocationContext co
int tokenCount =
model.tokens(
List.of(
getSystemMessage().getContent(), estimatedUserMessage.getContent().toString()));
getSystemMessage().getStringContent(),
estimatedUserMessage.getContent().toString()));
// estimated token count doesn't include the function (~100 tokens) or the reply
// (~200 tokens) so add those estimates before checking against window size
tokenCount += 300;
Expand Down
Loading