openai-agents-python/src/agents
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
..
extensions Merge pull request #8 from openai/repo/gitignore 2025-03-11 11:17:37 -07:00
models Add examples and documentation for using custom model providers (#110) 2025-03-13 08:17:25 -07:00
tracing Consolidate to one logger (#149) 2025-03-13 11:38:18 -07:00
__init__.py Consolidate to one logger 2025-03-13 13:55:15 -04:00
_config.py Add examples and documentation for using custom model providers 2025-03-12 17:34:38 -07:00
_debug.py Initial commit 2025-03-11 09:42:28 -07:00
_run_impl.py Merge branch 'main' into hironow/chore-doc-type 2025-03-12 10:13:25 +09:00
_utils.py Initial commit 2025-03-11 09:42:28 -07:00
agent.py Initial commit 2025-03-11 09:42:28 -07:00
agent_output.py make format 2025-03-11 14:54:10 -07:00
computer.py Initial commit 2025-03-11 09:42:28 -07:00
exceptions.py Initial commit 2025-03-11 09:42:28 -07:00
function_schema.py fix: resolve linting issues 2025-03-12 16:00:20 +05:30
guardrail.py chore: update guardrail.py 2025-03-12 22:45:17 +09:00
handoffs.py Initial commit 2025-03-11 09:42:28 -07:00
items.py pin to openai 1.66.2, update tests 2025-03-11 15:26:06 -07:00
lifecycle.py Initial commit 2025-03-11 09:42:28 -07:00
logger.py Initial commit 2025-03-11 09:42:28 -07:00
model_settings.py Add max_tokens and documentation to model settings 2025-03-12 13:35:10 -07:00
result.py Remove duplicated code 2025-03-12 13:08:00 -07:00
run.py Initial commit 2025-03-11 09:42:28 -07:00
run_context.py Initial commit 2025-03-11 09:42:28 -07:00
stream_events.py Initial commit 2025-03-11 09:42:28 -07:00
strict_schema.py Initial commit 2025-03-11 09:42:28 -07:00
tool.py fix: resolve linting issues 2025-03-12 16:00:20 +05:30
usage.py Initial commit 2025-03-11 09:42:28 -07:00
version.py Initial commit 2025-03-11 09:42:28 -07:00