Skip to content

Commit 9ee3a60

Browse files
committed
Cache mistral models
1 parent 8ec1a33 commit 9ee3a60

File tree

4 files changed

+19
-9
lines changed

4 files changed

+19
-9
lines changed
+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
"""Run `pip install duckduckgo-search` to install dependencies."""
2+
3+
from agno.agent import Agent
4+
from agno.models.mistral import MistralChat
5+
from agno.tools.duckduckgo import DuckDuckGoTools
6+
7+
agent = Agent(
8+
model=MistralChat(id="mistral-small-latest"),
9+
tools=[DuckDuckGoTools()],
10+
show_tool_calls=True,
11+
markdown=True,
12+
)
13+
agent.print_response("Whats happening in France?", stream=True)

cookbook/models/mistral/tool_use.py

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
"""Run `pip install duckduckgo-search` to install dependencies."""
22

3-
import os
4-
53
from agno.agent import Agent
64
from agno.models.mistral import MistralChat
75
from agno.tools.duckduckgo import DuckDuckGoTools

libs/agno/agno/models/mistral/mistral.py

+5-6
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,8 @@ def client(self) -> MistralClient:
9696
_client_params["timeout"] = self.timeout
9797
if self.client_params:
9898
_client_params.update(self.client_params)
99-
return MistralClient(**_client_params)
99+
self.mistral_client = MistralClient(**_client_params)
100+
return self.mistral_client
100101

101102
@property
102103
def api_kwargs(self) -> Dict[str, Any]:
@@ -181,10 +182,9 @@ def invoke(self, messages: List[Message]) -> ChatCompletionResponse:
181182
ChatCompletionResponse: The response from the model.
182183
"""
183184
mistral_messages = self._prepare_messages(messages)
184-
logger.debug(f"Mistral messages: {mistral_messages}")
185185
response = self.client.chat.complete(
186-
messages=mistral_messages,
187186
model=self.id,
187+
messages=mistral_messages,
188188
**self.api_kwargs,
189189
)
190190
if response is None:
@@ -202,10 +202,9 @@ def invoke_stream(self, messages: List[Message]) -> Iterator[Any]:
202202
Iterator[Any]: The streamed response.
203203
"""
204204
mistral_messages = self._prepare_messages(messages)
205-
logger.debug(f"Mistral messages sending to stream endpoint: {mistral_messages}")
206205
response = self.client.chat.stream(
207-
messages=mistral_messages,
208206
model=self.id,
207+
messages=mistral_messages,
209208
**self.api_kwargs,
210209
)
211210
if response is None:
@@ -358,7 +357,7 @@ def response(self, messages: List[Message]) -> ModelResponse:
358357
assistant_message.log()
359358

360359
# -*- Parse and run tool calls
361-
logger.debug(f"Functions: {self._functions}")
360+
# logger.debug(f"Functions: {self._functions}")
362361

363362
# -*- Handle tool calls
364363
if self._handle_tool_calls(assistant_message, messages, model_response):

libs/agno/agno/playground/settings.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def set_cors_origin_list(cls, cors_origin_list):
4444
"https://agno.com",
4545
"https://www.agno.com",
4646
"https://app.agno.com",
47-
"https://app-stg.agno.com"
47+
"https://app-stg.agno.com",
4848
]
4949
)
5050

0 commit comments

Comments
 (0)