crewAIInc / crewAI

Framework for orchestrating role-playing, autonomous AI agents. By fostering collaborative intelligence, CrewAI empowers agents to work together seamlessly, tackling complex tasks.
https://crewai.com
MIT License
21.19k stars 2.94k forks source link

how to make v.0.14.3. suppor Mistral AI API ? #278

Closed Adamchanadam closed 2 months ago

Adamchanadam commented 8 months ago

My crew was supported by Mistral AI API before at v0.55. However it doesn't work in v.0.14.3. Is there anything I missed ? thank you.

my snippet code :

from langchain_mistralai.chat_models import ChatMistralAI

mistral_api_key = os.environ.get("MISTRAL_API_KEY")
mistral_client = ChatMistralAI(api_key=mistral_api_key, model="mistral-small-latest" , temperature=0.8,top_p=0.1 , max_retries=3 , max_tokens=8191) #

from langchain_community.tools import DuckDuckGoSearchRun
search_tool = DuckDuckGoSearchRun()

researcher = Agent(
  role='Researcher',
  goal="Conduct quick internet research on a user-defined topic. Provide a report that includes all key findings, date of the information, and sources.",
  backstory="""You are an AI researcher base on trusted source and fact.""",
  verbose=True,
  allow_delegation=False,
  tools=[search_tool],
  llm=mistral_client

)

Entering new CrewAgentExecutor chain... 2024-02-27 11:50:28,171 - 15564 - chat_models.py-chat_models:293 - WARNING: Parameter stop not yet supported (https://docs.mistral.ai/api) 2024-02-27 11:50:36,996 - 15564 - chat_models.py-chat_models:293 - WARNING: Parameter stop not yet supported (https://docs.mistral.ai/api) 2024-02-27 11:50:43,493 - 15564 - chat_models.py-chat_models:293 - WARNING: Parameter stop not yet supported (https://docs.mistral.ai/api) 2024-02-27 11:50:52,336 - 15564 - chat_models.py-chat_models:293 - WARNING: Parameter stop not yet supported (https://docs.mistral.ai/api) I tried to use a tool and give a final answer at the same time, I must choose only one.I tried to use a tool and give a final answer at the same time, I must choose only one.I tried to use a tool and give a final answer at the same time, I must choose only one.

Christian24 commented 8 months ago

It works for me 0.19.0. Just takes a little bit of time. Also the warnings are actually in Langchain's Mistral adapter, so nothing to be done about them. However, it works for me.

Adamchanadam commented 8 months ago

i tried to use my code for mistral api on 0.19.0 , the previous warning "WARNING: Parameter stop not yet supported (https://docs.mistral.ai/api)" was gone , however , it show : [DEBUG]: [Researcher] Task output: Agent stopped due to iteration limit or time limit.

stilling figuring out the solution.....

annamarchenkova commented 6 months ago

have the same issue with "Parameter stop not yet supported" warning even with crewai 0.19.0

github-actions[bot] commented 2 months ago

This issue is stale because it has been open for 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

github-actions[bot] commented 2 months ago

This issue was closed because it has been stalled for 5 days with no activity.