Skip to content
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

Tags Builder #534

Open
wants to merge 19 commits into
base: main
Choose a base branch
from
Open

Tags Builder #534

wants to merge 19 commits into from

Conversation

mszenfeld
Copy link

@mszenfeld mszenfeld commented Dec 23, 2024

I've created the logic for building XML-like tags. The original issue mentions only examples, but my version allows for the creation of any tag.

Closes #93

- Implement TagBuilder abstract class with a method to format content
- Add XMLTagBuilder class that inherits from TagBuilder
- Define format_tag function to build tags using specified dialect
- Include initial test for content formatting with DummyTagBuilder
- Removed Content type alias and replaced with Any
- Updated format_tag function to accept Any type for content
- Simplified _normalize_type function to handle Any type
- Adjusted TagBuilder and XMLTagBuilder to work with Any type
- Added complex content formatting tests in test_prompt.py
@mszenfeld mszenfeld marked this pull request as draft December 23, 2024 11:21
@mszenfeld mszenfeld changed the title #93 Tags Builder Tags Builder Dec 23, 2024
@mszenfeld mszenfeld marked this pull request as ready for review December 23, 2024 11:49
Copy link
Member

@samuelcolvin samuelcolvin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there's also #515 which is trying to solve the same problem and also needs lots more work. I think since #515 was started first, I'd prefer to use that if possible.

pydantic_ai_slim/pydantic_ai/prompt.py Outdated Show resolved Hide resolved
pydantic_ai_slim/pydantic_ai/prompt.py Outdated Show resolved Hide resolved
pydantic_ai_slim/pydantic_ai/prompt.py Outdated Show resolved Hide resolved
pydantic_ai_slim/pydantic_ai/prompt.py Outdated Show resolved Hide resolved
pydantic_ai_slim/pydantic_ai/prompt.py Outdated Show resolved Hide resolved
pydantic_ai_slim/pydantic_ai/prompt.py Outdated Show resolved Hide resolved
pydantic_ai_slim/pydantic_ai/prompt.py Outdated Show resolved Hide resolved
@samuelcolvin samuelcolvin marked this pull request as draft December 23, 2024 16:46
@mszenfeld
Copy link
Author

mszenfeld commented Dec 24, 2024

@samuelcolvin I should have checked if a similar PR already exists, but I've modified my PR just in case.

If you'd rather use #515 , go ahead and close this one.

@mszenfeld mszenfeld marked this pull request as ready for review December 24, 2024 10:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Examples builder
2 participants