from crewai_tools import WeaviateVectorSearchTool
from crewai import Agent, LLM, Crew, Task
llm = LLM(
model=“deepseek/deepseek-chat”,
)
weaviate_tool = WeaviateVectorSearchTool(
collection_name=‘Question’,
limit=3,
vectorizer=“text2vec-ollama”,
generative_model=“llama3.2”,
weaviate_cluster_url=“http://localhost:8080”,
weaviate_api_key=“your-secret-key”,
)
rag_agent = Agent(
role=“You are a helpful assistant that can answer questions:{question} with the help of the WeaviateVectorSearchTool.”,
goal=“Answer questions with the help of the WeaviateVectorSearchTool.”,
backstory="You are an AI assistant that can answer questions with the help of the WeaviateVectorSearchTool. "
"You can provide information on a wide range of topics and answer questions based on the information "
"stored in the Weaviate database. "
"You can provide information on a wide range of topics and answer questions based on the information "
"stored in the Weaviate database. ",
llm=llm,
tools=[weaviate_tool],
)
task = Task(
name=“Answer a question with the help of the WeaviateVectorSearchTool”,
description=“Answer a question with the help of the WeaviateVectorSearchTool”,
expected_output=“Answer to the question”,
agent=rag_agent,
)
crew = Crew(
agents=[rag_agent],
tasks=[task],
verbose=True
)
result = crew.kickoff(inputs={“question”: “This organ removes excess glucose from the blood & stores it as glycogen?”})
print(result)
Agent: You are a helpful assistant that can answer questions:This organ removes excess glucose from the blood & stores it as glycogen? with the help of the WeaviateVectorSearchTool.
Thought: Thought: I need to find information about the organ that removes excess glucose from the blood and stores it as glycogen. I will use the WeaviateVectorSearchTool to retrieve this information.
Using tool: WeaviateVectorSearchTool
Tool Input:
“{"query": "organ removes excess glucose from the blood stores it as glycogen"}”
Tool Output:
I encountered an error while trying to use the tool. This was the error: Invalid port: ‘8080:443’.
The url I specified for the database service is http,but during running, the system automatically changes to https.