Skip to content

Commit 8ff4db7

Browse files
committed
Fixed issue OpenAI strictmode
1 parent afddade commit 8ff4db7

File tree

1 file changed

+6
-1
lines changed
  • pydantic_ai_slim/pydantic_ai/profiles

1 file changed

+6
-1
lines changed

pydantic_ai_slim/pydantic_ai/profiles/openai.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,12 @@ def walk(self) -> JsonSchema:
157157
if self.root_ref is not None:
158158
result.pop('$ref', None) # We replace references to the self.root_ref with just '#' in the transform method
159159
root_key = re.sub(r'^#/\$defs/', '', self.root_ref)
160-
result.update(self.defs.get(root_key) or {})
160+
# Use the transformed schema from $defs, not the original self.defs
161+
if '$defs' in result and root_key in result['$defs']:
162+
result.update(result['$defs'][root_key])
163+
else:
164+
# Fallback to original if transformed version not available (shouldn't happen in normal flow)
165+
result.update(self.defs.get(root_key) or {})
161166

162167
return result
163168

0 commit comments

Comments
 (0)