Skip to content

Open source AI coding agent. Designed for large projects and real world tasks.

fix: build and fix evals failing with API error

ZanzyTHEbar851078597295
diff --git a/app/scripts/cmd/gen/gen.go b/app/scripts/cmd/gen/gen.go
index cf82e72f..22e75685 100644
--- a/app/scripts/cmd/gen/gen.go
+++ b/app/scripts/cmd/gen/gen.go
@@ -71,6 +71,10 @@ tests: tests/*.tests.yml
// Template for config.properties
propertiesTemplate := `provider_id=openai:gpt-4o
+temperature=
+max_tokens=
+top_p=
+response_format=
function_name=
tool_type=function
function_param_type=object
diff --git a/test/evals/promptfoo-poc/build/build.config.properties b/test/evals/promptfoo-poc/build/build.config.properties
index 28127414..95358455 100644
--- a/test/evals/promptfoo-poc/build/build.config.properties
+++ b/test/evals/promptfoo-poc/build/build.config.properties
@@ -1,4 +1,8 @@
provider_id=openai:gpt-4o
+temperature=0.1
+max_tokens=4096
+top_p=0.1
+response_format=json_object
function_name=listChangesWithLineNums
tool_type=function
function_param_type=object
diff --git a/test/evals/promptfoo-poc/build/build.parameters.json b/test/evals/promptfoo-poc/build/build.parameters.json
index c03bddfb..7610e01e 100644
--- a/test/evals/promptfoo-poc/build/build.parameters.json
+++ b/test/evals/promptfoo-poc/build/build.parameters.json
@@ -16,7 +16,7 @@
"required": ["txt", "reference"]
}
},
- "problems": {
+ "filePath": {
"type": "string"
},
"changes": {
@@ -74,5 +74,5 @@
}
}
},
- "required": ["comments", "problems", "changes"]
-}
\ No newline at end of file
+ "required": ["comments", "filePath", "changes"]
+}
diff --git a/test/evals/promptfoo-poc/build/build.prompt.txt b/test/evals/promptfoo-poc/build/build.prompt.txt
index 9d4afc7b..e0a76064 100644
--- a/test/evals/promptfoo-poc/build/build.prompt.txt
+++ b/test/evals/promptfoo-poc/build/build.prompt.txt
@@ -83,16 +83,16 @@ If the 'hasChange' property is false, the 'new' property must be an empty string
If *any* change has the 'entireFile' key in the 'old' property set to true, the corresponding 'new' key MUST be the entire updated file, and there MUST only be a single change in the 'changes' array.
Example change object:
- ---
+```json
{
- "summary": "Fix syntax error in loop body.",
- "old": {
- "startLineString": "pdx-5: for i := 0; i < 10; i++ { ",
- "endLineString": "pdx-7: }"
+ summary: "Fix syntax error in loop body.",
+ old: {
+ startLineString: "pdx-5: for i := 0; i < 10; i++ { ",
+ endLineString: "pdx-7: }"
},
- "new": "for i := 0; i < 10; i++ {\n execQuery()\n }\n }\n}"
+ new: "for i := 0; i < 10; i++ {\n execQuery()\n }\n }\n}"
}
- ---
+```
Apply changes intelligently **in order** to avoid syntax errors, breaking code, or removing code from the original file that should not be removed. Consider the reason behind the update and make sure the result is consistent with the intention of the plan.
diff --git a/test/evals/promptfoo-poc/build/build.provider.yml b/test/evals/promptfoo-poc/build/build.provider.yml
index a91430f0..ed48539e 100644
--- a/test/evals/promptfoo-poc/build/build.provider.yml
+++ b/test/evals/promptfoo-poc/build/build.provider.yml
@@ -1,5 +1,9 @@
id: openai:gpt-4o
config:
+ temperature: 0.1
+ max_tokens: 4096
+ response_format: { type: json_object }
+ top_p: 0.1
tools:
[
{
@@ -68,9 +72,9 @@ config:
},
"type": "array",
},
- "problems": { "type": "string" },
+ "filePath": { "type": "string" },
},
- "required": ["comments", "problems", "changes"],
+ "required": ["comments", "filePath", "changes"],
"type": "object",
},
},
diff --git a/test/evals/promptfoo-poc/build/promptfooconfig.yaml b/test/evals/promptfoo-poc/build/promptfooconfig.yaml
index dbce4996..423c31a1 100644
--- a/test/evals/promptfoo-poc/build/promptfooconfig.yaml
+++ b/test/evals/promptfoo-poc/build/promptfooconfig.yaml
@@ -4,4 +4,4 @@ prompts:
- file://build.prompt.txt
providers:
- file://build.provider.yml
-tests: tests/*.tests.yml
+tests: tests/*.test.yml
diff --git a/test/evals/promptfoo-poc/fix/fix.config.properties b/test/evals/promptfoo-poc/fix/fix.config.properties
index dc796603..0c9680b6 100644
--- a/test/evals/promptfoo-poc/fix/fix.config.properties
+++ b/test/evals/promptfoo-poc/fix/fix.config.properties
@@ -1,4 +1,8 @@
provider_id=openai:gpt-4o
+temperature=0.1
+max_tokens=4096
+top_p=0.1
+response_format=json_object
function_name=listChangesWithLineNums
tool_type=function
function_param_type=object
diff --git a/test/evals/promptfoo-poc/fix/fix.prompt.txt b/test/evals/promptfoo-poc/fix/fix.prompt.txt
index 1ca11aa7..b7a16eda 100644
--- a/test/evals/promptfoo-poc/fix/fix.prompt.txt
+++ b/test/evals/promptfoo-poc/fix/fix.prompt.txt
@@ -79,19 +79,20 @@ If *any* change has the 'entireFile' key in the 'old' property set to true, the
You MUST ensure the line numbers for the 'old' property correctly remove *ALL* code that has problems and that the 'new' property correctly fixes *ALL* the problems present in the updated file. You MUST NOT miss any problems, fail to fix any problems, or introduce any new problems.
- Because you are implementing a fix, be more willing to make larger changes in order to fix all the problems. Smaller changes are more error-prone, and the fact that you are fixing a file means a line-number based change already failed. This likely means there was some tricky structural challenge in applying the changes with line numbers, so be prepared to make a larger change in order to avoid continuing to fail to fix the file.
-
- Example change object:
- ---
- {
- "summary": "Fix syntax error in loop body.",
- "old": {
- "startLineString": "pdx-5: for i := 0; i < 10; i++ { ",
- "endLineString": "pdx-7: }"
- },
- "new": "for i := 0; i < 10; i++ {\n execQuery()\n }\n }\n}"
- }
- ---
+Because you are implementing a fix, be more willing to make larger changes in order to fix all the problems. Smaller changes are more error-prone, and the fact that you are fixing a file means a line-number based change already failed. This likely means there was some tricky structural challenge in applying the changes with line numbers, so be prepared to make a larger change in order to avoid continuing to fail to fix the file.
+
+Example change object:
+
+```json
+{
+ "summary": "Fix syntax error in loop body.",
+ "old": {
+ "startLineString": "pdx-5: for i := 0; i < 10; i++ { ",
+ "endLineString": "pdx-7: }"
+ },
+ "new": "for i := 0; i < 10; i++ {\n execQuery()\n }\n }\n}"
+}
+```
You ABSOLUTELY MUST NOT generate overlapping changes. Group smaller changes together into larger changes where necessary to avoid overlap. Only generate multiple changes when you are ABSOLUTELY CERTAIN that they do not overlap--otherwise group them together into a single change. If changes are close to each other (within several lines), group them together into a single change. You MUST group changes together and make fewer, larger changes rather than many small changes, unless the changes are completely independent of each other and not close to each other in the file. You MUST NEVER generate changes that are adjacent or close to adjacent. Adjacent or closely adjacent changes MUST ALWAYS be grouped into a single larger change.
diff --git a/test/evals/promptfoo-poc/fix/fix.provider.yml b/test/evals/promptfoo-poc/fix/fix.provider.yml
index f760f6e8..1e9c0b98 100644
--- a/test/evals/promptfoo-poc/fix/fix.provider.yml
+++ b/test/evals/promptfoo-poc/fix/fix.provider.yml
@@ -1,5 +1,9 @@
id: openai:gpt-4o
config:
+ temperature: 0.1
+ max_tokens: 4096
+ response_format: { type: json_object }
+ top_p: 0.1
tools:
[
{
diff --git a/test/evals/promptfoo-poc/fix/promptfooconfig.yaml b/test/evals/promptfoo-poc/fix/promptfooconfig.yaml
index 87fbe232..45d6870e 100644
--- a/test/evals/promptfoo-poc/fix/promptfooconfig.yaml
+++ b/test/evals/promptfoo-poc/fix/promptfooconfig.yaml
@@ -8,4 +8,4 @@ prompts:
providers:
- file://fix.provider.yml
-tests: tests/*.tests.yml
+tests: tests/*.test.yml
diff --git a/test/evals/promptfoo-poc/templates/provider.template.yml b/test/evals/promptfoo-poc/templates/provider.template.yml
index 0408cd23..b1a4b271 100644
--- a/test/evals/promptfoo-poc/templates/provider.template.yml
+++ b/test/evals/promptfoo-poc/templates/provider.template.yml
@@ -1,5 +1,9 @@
id: {{ .provider_id }}
config:
+ temperature: {{ .temperature }}
+ max_tokens: {{ .max_tokens }}
+ response_format: { type: {{ .response_format }} }
+ top_p: {{ .top_p }}
tools:
[
{
diff --git a/test/evals/promptfoo-poc/verify/verify.config.properties b/test/evals/promptfoo-poc/verify/verify.config.properties
index c43ce849..57c89ad4 100644
--- a/test/evals/promptfoo-poc/verify/verify.config.properties
+++ b/test/evals/promptfoo-poc/verify/verify.config.properties
@@ -1,4 +1,8 @@
provider_id=openai:gpt-4o
+temperature=0.1
+max_tokens=4096
+top_p=0.1
+response_format=json_object
function_name=verifyOutput
tool_type=function
function_param_type=object
diff --git a/test/evals/promptfoo-poc/verify/verify.provider.yml b/test/evals/promptfoo-poc/verify/verify.provider.yml
index a23b8ad4..462ee995 100644
--- a/test/evals/promptfoo-poc/verify/verify.provider.yml
+++ b/test/evals/promptfoo-poc/verify/verify.provider.yml
@@ -1,5 +1,9 @@
id: openai:gpt-4o
config:
+ temperature: 0.1
+ max_tokens: 4096
+ response_format: { type: json_object }
+ top_p: 0.1
tools:
[
{