katanaml / sparrow

Data processing with ML, LLM and Vision LLM
https://katanaml.io
GNU General Public License v3.0
3.61k stars 373 forks source link

How to remove validation errors or bypass it to always show result of the values that are found i.e if it didn't find the value for any input it will bypass it and print all the rest response,. #53

Closed pitbuk101 closed 5 months ago

pitbuk101 commented 5 months ago

Caught an exception: 4 validation errors for DynamicModel eway_bill_no Input should be a valid integer [type=int_type, input_value=None, input_type=NoneType] For further information visit https://errors.pydantic.dev/2.7/v/int_type id_number Input should be a valid string [type=string_type, input_value=None, input_type=NoneType] For further information visit https://errors.pydantic.dev/2.7/v/string_type id_receiver Input should be a valid string [type=string_type, input_value=None, input_type=NoneType] For further information visit https://errors.pydantic.dev/2.7/v/string_type id_issuer Input should be a valid string [type=string_type, input_value=None, input_type=NoneType] For further information visit https://errors.pydantic.dev/2.7/v/string_type

abaranovskis-redsamurai commented 5 months ago

Which Sparrow agent you are using?

pitbuk101 commented 5 months ago

Sir I'm using vprocessor.

abaranovskis-redsamurai commented 5 months ago

You should remove output_cls and test, this is where validation logic is enforced:

program = LLMTextCompletionProgram.from_defaults(
            output_cls=ResponseModel,
            prompt_template_str=prompt_template_str,
            llm=llm_ollama,
            verbose=True,
        )