Closed setegonz closed 1 week ago
The error was resolved by improving the class structure as follows:
from pydantic import BaseModel, Field
class SectionEvaluation(BaseModel):
score: int = Field(ge=1, le=5)
rationale: str
class EvaluationResult(BaseModel):
about_the_organization: SectionEvaluation
project_overview: SectionEvaluation
scope_of_work: SectionEvaluation
deliverables: SectionEvaluation
proposal_format: SectionEvaluation
rfp_issuer_scoring_method: SectionEvaluation
What Model are you using?
Describe the bug I'm defining a Pydantic class to structure the output of LLM evaluation. When the function asks for integers only, it works perfectly. However, when asking for an explanation string along with the integer, the function throws an error. I only see the error when looking at the traces in LangSmith.
To Reproduce The following code works without errors:
But this code throws an error:
Expected behavior I expected a structured output with an integer rating and a string explanation without errors.
Screenshots Taken from Langsmith tracing