Errors on search_knowlede_base() with Ollama

I am trying this example with Ollama and llama3.2:1b LLM, and I am getting the error:

(aienv) drasko@Mando:~/ai/vector$ python agent.py 
INFO     Dropping collection                                                                                                                                                                                       
INFO     Table 'ai.recipes' dropped successfully.                                                                                                                                                                  
INFO     Creating collection                                                                                                                                                                                       
INFO     Loading knowledge base                                                                                                                                                                                    
INFO     Reading: https://phi-public.s3.amazonaws.com/recipes/ThaiRecipes.pdf                                                                                                                                      
INFO     Inserted batch of 14 documents.                                                                                                                                                                           
INFO     Added 14 documents to knowledge base                                                                                                                                                                      
WARNING  Could not run function search_knowledge_base(properties={'query': {'description': '', 'type': 'string'}}, required=['query'], type=object)                                                                
ERROR    4 validation errors for Agent.search_knowledge_base                                                                                                                                                       
         query                                                                                                                                                                                                     
           Missing required argument [type=missing_argument, input_value=ArgsKwargs((), {'properti...ry'], 'type': 'object'}), input_type=ArgsKwargs]                                                              
             For further information visit https://errors.pydantic.dev/2.10/v/missing_argument                                                                                                                     
         properties                                                                                                                                                                                                
           Unexpected keyword argument [type=unexpected_keyword_argument, input_value={'query': {'description': '', 'type': 'string'}}, input_type=dict]                                                           
             For further information visit https://errors.pydantic.dev/2.10/v/unexpected_keyword_argument                                                                                                          
         required                                                                                                                                                                                                  
           Unexpected keyword argument [type=unexpected_keyword_argument, input_value=['query'], input_type=list]                                                                                                  
             For further information visit https://errors.pydantic.dev/2.10/v/unexpected_keyword_argument                                                                                                          
         type                                                                                                                                                                                                      
           Unexpected keyword argument [type=unexpected_keyword_argument, input_value='object', input_type=str]                                                                                                    
             For further information visit https://errors.pydantic.dev/2.10/v/unexpected_keyword_argument                                                                                                          
         Traceback (most recent call last):                                                                                                                                                                        
           File "/home/drasko/.venvs/aienv/lib/python3.12/site-packages/phi/tools/function.py", line 313, in execute                                                                                               
             self.result = self.function.entrypoint(**entrypoint_args, **self.arguments)                                                                                                                           
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                                                           
           File "/home/drasko/.venvs/aienv/lib/python3.12/site-packages/pydantic/_internal/_validate_call.py", line 38, in wrapper_function                                                                        
             return wrapper(*args, **kwargs)                                                                                                                                                                       
                    ^^^^^^^^^^^^^^^^^^^^^^^^                                                                                                                                                                       
           File "/home/drasko/.venvs/aienv/lib/python3.12/site-packages/pydantic/_internal/_validate_call.py", line 111, in __call__                                                                               
             res = self.__pydantic_validator__.validate_python(pydantic_core.ArgsKwargs(args, kwargs))                                                                                                             
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                                             
         pydantic_core._pydantic_core.ValidationError: 4 validation errors for Agent.search_knowledge_base                                                                                                         
         query                                                                                                                                                                                                     
           Missing required argument [type=missing_argument, input_value=ArgsKwargs((), {'properti...ry'], 'type': 'object'}), input_type=ArgsKwargs]                                                              
             For further information visit https://errors.pydantic.dev/2.10/v/missing_argument                                                                                                                     
         properties                                                                                                                                                                                                
           Unexpected keyword argument [type=unexpected_keyword_argument, input_value={'query': {'description': '', 'type': 'string'}}, input_type=dict]                                                           
             For further information visit https://errors.pydantic.dev/2.10/v/unexpected_keyword_argument                                                                                                          
         required                                                                                                                                                                                                  
           Unexpected keyword argument [type=unexpected_keyword_argument, input_value=['query'], input_type=list]                                                                                                  
             For further information visit https://errors.pydantic.dev/2.10/v/unexpected_keyword_argument                                                                                                          
         type                                                                                                                                                                                                      
           Unexpected keyword argument [type=unexpected_keyword_argument, input_value='object', input_type=str]                                                                                                    
             For further information visit https://errors.pydantic.dev/2.10/v/unexpected_keyword_argument 
1 Like

Hey @drasko, I couldn’t replicate the error on my end. Can you help me with the steps that you followed to run the cookbook?

Please note that it is a very small model and will struggle with tool calling. I would suggest you to try llama3.2:8b model