Fix Engine and OpenAI Agents adapter #3
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request includes several updates to the Thirdweb AI services and examples, with a focus on enhancing the Engine service and improving schema handling. The most important changes include adding new functionalities to the Engine service, updating the example script to use the new Engine service, and improving schema parsing in the OpenAI adapter.
Enhancements to the Engine service:
python/thirdweb-ai/src/thirdweb_ai/services/engine.py: Added_make_headersmethod to includeAuthorizationandX-Backend-Wallet-Addressheaders if available. Updated various methods to includechain_idandbackend_wallet_addressparameters and adjusted payload handling. [1] [2] [3] [4] [5] [6]Updates to the example script:
python/examples/adapter_openai/example.py: Imported theEngineclass and initialized it with environment variables. Updated theAgentinitialization to include tools from theEngineinstance. [1] [2]Improvements to schema handling:
python/thirdweb-ai/src/thirdweb_ai/adapters/openai/agents.py: Enhanced_get_openai_schemafunction to recursively handleanyOf,oneOf, andallOffields in schemas.General codebase improvements:
python/thirdweb-ai/src/thirdweb_ai/services/service.py: Refactored_getand_postmethods to ensure base URLs are properly formatted and headers are merged correctly.