@Max_Moura
Hey, The model I used is: deepseek_v3_0324. I changed the model to qwen2.5:32b and this problem still occurred. In addition, I switched the task to English and used llama3.3:70b as the model. Although there was no garbled problem, this error was still reported. Therefore, I guess this error is not caused by the garbled problem. Please help me check it out.
qwen2.5:32b error message
llama3.3:70b error message
Complete code in English
import os
from crewai import Agent
from crewai import Crew, Process
from crewai import Task
from crewai.tools import tool, BaseTool
from pydantic import BaseModel, Field
from typing import Type
import litellm
litellm.set_verbose=False
from crewai import LLM
#key = 'sk-xxxxx'
#llm = LLM(api_key=key, model="deepseek/deepseek-chat", base_url="https://api.deepseek.com")
llm = LLM(
model="ollama/llama3.3:70b",
base_url="http://xxxx:11434"
)
class B_search_input(BaseModel):
"""Input parameters of B_search_tool"""
query: str = Field(..., description="Retrieve the query of database poi")
lng: str = Field(..., description="Retrieve longitude")
lat: str = Field(..., description="Retrieve Latitude")
country_code: str = Field(..., description="Retrieve location")
class B_search_tool(BaseTool):
name: str = "Retrieve B data"
description: str = "Retrieve POI information related to the query from the B database"
args_schema: Type[BaseModel] = B_search_input
def _run(self, query: str, lng: str, lat: str, country_code: str) -> str:
return ['xxx']
class A_search_input(BaseModel):
"""Input parameters of A_search_tool"""
query: str = Field(..., description="Retrieve the query of database poi")
lng: str = Field(..., description="Retrieve longitude")
lat: str = Field(..., description="Retrieve Latitude")
country_code: str = Field(..., description="Retrieve location")
class A_search_tool(BaseTool):
name: str = "Retrieve A data"
description: str = "Retrieve POI information related to query from the A database"
args_schema: Type[BaseModel] = A_search_input
def _run(self, query: str, lng: str, lat: str, country_code: str) -> str:
return ['xxx']
correlation_analysis_agent = Agent(
role='correlation_analysis_assistant',
goal='Find out the set of unrelated queries between user search queries: {search_querys} and click pois: {click_pois}.',
backstory="You are an expert in the field of POI search, good at analyzing users' search intent and determining the correlation between users' search queries and clicked POIs.",
llm=llm,
# verbose=True,
# allow_delegation=False
)
A_check_agent = Agent(
role='A_data_verification_assistant',
goal='According to the irrelevant query set provided by the correlation analysis assistant, search for POI from the A retrieval interface, verify whether there is POI matching the irrelevant query in the A database, and find out the missing query set.',
backstory="You are an expert in the field of POI search and are good at analyzing the correlation between query and POI.",
tools=[A_search_tool()],
llm=llm,
# verbose=True,
# allow_delegation=False
)
B_check_agent = Agent(
role='B_data_verification_assistant',
goal='According to the missing query set provided by the A data verification assistant, search for POI from the B retrieval interface, verify whether there is a POI matching the missing query in the B database, and find out the missing POI data in the A database to be verified.',
backstory="You are an expert in POI search, good at analyzing the correlation between query and POI, and finding the POI most relevant to the query from the POI list.",
tools=[B_search_tool()],
llm=llm,
# verbose=True,
# allow_delegation=False
)
A_check_again_agent = Agent(
role='A_data_secondary_verification_assistant',
goal='According to the missing POI data in the A database to be verified provided by the B data verification assistant, search for POI from the A retrieval interface to verify whether the mined missing POI data exists in the A database.',
backstory="You are an expert in the field of POI data, good at analyzing the correlation between POIs and finding the POIs that are most relevant to the missing POIs from the POI list.",
tools=[A_search_tool()],
llm=llm,
# verbose=True,
# allow_delegation=False
)
miss_mining_agent = Agent(
role='missing_mining_assistant',
goal='Based on user search query: {search_querys} and click POI: {click_pois}, direct team members to find the missing POI data in the A database.',
backstory="""You are an experienced manager of POI data missing mining tasks, good at managing complex employees with different skills.
Your team has the following four members: correlation_analysis_assistant, A_data_verification_assistant, B_data_verification_assistant, A_data_secondary_verification_assistant.
The workflow to complete this task is: from correlation_analysis_assistant, to A_data_verification_assistant, to B_data_verification_assistant, and finally to A_data_secondary_verification_assistant.
Your main job is to coordinate the work of each member, and decide whether other members work based on the feedback results of each member, and finally you give a satisfactory task processing result""",
llm=llm,
verbose=True,
allow_delegation=True
)
correlation_analysis_task = Task(
description="""### Task objective\nFind out irrelevant query sets\n\n### Execution method\nBased on the query list searched by the user: {search_querys} and the list of POIs clicked: {click_pois}, analyze the correlation between each query searched by the user and all clicked POIs, and find out irrelevant queries.\n\n### Note:\n1. The query searched by the user may have typos or the expression may not be completely consistent with the POI name, etc., and it is judged as relevant;\n2. If the query searched by the user partially matches the clicked POI, it is judged as relevant;\n3. If the house number is inconsistent, it is judged as irrelevant, for example, 'No. 18, xxx Road is irrelevant to xxx Road'.""",
expected_output="""Your response consists of two parts: your thought process and your final answer.
The thinking process is wrapped in <thinking></thinking>.
The final answer is output in the following format: unrelated query set: [{'query':'xxx', 'lng':'xxx', 'lat':'xxx', 'country_code':'xxx'}], and wrapped in <answer></answer>.""",
agent=correlation_analysis_agent
)
A_check_task = Task(
description="### Task objective\nFind out the missing query set\n\n### Execution method\nFor each irrelevant query, use the A search interface to search for POI and verify whether there is a POI matching the irrelevant query in the A database. If not, it is a missing query.",
expected_output="""Your response consists of two parts: your thought process and your final answer.
The thinking process is wrapped in <thinking></thinking>.
The final answer is output in the following format: missing query set: [{'query':'xxx', 'lng':'xxx', 'lat':'xxx', 'country_code':'xxx'}], and wrapped with <answer></answer>.""",
agent=A_check_agent
)
B_check_task = Task(
description="### Task objective\nFind out the missing POI set in the A database to be verified\n\n### Execution method\nFor each missing query, search for POI from the B retrieval interface, verify whether there is a POI matching the missing query in the B database, and find out the missing POI data in the A database to be verified.",
expected_output="""Your response consists of two parts: your thought process and your final answer.
The thinking process is wrapped in <thinking></thinking>.
The final answer is output in the following format: missing POI data in the A database to be verified: {'query':'xxx', 'missing POI information to be verified':{'poi_name':'xxx', 'lng':'xxx', 'lat':'xxx', 'country_code':'xxx'}}, and wrapped in <answer></answer>.""",
agent=B_check_agent
)
A_check_again_task = Task(
description="### Task objective\nFind out the missing POI set\n\n### Execution method\nFor each missing POI to be verified, search for POI from the A retrieval interface, verify whether the mined missing POI data already exists in the A database, and find out the real missing POI data.",
expected_output="""Your response consists of two parts: your thought process and your final answer.
The thinking process is wrapped in <thinking></thinking>.
The final answer is output in the following format: missing poi data in A database: {{'query':'xxx', 'missing poi information':{{'poi_name':'xxx', 'lng':'xxx', 'lat':'xxx'}}}}, and wrapped in <answer></answer>.""",
agent=A_check_again_agent
)
miss_mining_crew = Crew(
agents=[correlation_analysis_agent, A_check_agent, B_check_agent, A_check_again_agent],
tasks=[correlation_analysis_task, A_check_task, B_check_task, A_check_again_task],
process=Process.hierarchical,
# process=Process.sequential,
# manager_llm=[llm],
output_log_file=False,
manager_agent=miss_mining_agent
)
user_input = {'search_querys':[{"query": "cultural 512", "lng": "-51.22509179999991", "lat": "-30.04127166", "country_code": "BR"}],
'click_pois': [{'poi_name': 'Espaço Cultural 512', 'poi_lng': '-51.22509179999991', 'poi_lat': '-30.04127166', 'country_code': 'BR'}]}
result = miss_mining_crew.kickoff(inputs=user_input)