Commit graph

102 commits

Author SHA1 Message Date
Rohan Mehta
4cb011c4d2
Fix Typos (#258)
Noticed a bunch of typos when reading code, fixing.
2025-03-23 20:28:14 -04:00
xianghuijin
6ed0bee672 fix: prevent modifying the original agent's model_settings
This fixes the issue where the original agent's model_settings was being directly modified during the tool choice reset process. The original implementation caused the agent's tool_choice to unintentionally reset to "auto" for subsequent runs, which could be unexpected behavior.

The fix creates new copies of the agent and model settings objects using dataclasses.replace() instead of modifying the original objects. This ensures that the tool choice reset is limited to the current run only, maintaining the expected behavior for sequential runs with the same agent.

Addresses feedback from @baderalfahad about the agent instance being modified when it should maintain its original state between runs.
2025-03-23 17:20:23 +08:00
xianghuijin
bbcda753df fix: optimize tool_choice reset logic and fix lint errors
- Refactor tool_choice reset to target only problematic edge cases
- Replace manual ModelSettings recreation with dataclasses.replace
- Fix line length and error handling lint issues in tests
2025-03-22 14:10:09 +08:00
Rohan Mehta
c0794a90ec Read tracing API data lazily 2025-03-21 15:32:37 -04:00
Alex Hall
dacbb9ba44 More fetch_normalized_spans 2025-03-21 18:31:06 +02:00
Alex Hall
6b509e33f6 empty assertions 2025-03-21 18:26:04 +02:00
Alex Hall
a00b61f355 More fetch_normalized_spans 2025-03-21 18:15:52 +02:00
Alex Hall
153f703211 More fetch_normalized_spans 2025-03-21 18:14:59 +02:00
Alex Hall
7581696b38 More fetch_normalized_spans 2025-03-21 18:13:04 +02:00
Alex Hall
cb0eb8e254 More fetch_normalized_spans 2025-03-21 18:09:19 +02:00
Alex Hall
f3296199c4 Merge branch 'main' of github.com:openai/openai-agents-python into alex/cleanup-tests 2025-03-21 10:13:33 +02:00
Rohan Mehta
1771c1e856 update tests 2025-03-20 13:08:38 -04:00
Dominik Kundel
aec066649c fix tests 2025-03-20 09:52:15 -07:00
Dominik Kundel
c7ce154637 feat: add voice pipeline support
> Co-authored-by: rm@openai.com
2025-03-20 09:43:13 -07:00
xianghuijin
9384a0fb3f Revert test file name to match project naming style 2025-03-20 21:28:24 +08:00
xianghuijin
cde67f2b71 Rename test file for better clarity 2025-03-20 21:26:59 +08:00
xianghuijin
fb77c74fa1 Fix potential infinite tool call loop by resetting tool_choice after tool execution 2025-03-20 21:22:27 +08:00
Alex Hall
ea3e8ce230 lint 2025-03-20 13:56:11 +02:00
Alex Hall
7031d4ab87 Remove redundant weaker tracing assertions 2025-03-20 13:49:38 +02:00
Raduan77
96d1e8af8e fix typos in tests 2025-03-20 11:24:15 +01:00
Rohan Mehta
10aa5555af Introduce tool_use_behavior on agents 2025-03-18 21:55:12 -04:00
Rohan Mehta
6f7e801da0
Update tests and docs for strict mode decorator (#205)
As titled. Test plan: unit tests/docs.
2025-03-18 21:35:00 -04:00
Martín Bravo
0079bca717 style: improve code formatting and readability in visualization functions 2025-03-18 10:09:44 +01:00
Martín Bravo
39ff00dd9d rename: test_visualization.py 2025-03-18 09:59:47 +01:00
Martín Bravo
f7c594da08 feat: add visualization functions for agent graphs 2025-03-18 09:53:48 +01:00
Martín Bravo
aff1d60ea1 Merge branch 'main' of https://github.com/openai/openai-agents-python into feat/draw_graph 2025-03-17 23:50:52 +01:00
Alex Hall
7eb2bcee15 mypy 2025-03-17 23:56:42 +02:00
Alex Hall
2d2e8f0e34 Merge branch 'main' of github.com:openai/openai-agents-python into alex/inline-snapshot 2025-03-17 23:55:56 +02:00
Rohan Mehta
47aed7d362 Update tests and docs for strict mode decorator 2025-03-17 15:06:57 -04:00
Rohan Mehta
64e263b614 Pretty print result classes 2025-03-17 11:11:39 -04:00
MartinEBravo
e984274da1 Merge branch 'main' of https://github.com/openai/openai-agents-python into feat/draw_graph 2025-03-17 10:17:36 +01:00
Rohan Mehta
09d70c074d utils directory 2025-03-16 18:48:45 -04:00
Rohan Mehta
951193bd21
feat: Add strict_mode option to function_schema and function_tool (#60)
This PR introduces a `strict_mode: bool = True` option to
`@function_tool`, allowing optional parameters when set to False. This
change enables more flexibility while maintaining strict JSON schema
validation by default.

resolves #43 

## Changes:

- Added `strict_mode` parameter to `@function_tool` and passed it to
`function_schema` and `FunctionTool`.
- Updated `function_schema.py` to respect `strict_mode` and allow
optional parameters when set to False.
- Added unit tests to verify optional parameters work correctly,
including multiple optional params with different types.

## Tests:

- Verified function calls with missing optional parameters behave as
expected.
- Added async tests to validate behavior under different configurations.
2025-03-16 17:43:46 -04:00
Alex Hall
4d2fa9d91c Merge branch 'main' of github.com:openai/openai-agents-python into alex/inline-snapshot 2025-03-14 14:16:34 +02:00
Martín Bravo
29e9983ae8 Linting 2025-03-13 18:49:12 +01:00
Martín Bravo
9b972b33fa Add unit tests for visualization functions in test_visualizations.py 2025-03-13 18:33:17 +01:00
Rohan Mehta
2302b478af Fix streaming in chat completions 2025-03-12 17:17:07 -07:00
Muhammad Junaid
c09a2258af refactor: update formatting in test_assistant_messages_in_history
- Enhanced the readability of the test case by reformatting the expected output and input message structures.
- This change maintains the same functionality while making the test code cleaner and easier to understand.
2025-03-13 00:20:59 +05:00
Muhammad Junaid
51d79bf141 fix: support assistant role in message conversion
- The _Converter.items_to_messages method was incorrectly rejecting 'assistant'
as a valid role in conversation messages, causing runtime errors when processing
standard chat completion message formats.
- This fix enables proper handling of
complete conversation contexts that include both user and assistant messages.
2025-03-12 21:10:03 +05:00
Jai0401
0c33a24d8f fix: resolve linting issues 2025-03-12 16:00:20 +05:30
Alex Hall
5aba0b5b19 Merge branch 'main' of github.com:openai/openai-agents-python into alex/inline-snapshot 2025-03-12 11:01:00 +02:00
Jai0401
b7e7fdee55 feat: Add strict mode option to function_schema and function_tool 2025-03-12 11:45:32 +05:30
Rohan Mehta
c27d7b7d24 pin to openai 1.66.2, update tests 2025-03-11 15:26:06 -07:00
Alex Hall
ecb7d90d4d Merge branch 'main' of github.com:openai/openai-agents-python into alex/inline-snapshot 2025-03-12 00:25:21 +02:00
Rohan Mehta
ce66d908a9 make format 2025-03-11 14:54:10 -07:00
Alex Hall
c03d314fb8 Stronger tracing tests with inline-snapshot 2025-03-11 22:57:14 +02:00
Alex Hall
c374ad064f Run make format 2025-03-11 22:53:48 +02:00
Rohan Mehta
88ee0a87ff Remove duplicated files in tests 2025-03-11 13:12:32 -07:00
Rohan Mehta
ba7453cc24 a few more 2025-03-11 11:27:01 -07:00
Rohan Mehta
249d155082 more pycache 2025-03-11 11:25:30 -07:00
Rohan Mehta
aabcc4aba1 update cua model 2025-03-11 11:22:37 -07:00
Rohan Mehta
aaec57a426 Initial commit 2025-03-11 09:42:28 -07:00