Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

No validation or parsing on pydantic v2 #268

Closed
Brandl opened this issue Mar 1, 2024 · 0 comments
Closed

No validation or parsing on pydantic v2 #268

Brandl opened this issue Mar 1, 2024 · 0 comments

Comments

@Brandl
Copy link

Brandl commented Mar 1, 2024

I have touched on this in #228, though this might be an entirely unrelated issue:

I wrote a short progam, but there are neither errors nor parsed entities in the output, so I needed to do parsing myself:

class EntityExtraction(BaseModel):
    name: Optional[List[str]] = Field(
        default=None,
        description="names (e.g., 'Luke Skywalker', 'Obi-Wan Kenobi')."
    )
    location: Optional[List[str]] = Field(
        default=None,
        description="Location (e.g., 'Death Star', 'Coruscant')."
    )

schema, validator = from_pydantic(EntityExtraction)
chain = create_extraction_chain(llm, schema, encoder_or_encoder_class="json", validator=validator)
json_encoder = JSONEncoder(use_tags=True)
result = chain.invoke(text_input.text)
return json_encoder.decode(result['text']['raw'])

Is this a bug, or am I missing something obvious here?

Repository owner locked and limited conversation to collaborators Mar 14, 2024
@eyurtsev eyurtsev converted this issue into discussion #270 Mar 14, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant