You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I use newest versions: phidata 2.7.3
crawl4ai 0.4.23
ollama 0.4.4
crawl4ai example code works with
model=OpenAIChat(id="gpt-4o-mini"),
but not with:
model=Ollama(id="llama3.2:latest", host = ollama_base_url),
The full code used:
from phi.agent import Agent
from phi.model.ollama import Ollama
from phi.tools.crawl4ai_tools import Crawl4aiTools
import os
from dotenv import load_dotenv
load_dotenv()
ollama_base_url = os.getenv("OLLAMA_BASE_URL")
agent = Agent(
model=Ollama(id="llama3.2:latest", host = ollama_base_url),
tools=[Crawl4aiTools(max_length="1000")],
show_tool_calls=True
)
agent.print_response("Summarize me the key points in bullet points of this: https://blog.google/products/gemini/google-gemini-deep-research/", stream=True)
I got error:
(phidata-venv) PS D:\Projects\AI_testing\phidata> python .\crawl4ai_tool_ollama.py
▰▰▰▰▰▰▱ Thinking...
┏━ Message ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓┃ ┃┃ Summarize me the key points in bullet points of this: https://blog.google/products/gemini/google-gemini-deep-research/ ┃┃ ┃┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛Traceback (most recent call last):
File "D:\Projects\AI_testing\phidata\crawl4ai_tool_ollama.py", line 16, in <module>
agent.print_response("Summarize me the key points in bullet points of this: https://blog.google/products/gemini/google-gemini-deep-research/", stream=True)
File "D:\Projects\AI_testing\phidata\phidata-venv\Lib\site-packages\phi\agent\agent.py", line 2783, in print_response
for resp in self.run(message=message, messages=messages, stream=True, **kwargs):
File "D:\Projects\AI_testing\phidata\phidata-venv\Lib\site-packages\phi\agent\agent.py", line 1794, in _run
for model_response_chunk in self.model.response_stream(messages=messages_for_model):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Projects\AI_testing\phidata\phidata-venv\Lib\site-packages\phi\model\ollama\chat.py", line 597, in response_stream
for response in self.invoke_stream(messages=messages):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Projects\AI_testing\phidata\phidata-venv\Lib\site-packages\phi\model\ollama\chat.py", line 236, in invoke_stream
yield from self.get_client().chat(
File "D:\Projects\AI_testing\phidata\phidata-venv\Lib\site-packages\ollama\_client.py", line 339, in chat
tools=[tool for tool in _copy_tools(tools)],
^^^^^^^^^^^^^^^^^^
File "D:\Projects\AI_testing\phidata\phidata-venv\Lib\site-packages\ollama\_client.py", line 1133, in _copy_tools
yield convert_function_to_tool(unprocessed_tool) if callable(unprocessed_tool) else Tool.model_validate(unprocessed_tool)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Projects\AI_testing\phidata\phidata-venv\Lib\site-packages\pydantic\main.py", line 627, in model_validate
return cls.__pydantic_validator__.validate_python(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pydantic_core._pydantic_core.ValidationError: 1 validation error for Tool
function.parameters.properties.max_length.type
Input should be a valid string [type=string_type, input_value=['number', 'null'], input_type=list]
For further information visit https://errors.pydantic.dev/2.10/v/string_type
Note I used 3.5-sonnet in Cursor for debugging and I tried to set
max_length to default None, 1000 and "1000"
in "Crawl4aiTools(max_length="1000")"
but none ot them worked, had the same error...
The text was updated successfully, but these errors were encountered:
I use newest versions:
phidata 2.7.3
crawl4ai 0.4.23
ollama 0.4.4
crawl4ai example code works with
model=OpenAIChat(id="gpt-4o-mini"),
but not with:
model=Ollama(id="llama3.2:latest", host = ollama_base_url),
The full code used:
I got error:
Note I used 3.5-sonnet in Cursor for debugging and I tried to set
max_length to default None, 1000 and "1000"
in "Crawl4aiTools(max_length="1000")"
but none ot them worked, had the same error...
The text was updated successfully, but these errors were encountered: