Repository navigation
fix(converter): preserve agent reference in pydantic coercion fallback #7989
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
1aa889e
edb3fe5
ed1af62
5507276
64d1b35
0176128
07116d4
bac9f3c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -67,7 +67,7 @@ def _coerce_response_to_pydantic(self, response: Any) -> BaseModel: | |
| result=response, | ||
| model=self.model, | ||
| is_json_output=False, | ||
| agent=None, | ||
| agent=self.agent, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Async fallback blocks the event loopHigh Severity
Additional Locations (1)Reviewed by Cursor Bugbot for commit 1aa889e. Configure here.
cursor[bot] marked this conversation as resolved.
Resolved
|
||
| ) | ||
| if isinstance(partial, BaseModel): | ||
| return partial | ||
|
|
@@ -405,9 +405,14 @@ def convert_with_instructions( | |
| raise ValueError("Agent must have a valid LLM instance for conversion") | ||
|
|
||
| instructions = get_conversion_instructions(model=model, llm=llm) | ||
| # The refit converter must NOT carry the calling agent: an agent-stamped | ||
| # converter routes its own partial-JSON fallback back through | ||
| # convert_with_instructions, spawning a nested LLM call tree on every | ||
| # failed attempt (unbounded provider fan-out). With agent=None, a | ||
| # ValidationError stays inside this converter's max_attempts loop. | ||
| converter = create_converter( | ||
| agent=agent, | ||
| converter_cls=converter_cls, | ||
| agent=None, | ||
| converter_cls=converter_cls or Converter, | ||
| llm=llm, | ||
| text=result, | ||
| model=model, | ||
|
|
@@ -549,9 +554,14 @@ async def async_convert_with_instructions( | |
| raise ValueError("Agent must have a valid LLM instance for conversion") | ||
|
|
||
| instructions = get_conversion_instructions(model=model, llm=llm) | ||
| # The refit converter must NOT carry the calling agent: an agent-stamped | ||
| # converter routes its own partial-JSON fallback back through | ||
| # convert_with_instructions, spawning a nested LLM call tree on every | ||
| # failed attempt (unbounded provider fan-out). With agent=None, a | ||
| # ValidationError stays inside this converter's max_attempts loop. | ||
| converter = create_converter( | ||
| agent=agent, | ||
| converter_cls=converter_cls, | ||
| agent=None, | ||
| converter_cls=converter_cls or Converter, | ||
| llm=llm, | ||
| text=result, | ||
| model=model, | ||
|
|
||


Uh oh!
There was an error while loading. Please reload this page.