Skip to content

Commit a17d2f4

Browse files
committed
Migrate to github.com/openai/openai-go
Signed-off-by: David Gageot <[email protected]>
1 parent 75bb1ac commit a17d2f4

File tree

12 files changed

+427
-341
lines changed

12 files changed

+427
-341
lines changed

e2e/cagent_exec_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ func TestExec_BasicOpenAI(t *testing.T) {
1818
require.Equal(t, `
1919
--- Agent: root ---
2020
21-
Djordje is a common Serbian given name. It may refer to different individuals depending on the context. If you provide more information or details, I can help you identify the specific Djordje you are referring to.`,
21+
Djordje is a common Serbian given name. It is pronounced as "George" in English. If you have a specific context or question about a person named Djordje, please provide more details so I can assist you better.`,
2222
out)
2323
}
2424

e2e/testdata/cassettes/TestExec_BasicOpenAI.yaml

Lines changed: 3 additions & 3 deletions
Large diffs are not rendered by default.

e2e/testdata/cassettes/TestExec_ToolCallsNeedAcceptance.yaml

Lines changed: 6 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -8,36 +8,16 @@ interactions:
88
proto_minor: 1
99
content_length: 0
1010
host: api.openai.com
11-
body: "{\"model\":\"gpt-5-mini\",\"messages\":[{\"role\":\"system\",\"content\":\"You are a knowledgeable assistant that can write test files.\"},{\"role\":\"system\",\"content\":\"## Filesystem Tool Instructions\\n\\nThis toolset provides comprehensive filesystem operations with built-in security restrictions.\\n\\n### Security Model\\n- All operations are restricted to allowed directories only\\n- Use list_allowed_directories to see available paths\\n- Subdirectories within allowed directories are accessible\\n- Use add_allowed_directory to request access to new directories (requires user consent)\\n\\n### Directory Access Management\\n- If you need access to a directory outside the allowed list, use add_allowed_directory\\n- This will request user consent before expanding filesystem access\\n- Always provide a clear reason when requesting new directory access\\n\\n### Common Patterns\\n- Always check if directories exist before creating files\\n- Prefer read_multiple_files for batch operations\\n- Use search_files_content for finding specific code or text\\n\\n### Performance Tips\\n- Use read_multiple_files instead of multiple read_file calls\\n- Use directory_tree with max_depth to limit large traversals\\n- Use appropriate exclude patterns in search operations\"},{\"role\":\"user\",\"content\":\"Create a hello.txt file with \\\"Hello, World!\\\" content. Try only once. On error, exit without further message.\"}],\"stream\":true,\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"write_file\",\"description\":\"Create a new file or completely overwrite an existing file with new content.\",\"parameters\":{\"additionalProperties\":false,\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"path\":{\"description\":\"The file path to write\",\"type\":\"string\"}},\"required\":[\"path\",\"content\"],\"type\":\"object\"}}}],\"stream_options\":{\"include_usage\":true}}"
11+
body: "{\"messages\":[{\"content\":\"You are a knowledgeable assistant that can write test files.\",\"role\":\"system\"},{\"content\":\"## Filesystem Tool Instructions\\n\\nThis toolset provides comprehensive filesystem operations with built-in security restrictions.\\n\\n### Security Model\\n- All operations are restricted to allowed directories only\\n- Use list_allowed_directories to see available paths\\n- Subdirectories within allowed directories are accessible\\n- Use add_allowed_directory to request access to new directories (requires user consent)\\n\\n### Directory Access Management\\n- If you need access to a directory outside the allowed list, use add_allowed_directory\\n- This will request user consent before expanding filesystem access\\n- Always provide a clear reason when requesting new directory access\\n\\n### Common Patterns\\n- Always check if directories exist before creating files\\n- Prefer read_multiple_files for batch operations\\n- Use search_files_content for finding specific code or text\\n\\n### Performance Tips\\n- Use read_multiple_files instead of multiple read_file calls\\n- Use directory_tree with max_depth to limit large traversals\\n- Use appropriate exclude patterns in search operations\",\"role\":\"system\"},{\"content\":\"Create a hello.txt file with \\\"Hello, World!\\\" content. Try only once. On error, exit without further message.\",\"role\":\"user\"}],\"model\":\"gpt-5-mini\",\"frequency_penalty\":0,\"presence_penalty\":0,\"temperature\":0,\"top_p\":0,\"stream_options\":{\"include_usage\":true},\"tools\":[{\"function\":{\"name\":\"write_file\",\"description\":\"Create a new file or completely overwrite an existing file with new content.\",\"parameters\":{\"additionalProperties\":false,\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"path\":{\"description\":\"The file path to write\",\"type\":\"string\"}},\"required\":[\"path\",\"content\"],\"type\":\"object\"}},\"type\":\"function\"}],\"stream\":true}"
1212
url: https://api.openai.com/v1/chat/completions
1313
method: POST
1414
response:
1515
proto: HTTP/2.0
1616
proto_major: 2
1717
proto_minor: 0
18-
content_length: -1
19-
body: "data: {\"id\":\"chatcmpl-CYCUv3FroLFXPfMEnAfFmd7SUlNT6\",\"object\":\"chat.completion.chunk\",\"created\":1762267229,\"model\":\"gpt-5-mini-2025-08-07\",\"service_tier\":\"default\",\"system_fingerprint\":null,\"choices\":[{\"index\":0,\"delta\":{\"role\":\"assistant\",\"content\":null,\"tool_calls\":[{\"index\":0,\"id\":\"call_1l99RCuSJIgyl6aJhcQcB3w1\",\"type\":\"function\",\"function\":{\"name\":\"write_file\",\"arguments\":\"\"}}],\"refusal\":null},\"finish_reason\":null}],\"usage\":null,\"obfuscation\":\"r\"}\n\ndata: {\"id\":\"chatcmpl-CYCUv3FroLFXPfMEnAfFmd7SUlNT6\",\"object\":\"chat.completion.chunk\",\"created\":1762267229,\"model\":\"gpt-5-mini-2025-08-07\",\"service_tier\":\"default\",\"system_fingerprint\":null,\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"{\\\"\"}}]},\"finish_reason\":null}],\"usage\":null,\"obfuscation\":\"gzZjus3bzI\"}\n\ndata: {\"id\":\"chatcmpl-CYCUv3FroLFXPfMEnAfFmd7SUlNT6\",\"object\":\"chat.completion.chunk\",\"created\":1762267229,\"model\":\"gpt-5-mini-2025-08-07\",\"service_tier\":\"default\",\"system_fingerprint\":null,\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"path\"}}]},\"finish_reason\":null}],\"usage\":null,\"obfuscation\":\"Medr4Mxej\"}\n\ndata: {\"id\":\"chatcmpl-CYCUv3FroLFXPfMEnAfFmd7SUlNT6\",\"object\":\"chat.completion.chunk\",\"created\":1762267229,\"model\":\"gpt-5-mini-2025-08-07\",\"service_tier\":\"default\",\"system_fingerprint\":null,\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"finish_reason\":null}],\"usage\":null,\"obfuscation\":\"sH0dbYG4\"}\n\ndata: {\"id\":\"chatcmpl-CYCUv3FroLFXPfMEnAfFmd7SUlNT6\",\"object\":\"chat.completion.chunk\",\"created\":1762267229,\"model\":\"gpt-5-mini-2025-08-07\",\"service_tier\":\"default\",\"system_fingerprint\":null,\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"hello\"}}]},\"finish_reason\":null}],\"usage\":null,\"obfuscation\":\"FhISNOGA\"}\n\ndata: {\"id\":\"chatcmpl-CYCUv3FroLFXPfMEnAfFmd7SUlNT6\",\"object\":\"chat.completion.chunk\",\"created\":1762267229,\"model\":\"gpt-5-mini-2025-08-07\",\"service_tier\":\"default\",\"system_fingerprint\":null,\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\".txt\"}}]},\"finish_reason\":null}],\"usage\":null,\"obfuscation\":\"tHXTZLdH1\"}\n\ndata: {\"id\":\"chatcmpl-CYCUv3FroLFXPfMEnAfFmd7SUlNT6\",\"object\":\"chat.completion.chunk\",\"created\":1762267229,\"model\":\"gpt-5-mini-2025-08-07\",\"service_tier\":\"default\",\"system_fingerprint\":null,\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\",\\\"\"}}]},\"finish_reason\":null}],\"usage\":null,\"obfuscation\":\"vzx32xpB\"}\n\ndata: {\"id\":\"chatcmpl-CYCUv3FroLFXPfMEnAfFmd7SUlNT6\",\"object\":\"chat.completion.chunk\",\"created\":1762267229,\"model\":\"gpt-5-mini-2025-08-07\",\"service_tier\":\"default\",\"system_fingerprint\":null,\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"content\"}}]},\"finish_reason\":null}],\"usage\":null,\"obfuscation\":\"s4gSeG\"}\n\ndata: {\"id\":\"chatcmpl-CYCUv3FroLFXPfMEnAfFmd7SUlNT6\",\"object\":\"chat.completion.chunk\",\"created\":1762267229,\"model\":\"gpt-5-mini-2025-08-07\",\"service_tier\":\"default\",\"system_fingerprint\":null,\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"\\\":\\\"\"}}]},\"finish_reason\":null}],\"usage\":null,\"obfuscation\":\"f2yh0ka7\"}\n\ndata: {\"id\":\"chatcmpl-CYCUv3FroLFXPfMEnAfFmd7SUlNT6\",\"object\":\"chat.completion.chunk\",\"created\":1762267229,\"model\":\"gpt-5-mini-2025-08-07\",\"service_tier\":\"default\",\"system_fingerprint\":null,\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"Hello\"}}]},\"finish_reason\":null}],\"usage\":null,\"obfuscation\":\"K0kOhxiq\"}\n\ndata: {\"id\":\"chatcmpl-CYCUv3FroLFXPfMEnAfFmd7SUlNT6\",\"object\":\"chat.completion.chunk\",\"created\":1762267229,\"model\":\"gpt-5-mini-2025-08-07\",\"service_tier\":\"default\",\"system_fingerprint\":null,\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\",\"}}]},\"finish_reason\":null}],\"usage\":null,\"obfuscation\":\"TB4rnVGhSVxI\"}\n\ndata: {\"id\":\"chatcmpl-CYCUv3FroLFXPfMEnAfFmd7SUlNT6\",\"object\":\"chat.completion.chunk\",\"created\":1762267229,\"model\":\"gpt-5-mini-2025-08-07\",\"service_tier\":\"default\",\"system_fingerprint\":null,\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\" World\"}}]},\"finish_reason\":null}],\"usage\":null,\"obfuscation\":\"OMtriny\"}\n\ndata: {\"id\":\"chatcmpl-CYCUv3FroLFXPfMEnAfFmd7SUlNT6\",\"object\":\"chat.completion.chunk\",\"created\":1762267229,\"model\":\"gpt-5-mini-2025-08-07\",\"service_tier\":\"default\",\"system_fingerprint\":null,\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"!\\\"\"}}]},\"finish_reason\":null}],\"usage\":null,\"obfuscation\":\"Eiq6bc66WL\"}\n\ndata: {\"id\":\"chatcmpl-CYCUv3FroLFXPfMEnAfFmd7SUlNT6\",\"object\":\"chat.completion.chunk\",\"created\":1762267229,\"model\":\"gpt-5-mini-2025-08-07\",\"service_tier\":\"default\",\"system_fingerprint\":null,\"choices\":[{\"index\":0,\"delta\":{\"tool_calls\":[{\"index\":0,\"function\":{\"arguments\":\"}\"}}]},\"finish_reason\":null}],\"usage\":null,\"obfuscation\":\"bZWwxAh59SfZ\"}\n\ndata: {\"id\":\"chatcmpl-CYCUv3FroLFXPfMEnAfFmd7SUlNT6\",\"object\":\"chat.completion.chunk\",\"created\":1762267229,\"model\":\"gpt-5-mini-2025-08-07\",\"service_tier\":\"default\",\"system_fingerprint\":null,\"choices\":[{\"index\":0,\"delta\":{},\"finish_reason\":\"tool_calls\"}],\"usage\":null,\"obfuscation\":\"vpofJxEZMZn\"}\n\ndata: {\"id\":\"chatcmpl-CYCUv3FroLFXPfMEnAfFmd7SUlNT6\",\"object\":\"chat.completion.chunk\",\"created\":1762267229,\"model\":\"gpt-5-mini-2025-08-07\",\"service_tier\":\"default\",\"system_fingerprint\":null,\"choices\":[],\"usage\":{\"prompt_tokens\":381,\"completion_tokens\":799,\"total_tokens\":1180,\"prompt_tokens_details\":{\"cached_tokens\":0,\"audio_tokens\":0},\"completion_tokens_details\":{\"reasoning_tokens\":768,\"audio_tokens\":0,\"accepted_prediction_tokens\":0,\"rejected_prediction_tokens\":0}},\"obfuscation\":\"\"}\n\ndata: [DONE]\n\n"
18+
content_length: 245
19+
body: "{\n \"error\": {\n \"message\": \"Unsupported value: 'temperature' does not support 0 with this model. Only the default (1) value is supported.\",\n \"type\": \"invalid_request_error\",\n \"param\": \"temperature\",\n \"code\": \"unsupported_value\"\n }\n}"
2020
headers: {}
21-
status: 200 OK
22-
code: 200
23-
duration: 14.522897375s
24-
- id: 1
25-
request:
26-
proto: HTTP/1.1
27-
proto_major: 1
28-
proto_minor: 1
29-
content_length: 0
30-
host: api.openai.com
31-
body: "{\"model\":\"gpt-5-mini\",\"messages\":[{\"role\":\"system\",\"content\":\"You are a knowledgeable assistant that can write test files.\"},{\"role\":\"system\",\"content\":\"## Filesystem Tool Instructions\\n\\nThis toolset provides comprehensive filesystem operations with built-in security restrictions.\\n\\n### Security Model\\n- All operations are restricted to allowed directories only\\n- Use list_allowed_directories to see available paths\\n- Subdirectories within allowed directories are accessible\\n- Use add_allowed_directory to request access to new directories (requires user consent)\\n\\n### Directory Access Management\\n- If you need access to a directory outside the allowed list, use add_allowed_directory\\n- This will request user consent before expanding filesystem access\\n- Always provide a clear reason when requesting new directory access\\n\\n### Common Patterns\\n- Always check if directories exist before creating files\\n- Prefer read_multiple_files for batch operations\\n- Use search_files_content for finding specific code or text\\n\\n### Performance Tips\\n- Use read_multiple_files instead of multiple read_file calls\\n- Use directory_tree with max_depth to limit large traversals\\n- Use appropriate exclude patterns in search operations\"},{\"role\":\"user\",\"content\":\"Create a hello.txt file with \\\"Hello, World!\\\" content. Try only once. On error, exit without further message.\"},{\"role\":\"assistant\",\"tool_calls\":[{\"id\":\"call_1l99RCuSJIgyl6aJhcQcB3w1\",\"type\":\"function\",\"function\":{\"name\":\"write_file\",\"arguments\":\"{\\\"path\\\":\\\"hello.txt\\\",\\\"content\\\":\\\"Hello, World!\\\"}\"}}]},{\"role\":\"tool\",\"content\":\"The user rejected the tool call.\",\"tool_call_id\":\"call_1l99RCuSJIgyl6aJhcQcB3w1\"}],\"stream\":true,\"tools\":[{\"type\":\"function\",\"function\":{\"name\":\"write_file\",\"description\":\"Create a new file or completely overwrite an existing file with new content.\",\"parameters\":{\"additionalProperties\":false,\"properties\":{\"content\":{\"description\":\"The content to write to the file\",\"type\":\"string\"},\"path\":{\"description\":\"The file path to write\",\"type\":\"string\"}},\"required\":[\"path\",\"content\"],\"type\":\"object\"}}}],\"stream_options\":{\"include_usage\":true}}"
32-
url: https://api.openai.com/v1/chat/completions
33-
method: POST
34-
response:
35-
proto: HTTP/2.0
36-
proto_major: 2
37-
proto_minor: 0
38-
content_length: -1
39-
body: "data: {\"id\":\"chatcmpl-CYCVAeaL5P1w77PGELqdglolCtsTy\",\"object\":\"chat.completion.chunk\",\"created\":1762267244,\"model\":\"gpt-5-mini-2025-08-07\",\"service_tier\":\"default\",\"system_fingerprint\":null,\"choices\":[{\"index\":0,\"delta\":{\"role\":\"assistant\",\"content\":\"\",\"refusal\":null},\"finish_reason\":null}],\"usage\":null,\"obfuscation\":\"8P3BX\"}\n\ndata: {\"id\":\"chatcmpl-CYCVAeaL5P1w77PGELqdglolCtsTy\",\"object\":\"chat.completion.chunk\",\"created\":1762267244,\"model\":\"gpt-5-mini-2025-08-07\",\"service_tier\":\"default\",\"system_fingerprint\":null,\"choices\":[{\"index\":0,\"delta\":{},\"finish_reason\":\"stop\"}],\"usage\":null,\"obfuscation\":\"s\"}\n\ndata: {\"id\":\"chatcmpl-CYCVAeaL5P1w77PGELqdglolCtsTy\",\"object\":\"chat.completion.chunk\",\"created\":1762267244,\"model\":\"gpt-5-mini-2025-08-07\",\"service_tier\":\"default\",\"system_fingerprint\":null,\"choices\":[],\"usage\":{\"prompt_tokens\":424,\"completion_tokens\":137,\"total_tokens\":561,\"prompt_tokens_details\":{\"cached_tokens\":0,\"audio_tokens\":0},\"completion_tokens_details\":{\"reasoning_tokens\":128,\"audio_tokens\":0,\"accepted_prediction_tokens\":0,\"rejected_prediction_tokens\":0}},\"obfuscation\":\"H\"}\n\ndata: [DONE]\n\n"
40-
headers: {}
41-
status: 200 OK
42-
code: 200
43-
duration: 3.793669625s
21+
status: 400 Bad Request
22+
code: 400
23+
duration: 370.031459ms

e2e/testdata/cassettes/TestMCP_MultiAgent.yaml

Lines changed: 0 additions & 23 deletions
This file was deleted.

0 commit comments

Comments
 (0)