openai-agents-python/tests
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
..
__init__.py Initial commit 2025-03-11 09:42:28 -07:00
conftest.py Initial commit 2025-03-11 09:42:28 -07:00
fake_model.py Initial commit 2025-03-11 09:42:28 -07:00
test_agent_config.py Initial commit 2025-03-11 09:42:28 -07:00
test_agent_hooks.py Initial commit 2025-03-11 09:42:28 -07:00
test_agent_runner.py Initial commit 2025-03-11 09:42:28 -07:00
test_agent_runner_streamed.py Initial commit 2025-03-11 09:42:28 -07:00
test_agent_tracing.py Initial commit 2025-03-11 09:42:28 -07:00
test_computer_action.py Initial commit 2025-03-11 09:42:28 -07:00
test_config.py make format 2025-03-11 14:54:10 -07:00
test_doc_parsing.py Initial commit 2025-03-11 09:42:28 -07:00
test_extension_filters.py Initial commit 2025-03-11 09:42:28 -07:00
test_function_schema.py Initial commit 2025-03-11 09:42:28 -07:00
test_function_tool.py Initial commit 2025-03-11 09:42:28 -07:00
test_function_tool_decorator.py fix: resolve linting issues 2025-03-12 16:00:20 +05:30
test_global_hooks.py Initial commit 2025-03-11 09:42:28 -07:00
test_guardrails.py Initial commit 2025-03-11 09:42:28 -07:00
test_handoff_tool.py Initial commit 2025-03-11 09:42:28 -07:00
test_items_helpers.py pin to openai 1.66.2, update tests 2025-03-11 15:26:06 -07:00
test_max_turns.py Initial commit 2025-03-11 09:42:28 -07:00
test_openai_chatcompletions.py Initial commit 2025-03-11 09:42:28 -07:00
test_openai_chatcompletions_converter.py refactor: update formatting in test_assistant_messages_in_history 2025-03-13 00:20:59 +05:00
test_openai_chatcompletions_stream.py Fix streaming in chat completions 2025-03-12 17:17:07 -07:00
test_openai_responses_converter.py pin to openai 1.66.2, update tests 2025-03-11 15:26:06 -07:00
test_output_tool.py Initial commit 2025-03-11 09:42:28 -07:00
test_responses.py Initial commit 2025-03-11 09:42:28 -07:00
test_responses_tracing.py Initial commit 2025-03-11 09:42:28 -07:00
test_result_cast.py Initial commit 2025-03-11 09:42:28 -07:00
test_run_config.py Initial commit 2025-03-11 09:42:28 -07:00
test_run_step_execution.py Initial commit 2025-03-11 09:42:28 -07:00
test_run_step_processing.py pin to openai 1.66.2, update tests 2025-03-11 15:26:06 -07:00
test_strict_schema.py Initial commit 2025-03-11 09:42:28 -07:00
test_tool_converter.py Initial commit 2025-03-11 09:42:28 -07:00
test_trace_processor.py Initial commit 2025-03-11 09:42:28 -07:00
test_tracing.py Initial commit 2025-03-11 09:42:28 -07:00
test_tracing_errors.py Initial commit 2025-03-11 09:42:28 -07:00
test_tracing_errors_streamed.py Initial commit 2025-03-11 09:42:28 -07:00
testing_processor.py Initial commit 2025-03-11 09:42:28 -07:00