(bug) Harden OCI tool schema conversion for cross-model tool-calling reliability#157
Open
fede-kamel wants to merge 1 commit intooracle:mainfrom
Open
(bug) Harden OCI tool schema conversion for cross-model tool-calling reliability#157fede-kamel wants to merge 1 commit intooracle:mainfrom
fede-kamel wants to merge 1 commit intooracle:mainfrom
Conversation
a2dfda5 to
42ebdda
Compare
42ebdda to
b1402d2
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Harden OCI tool schema conversion before provider-specific tool conversion.
Closes #156.
Why this change exists
OCI tool calling is only as reliable as the schema we send to the backend. The shared conversion path already resolves some schema features, but it still allows a few invalid or noisy constructs through.
That creates two practical problems:
This shows up most clearly with stricter models such as Gemini, but it is not a Gemini-only problem. Meta, Cohere, Grok, and GPT-family models also benefit when the tool schema is smaller, internally consistent, and OCI-safe.
Fixing this in the common OCI conversion layer is higher-value than leaving downstream applications to patch tool schemas individually.
What changed
langchain_oci.common.utilsrequiredentries that no longer exist inpropertiestitleanddefault: nullmetadatatype: anyand nullable type arraysitemsschema$refchains defensivelyValue
This improves the shared OCI integration across model families:
Validation
Unit coverage:
python -m pytest tests/unit_tests/chat_models/test_tool_schema_constraints.pyIntegration coverage:
python -m pytest tests/integration_tests/chat_models/test_tool_schema_constraints.pyLive OCI validation:
Non-goals
This PR does not change:
Those should stay in follow-up PRs.