From 7a71a79dae5bb9ec6d08dc2b797e2cfbcd915862 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Sat, 22 Mar 2025 01:03:16 +0000 Subject: [PATCH] Add test cassettes for tool usage events Co-Authored-By: Joe Moura --- ...mits_finished_events_with_dict_result.yaml | 92 ++++++++++++++++++ ...mits_finished_events_with_none_result.yaml | 91 ++++++++++++++++++ ...ts_finished_events_with_string_result.yaml | 93 +++++++++++++++++++ 3 files changed, 276 insertions(+) create mode 100644 tests/utilities/cassettes/test_tools_emits_finished_events_with_dict_result.yaml create mode 100644 tests/utilities/cassettes/test_tools_emits_finished_events_with_none_result.yaml create mode 100644 tests/utilities/cassettes/test_tools_emits_finished_events_with_string_result.yaml diff --git a/tests/utilities/cassettes/test_tools_emits_finished_events_with_dict_result.yaml b/tests/utilities/cassettes/test_tools_emits_finished_events_with_dict_result.yaml new file mode 100644 index 000000000..0d96120ff --- /dev/null +++ b/tests/utilities/cassettes/test_tools_emits_finished_events_with_dict_result.yaml @@ -0,0 +1,92 @@ +interactions: +- request: + body: '{"messages": [{"role": "system", "content": "You are base_agent. You are + a helpful assistant that returns structured data\nYour personal goal is: Return + a dictionary result\nYou ONLY have access to the following tools, and should + NEVER make up tools that are not listed here:\n\nTool Name: dict_result\nTool + Arguments: {}\nTool Description: Return a dictionary result\n\nIMPORTANT: Use + the following format in your response:\n\n```\nThought: you should always think + about what to do\nAction: the action to take, only one name of [dict_result], + just the name, exactly as it''s written.\nAction Input: the input to the action, + just a simple JSON object, enclosed in curly braces, using \" to wrap keys and + values.\nObservation: the result of the action\n```\n\nOnce all necessary information + is gathered, return the following format:\n\n```\nThought: I now know the final + answer\nFinal Answer: the final answer to the original input question\n```"}, + {"role": "user", "content": "\nCurrent Task: Return a dictionary result\n\nThis + is the expected criteria for your final answer: Dictionary with message and + data\nyou MUST return the actual complete content as the final answer, not a + summary.\n\nBegin! This is VERY important to you, use the tools available and + give your best Final Answer, your job depends on it!\n\nThought:"}], "model": + "gpt-4o-mini", "stop": ["\nObservation:"]}' + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate + connection: + - keep-alive + content-length: + - '1378' + content-type: + - application/json + cookie: + - __cf_bm=KV5GuGyEdKrxlT_rqmqKhQ9TUxeMz_ccZ5K3Xu.mfLc-1742605207-1.0.1.1-1aSRm5P8hBtB3zVmHWH3LcYPoXvhsezGomR1uazQeGCEWL_uUIGP1x3dMkviSWrjf88WKm1snQNn.Eyy8_qewmd7NT7lqUt0MgRWVgfCOAY; + _cfuvid=1KExsJlCZ0R2Kp3gV2Y71_SiQ0R2D9rAbONnmJq7tjk-1742605207873-0.0.1.1-604800000 + host: + - api.openai.com + user-agent: + - OpenAI/Python 1.61.0 + x-stainless-arch: + - x64 + x-stainless-async: + - 'false' + x-stainless-lang: + - python + x-stainless-os: + - Linux + x-stainless-package-version: + - 1.61.0 + x-stainless-raw-response: + - 'true' + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.12.7 + method: POST + uri: https://api.openai.com/v1/chat/completions + response: + content: "{\n \"error\": {\n \"message\": \"Incorrect API key provided: + sk-proj-********************************************************************************************************************************************************sLcA. + You can find your API key at https://platform.openai.com/account/api-keys.\",\n + \ \"type\": \"invalid_request_error\",\n \"param\": null,\n \"code\": + \"invalid_api_key\"\n }\n}\n" + headers: + CF-RAY: + - 9241c01b0df3b9d9-SEA + Connection: + - keep-alive + Content-Length: + - '414' + Content-Type: + - application/json; charset=utf-8 + Date: + - Sat, 22 Mar 2025 01:00:08 GMT + Server: + - cloudflare + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + strict-transport-security: + - max-age=31536000; includeSubDomains; preload + vary: + - Origin + x-request-id: + - req_d0eae92c72f0f64514d32384a7f27a9a + http_version: HTTP/1.1 + status_code: 401 +version: 1 diff --git a/tests/utilities/cassettes/test_tools_emits_finished_events_with_none_result.yaml b/tests/utilities/cassettes/test_tools_emits_finished_events_with_none_result.yaml new file mode 100644 index 000000000..9560e2838 --- /dev/null +++ b/tests/utilities/cassettes/test_tools_emits_finished_events_with_none_result.yaml @@ -0,0 +1,91 @@ +interactions: +- request: + body: '{"messages": [{"role": "system", "content": "You are base_agent. You are + a helpful assistant that returns None\nYour personal goal is: Return None as + result\nYou ONLY have access to the following tools, and should NEVER make up + tools that are not listed here:\n\nTool Name: none_result\nTool Arguments: {}\nTool + Description: Return None as result\n\nIMPORTANT: Use the following format in + your response:\n\n```\nThought: you should always think about what to do\nAction: + the action to take, only one name of [none_result], just the name, exactly as + it''s written.\nAction Input: the input to the action, just a simple JSON object, + enclosed in curly braces, using \" to wrap keys and values.\nObservation: the + result of the action\n```\n\nOnce all necessary information is gathered, return + the following format:\n\n```\nThought: I now know the final answer\nFinal Answer: + the final answer to the original input question\n```"}, {"role": "user", "content": + "\nCurrent Task: Return None as result\n\nThis is the expected criteria for + your final answer: None\nyou MUST return the actual complete content as the + final answer, not a summary.\n\nBegin! This is VERY important to you, use the + tools available and give your best Final Answer, your job depends on it!\n\nThought:"}], + "model": "gpt-4o-mini", "stop": ["\nObservation:"]}' + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate + connection: + - keep-alive + content-length: + - '1324' + content-type: + - application/json + cookie: + - __cf_bm=KV5GuGyEdKrxlT_rqmqKhQ9TUxeMz_ccZ5K3Xu.mfLc-1742605207-1.0.1.1-1aSRm5P8hBtB3zVmHWH3LcYPoXvhsezGomR1uazQeGCEWL_uUIGP1x3dMkviSWrjf88WKm1snQNn.Eyy8_qewmd7NT7lqUt0MgRWVgfCOAY; + _cfuvid=1KExsJlCZ0R2Kp3gV2Y71_SiQ0R2D9rAbONnmJq7tjk-1742605207873-0.0.1.1-604800000 + host: + - api.openai.com + user-agent: + - OpenAI/Python 1.61.0 + x-stainless-arch: + - x64 + x-stainless-async: + - 'false' + x-stainless-lang: + - python + x-stainless-os: + - Linux + x-stainless-package-version: + - 1.61.0 + x-stainless-raw-response: + - 'true' + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.12.7 + method: POST + uri: https://api.openai.com/v1/chat/completions + response: + content: "{\n \"error\": {\n \"message\": \"Incorrect API key provided: + sk-proj-********************************************************************************************************************************************************sLcA. + You can find your API key at https://platform.openai.com/account/api-keys.\",\n + \ \"type\": \"invalid_request_error\",\n \"param\": null,\n \"code\": + \"invalid_api_key\"\n }\n}\n" + headers: + CF-RAY: + - 9241c01eea3db9d9-SEA + Connection: + - keep-alive + Content-Length: + - '414' + Content-Type: + - application/json; charset=utf-8 + Date: + - Sat, 22 Mar 2025 01:00:09 GMT + Server: + - cloudflare + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + strict-transport-security: + - max-age=31536000; includeSubDomains; preload + vary: + - Origin + x-request-id: + - req_00b89378d512de492b7c90876d0e3c8a + http_version: HTTP/1.1 + status_code: 401 +version: 1 diff --git a/tests/utilities/cassettes/test_tools_emits_finished_events_with_string_result.yaml b/tests/utilities/cassettes/test_tools_emits_finished_events_with_string_result.yaml new file mode 100644 index 000000000..02b51fe60 --- /dev/null +++ b/tests/utilities/cassettes/test_tools_emits_finished_events_with_string_result.yaml @@ -0,0 +1,93 @@ +interactions: +- request: + body: '{"messages": [{"role": "system", "content": "You are base_agent. You are + a helpful assistant that just says hi\nYour personal goal is: Just say hi\nYou + ONLY have access to the following tools, and should NEVER make up tools that + are not listed here:\n\nTool Name: say_hi\nTool Arguments: {}\nTool Description: + Say hi\n\nIMPORTANT: Use the following format in your response:\n\n```\nThought: + you should always think about what to do\nAction: the action to take, only one + name of [say_hi], just the name, exactly as it''s written.\nAction Input: the + input to the action, just a simple JSON object, enclosed in curly braces, using + \" to wrap keys and values.\nObservation: the result of the action\n```\n\nOnce + all necessary information is gathered, return the following format:\n\n```\nThought: + I now know the final answer\nFinal Answer: the final answer to the original + input question\n```"}, {"role": "user", "content": "\nCurrent Task: Just say + hi\n\nThis is the expected criteria for your final answer: hi\nyou MUST return + the actual complete content as the final answer, not a summary.\n\nBegin! This + is VERY important to you, use the tools available and give your best Final Answer, + your job depends on it!\n\nThought:"}], "model": "gpt-4o-mini", "stop": ["\nObservation:"]}' + headers: + accept: + - application/json + accept-encoding: + - gzip, deflate + connection: + - keep-alive + content-length: + - '1277' + content-type: + - application/json + host: + - api.openai.com + user-agent: + - OpenAI/Python 1.61.0 + x-stainless-arch: + - x64 + x-stainless-async: + - 'false' + x-stainless-lang: + - python + x-stainless-os: + - Linux + x-stainless-package-version: + - 1.61.0 + x-stainless-raw-response: + - 'true' + x-stainless-retry-count: + - '0' + x-stainless-runtime: + - CPython + x-stainless-runtime-version: + - 3.12.7 + method: POST + uri: https://api.openai.com/v1/chat/completions + response: + content: "{\n \"error\": {\n \"message\": \"Incorrect API key provided: + sk-proj-********************************************************************************************************************************************************sLcA. + You can find your API key at https://platform.openai.com/account/api-keys.\",\n + \ \"type\": \"invalid_request_error\",\n \"param\": null,\n \"code\": + \"invalid_api_key\"\n }\n}\n" + headers: + CF-RAY: + - 9241c014df27b9d9-SEA + Connection: + - keep-alive + Content-Length: + - '414' + Content-Type: + - application/json; charset=utf-8 + Date: + - Sat, 22 Mar 2025 01:00:07 GMT + Server: + - cloudflare + Set-Cookie: + - __cf_bm=KV5GuGyEdKrxlT_rqmqKhQ9TUxeMz_ccZ5K3Xu.mfLc-1742605207-1.0.1.1-1aSRm5P8hBtB3zVmHWH3LcYPoXvhsezGomR1uazQeGCEWL_uUIGP1x3dMkviSWrjf88WKm1snQNn.Eyy8_qewmd7NT7lqUt0MgRWVgfCOAY; + path=/; expires=Sat, 22-Mar-25 01:30:07 GMT; domain=.api.openai.com; HttpOnly; + Secure; SameSite=None + - _cfuvid=1KExsJlCZ0R2Kp3gV2Y71_SiQ0R2D9rAbONnmJq7tjk-1742605207873-0.0.1.1-604800000; + path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None + X-Content-Type-Options: + - nosniff + alt-svc: + - h3=":443"; ma=86400 + cf-cache-status: + - DYNAMIC + strict-transport-security: + - max-age=31536000; includeSubDomains; preload + vary: + - Origin + x-request-id: + - req_b2233dbbb60c3ebb5717c05ec5150588 + http_version: HTTP/1.1 + status_code: 401 +version: 1