Skip to content

Commit e15914b

Browse files
authored
fix: response format in run context badly set #236
2 parents 595da24 + b706d55 commit e15914b

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/mistralai/extra/run/context.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
FunctionTool,
3131
MessageInputEntry,
3232
InputEntries,
33-
ResponseFormatTypedDict,
3433
)
3534

3635
from logging import getLogger
@@ -229,9 +228,8 @@ async def prepare_model_request(
229228
elif isinstance(completion_args, CompletionArgs) and self.output_format:
230229
completion_args.response_format = self.response_format
231230
elif isinstance(completion_args, dict) and self.output_format:
232-
completion_args["response_format"] = typing.cast(
233-
ResponseFormatTypedDict, self.response_format.model_dump()
234-
)
231+
completion_args = CompletionArgs.model_validate(completion_args)
232+
completion_args.response_format = self.response_format
235233
request_tools = []
236234
if isinstance(tools, list):
237235
for tool in tools:

0 commit comments

Comments
 (0)