Repository navigation
feat(adapter): support nested XML data - #10237
Closed
isaacbmiller wants to merge 6 commits into
Closed
isaacbmiller wants to merge 6 commits into
isaacbmiller wants to merge 6 commits into
Conversation
Amp-Thread-ID: https://ampcode.com/threads/T-01a0155d-044b-7195-9585-9f88207c87c6 Co-authored-by: Isaac Miller <isaac@cmpnd.ai>
Amp-Thread-ID: https://ampcode.com/threads/T-01a0155d-044b-7195-9585-9f88207c87c6 Co-authored-by: Isaac Miller <isaac@cmpnd.ai>
Contributor
Greptile SummaryThis change adds XML rendering and parsing for nested Pydantic models, TypedDicts, dictionaries, and repeated lists. It also bounds recursive model schema rendering, preserves JSON-in-XML compatibility, and documents the nested XML response format. Confidence Score: 5/5No blocking failure remains. No accepted blocking findings remain after exercising nested TypedDict, recursive Pydantic, XML escaping, and parse round-trip behavior.
What T-Rex did
Reviews (5): Last reviewed commit: "refactor(adapter): unify XML schema hand..." | Re-trigger Greptile |
Amp-Thread-ID: https://ampcode.com/threads/T-01a0155d-044b-7195-9585-9f88207c87c6 Co-authored-by: Isaac Miller <isaac@cmpnd.ai>
Amp-Thread-ID: https://ampcode.com/threads/T-01a0155d-044b-7195-9585-9f88207c87c6 Co-authored-by: Isaac Miller <isaac@cmpnd.ai>
Amp-Thread-ID: https://ampcode.com/threads/T-01a0155d-044b-7195-9585-9f88207c87c6 Co-authored-by: Isaac Miller <isaac@cmpnd.ai>
Amp-Thread-ID: https://ampcode.com/threads/T-01a0155d-044b-7195-9585-9f88207c87c6 Co-authored-by: Isaac Miller <isaac@cmpnd.ai>
Collaborator
Author
|
superseded by #10239. |
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.
Closes #8481.
Closes #10102.
Supersedes #8482 with an implementation based on current
main.Summary
AdapterParseErrorinstead of silently truncating valuesWhat the final prompt looks like
Given a
Personoutput containing a nestedAddressandlist[str]interests, the LM receives this schema in both the system instructions and final user request:The final user message looks like:
A matching response is parsed directly into the declared Pydantic types:
The XMLAdapter documentation includes the runnable example, complete system and user prompt, matching response, and parsed result types.
Testing
pytest -q tests/adapters/test_xml_adapter.py(24 passed)pytest -q tests/adapters(278 passed)ruff check dspy/adapters/xml_adapter.pyruff format --check dspy/adapters/xml_adapter.pygit diff --check