diff --git a/cookbook/models/mistral/mistral_small.py b/cookbook/models/mistral/mistral_small.py new file mode 100644 index 0000000000..87bf1ee19a --- /dev/null +++ b/cookbook/models/mistral/mistral_small.py @@ -0,0 +1,13 @@ +"""Run `pip install duckduckgo-search` to install dependencies.""" + +from agno.agent import Agent +from agno.models.mistral import MistralChat +from agno.tools.duckduckgo import DuckDuckGoTools + +agent = Agent( + model=MistralChat(id="mistral-small-latest"), + tools=[DuckDuckGoTools()], + show_tool_calls=True, + markdown=True, +) +agent.print_response("Whats happening in France?", stream=True) diff --git a/cookbook/models/mistral/tool_use.py b/cookbook/models/mistral/tool_use.py index 7cffbea6b6..364e2f4091 100644 --- a/cookbook/models/mistral/tool_use.py +++ b/cookbook/models/mistral/tool_use.py @@ -1,7 +1,5 @@ """Run `pip install duckduckgo-search` to install dependencies.""" -import os - from agno.agent import Agent from agno.models.mistral import MistralChat from agno.tools.duckduckgo import DuckDuckGoTools diff --git a/libs/agno/agno/models/mistral/mistral.py b/libs/agno/agno/models/mistral/mistral.py index c581e7d5ef..660ff60466 100644 --- a/libs/agno/agno/models/mistral/mistral.py +++ b/libs/agno/agno/models/mistral/mistral.py @@ -96,7 +96,8 @@ def client(self) -> MistralClient: _client_params["timeout"] = self.timeout if self.client_params: _client_params.update(self.client_params) - return MistralClient(**_client_params) + self.mistral_client = MistralClient(**_client_params) + return self.mistral_client @property def api_kwargs(self) -> Dict[str, Any]: @@ -181,10 +182,9 @@ def invoke(self, messages: List[Message]) -> ChatCompletionResponse: ChatCompletionResponse: The response from the model. """ mistral_messages = self._prepare_messages(messages) - logger.debug(f"Mistral messages: {mistral_messages}") response = self.client.chat.complete( - messages=mistral_messages, model=self.id, + messages=mistral_messages, **self.api_kwargs, ) if response is None: @@ -202,10 +202,9 @@ def invoke_stream(self, messages: List[Message]) -> Iterator[Any]: Iterator[Any]: The streamed response. """ mistral_messages = self._prepare_messages(messages) - logger.debug(f"Mistral messages sending to stream endpoint: {mistral_messages}") response = self.client.chat.stream( - messages=mistral_messages, model=self.id, + messages=mistral_messages, **self.api_kwargs, ) if response is None: @@ -358,7 +357,7 @@ def response(self, messages: List[Message]) -> ModelResponse: assistant_message.log() # -*- Parse and run tool calls - logger.debug(f"Functions: {self._functions}") + # logger.debug(f"Functions: {self._functions}") # -*- Handle tool calls if self._handle_tool_calls(assistant_message, messages, model_response): diff --git a/libs/agno/agno/playground/settings.py b/libs/agno/agno/playground/settings.py index bd9f5a4c9f..9fb0d2842a 100644 --- a/libs/agno/agno/playground/settings.py +++ b/libs/agno/agno/playground/settings.py @@ -44,7 +44,7 @@ def set_cors_origin_list(cls, cors_origin_list): "https://agno.com", "https://www.agno.com", "https://app.agno.com", - "https://app-stg.agno.com" + "https://app-stg.agno.com", ] )