Skip to content

Commit c596fff

Browse files
fix: update extra module for new speakeasy type generation
- Remove `type=` parameter from FunctionTool constructor (now a constant) - Use isinstance() check instead of .type attribute access - Add proper type annotation for updated_tools list
1 parent b6d8665 commit c596fff

File tree

4 files changed

+5
-7
lines changed

4 files changed

+5
-7
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "mistralai"
3-
version = "2.0.0a1"
3+
version = "2.0.0a2"
44
description = "Python Client SDK for the Mistral AI API."
55
authors = [{ name = "Mistral" }]
66
requires-python = ">=3.10"

src/mistralai/extra/mcp/base.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ async def get_tools(self) -> list[FunctionTool]:
8484
for mcp_tool in mcp_tools.tools:
8585
tools.append(
8686
FunctionTool(
87-
type="function",
8887
function=Function(
8988
name=mcp_tool.name,
9089
description=mcp_tool.description,

src/mistralai/extra/run/context.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
create_tool_call,
2323
)
2424
from mistralai.client.models import (
25+
AgentTool,
2526
CompletionArgs,
2627
CompletionArgsTypedDict,
2728
ConversationInputs,
@@ -186,10 +187,9 @@ async def prepare_agent_request(self, beta_client: "Beta") -> AgentRequestKwargs
186187
)
187188
agent = await beta_client.agents.get_async(agent_id=self.agent_id)
188189
agent_tools = agent.tools or []
189-
updated_tools = []
190-
for i in range(len(agent_tools)):
191-
tool = agent_tools[i]
192-
if tool.type != "function":
190+
updated_tools: list[AgentTool] = []
191+
for tool in agent_tools:
192+
if not isinstance(tool, FunctionTool):
193193
updated_tools.append(tool)
194194
elif tool.function.name in self._callable_tools:
195195
# function already exists in the agent, don't add it again

src/mistralai/extra/run/tools.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,6 @@ def create_tool_call(func: Callable) -> FunctionTool:
168168
type_hints = get_type_hints(func, include_extras=True, localns=None, globalns=None)
169169

170170
return FunctionTool(
171-
type="function",
172171
function=Function(
173172
name=name,
174173
description=_get_function_description(docstring_sections),

0 commit comments

Comments
 (0)