Skip to content
Discussion options

You must be logged in to vote

Hello @mophilly!

This is the LLM being creative. You can force it by given examples:

description="The decimal interest of the owner in the transaction, column name: 'Owner Interest' position: 7. Always return normal decimal and NEVER Scientific Notation")

you can also implement a validator for this, if you want an extra layer of security

class InvoiceLine(BaseModel):
    description: str
    quantity: int
    unit_price: float
    amount: float

    @field_validator('quantity', mode='before')
    def convert_quantity_to_int(cls, v):
        if isinstance(v, float):
            return int(v)
        return v

Change the validator at will

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by mophilly
Comment options

mophilly
Dec 21, 2024
Collaborator Author

You must be logged in to vote
1 reply
@enoch3712
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants