# mirascope.core.mistral.call_response
This module contains the `MistralCallResponse` class.
<Info title="Usage">
[Calls](/docs/v1/learn/calls#handling-responses)
</Info>
## <ApiType type="Class" path="core/mistral/call_response" symbolName="MistralCallResponse" /> MistralCallResponse
A convenience wrapper around the Mistral `ChatCompletion` response.
When calling the Mistral API using a function decorated with `mistral_call`, the
response will be an `MistralCallResponse` instance with properties that allow for
more convenience access to commonly used attributes.
Example:
```python
from mirascope.core import prompt_template
from mirascope.core.mistral import mistral_call
@mistral_call("mistral-largel-latest")
def recommend_book(genre: str) -> str:
return f"Recommend a {genre} book"
response = recommend_book("fantasy") # response is an `MistralCallResponse` instance
print(response.content)
```
**Bases:**
<TypeLink type={{"type_str": "BaseCallResponse[ChatCompletionResponse, MistralTool, dict[str, Any], MistralDynamicConfig, AssistantMessage | SystemMessage | ToolMessage | UserMessage, MistralCallParams, UserMessage, MistralMessageParamConverter]", "description": null, "kind": "generic", "base_type": {"type_str": "BaseCallResponse", "description": null, "kind": "simple", "doc_url": "/docs/v1/api/core/base/call_response#basecallresponse"}, "parameters": [{"type_str": "ChatCompletionResponse", "description": null, "kind": "simple", "doc_identifier": "ChatCompletionResponse"}, {"type_str": "MistralTool", "description": null, "kind": "simple", "doc_url": "/docs/v1/api/core/mistral/tool#mistraltool"}, {"type_str": "dict[str, Any]", "description": null, "kind": "generic", "base_type": {"type_str": "dict", "description": null, "kind": "simple", "doc_url": "https://docs.python.org/3/library/stdtypes.html#dict"}, "parameters": [{"type_str": "str", "description": null, "kind": "simple", "doc_url": "https://docs.python.org/3/library/stdtypes.html#str"}, {"type_str": "Any", "description": null, "kind": "simple", "doc_url": "https://docs.python.org/3/library/typing.html#typing.Any"}]}, {"type_str": "MistralDynamicConfig", "description": null, "kind": "simple", "doc_url": "/docs/v1/api/core/mistral/dynamic_config#mistraldynamicconfig"}, {"type_str": "AssistantMessage | SystemMessage | ToolMessage | UserMessage", "description": null, "kind": "union", "base_type": {"type_str": "Union", "description": null, "kind": "simple", "doc_url": "https://docs.python.org/3/library/typing.html#typing.Union"}, "parameters": [{"type_str": "AssistantMessage", "description": null, "kind": "simple", "doc_identifier": "AssistantMessage"}, {"type_str": "SystemMessage", "description": null, "kind": "simple", "doc_identifier": "SystemMessage"}, {"type_str": "ToolMessage", "description": null, "kind": "simple", "doc_identifier": "ToolMessage"}, {"type_str": "UserMessage", "description": null, "kind": "simple", "doc_identifier": "UserMessage"}]}, {"type_str": "MistralCallParams", "description": null, "kind": "simple", "doc_url": "/docs/v1/api/core/mistral/call_params#mistralcallparams"}, {"type_str": "UserMessage", "description": null, "kind": "simple", "doc_identifier": "UserMessage"}, {"type_str": "MistralMessageParamConverter", "description": null, "kind": "simple", "doc_identifier": "MistralMessageParamConverter"}]}} />
<AttributesTable
attributes={[
{
"name": "content",
"type_info": {
"type_str": "str",
"description": null,
"kind": "simple",
"doc_url": "https://docs.python.org/3/library/stdtypes.html#str"
},
"description": "The content of the chat completion for the 0th choice."
},
{
"name": "finish_reasons",
"type_info": {
"type_str": "list[str]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "list",
"description": null,
"kind": "simple",
"doc_url": "https://docs.python.org/3/library/stdtypes.html#list"
},
"parameters": [
{
"type_str": "str",
"description": null,
"kind": "simple",
"doc_url": "https://docs.python.org/3/library/stdtypes.html#str"
}
]
},
"description": "Returns the finish reasons of the response."
},
{
"name": "model",
"type_info": {
"type_str": "str",
"description": null,
"kind": "simple",
"doc_url": "https://docs.python.org/3/library/stdtypes.html#str"
},
"description": "Returns the name of the response model."
},
{
"name": "id",
"type_info": {
"type_str": "str",
"description": null,
"kind": "simple",
"doc_url": "https://docs.python.org/3/library/stdtypes.html#str"
},
"description": "Returns the id of the response."
},
{
"name": "usage",
"type_info": {
"type_str": "UsageInfo",
"description": null,
"kind": "simple",
"doc_identifier": "UsageInfo"
},
"description": "Returns the usage of the chat completion."
},
{
"name": "input_tokens",
"type_info": {
"type_str": "int",
"description": null,
"kind": "simple",
"doc_url": "https://docs.python.org/3/library/functions.html#int"
},
"description": "Returns the number of input tokens."
},
{
"name": "cached_tokens",
"type_info": {
"type_str": "int",
"description": null,
"kind": "simple",
"doc_url": "https://docs.python.org/3/library/functions.html#int"
},
"description": "Returns the number of cached tokens."
},
{
"name": "output_tokens",
"type_info": {
"type_str": "int | None",
"description": null,
"kind": "union",
"base_type": {
"type_str": "Union",
"description": null,
"kind": "simple",
"doc_url": "https://docs.python.org/3/library/typing.html#typing.Union"
},
"parameters": [
{
"type_str": "int",
"description": null,
"kind": "simple",
"doc_url": "https://docs.python.org/3/library/functions.html#int"
},
{
"type_str": "None",
"description": null,
"kind": "simple",
"doc_url": "https://docs.python.org/3/library/constants.html#None"
}
]
},
"description": "Returns the number of output tokens."
},
{
"name": "message_param",
"type_info": {
"type_str": "AssistantMessage",
"description": null,
"kind": "simple",
"doc_identifier": "AssistantMessage"
},
"description": "Returns the assistants's response as a message parameter."
},
{
"name": "tools",
"type_info": {
"type_str": "list[MistralTool] | None",
"description": null,
"kind": "union",
"base_type": {
"type_str": "Union",
"description": null,
"kind": "simple",
"doc_url": "https://docs.python.org/3/library/typing.html#typing.Union"
},
"parameters": [
{
"type_str": "list[MistralTool]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "list",
"description": null,
"kind": "simple",
"doc_url": "https://docs.python.org/3/library/stdtypes.html#list"
},
"parameters": [
{
"type_str": "MistralTool",
"description": null,
"kind": "simple",
"doc_url": "/docs/v1/api/core/mistral/tool#mistraltool"
}
]
},
{
"type_str": "None",
"description": null,
"kind": "simple",
"doc_url": "https://docs.python.org/3/library/constants.html#None"
}
]
},
"description": "Returns the tools for the 0th choice message."
},
{
"name": "tool",
"type_info": {
"type_str": "MistralTool | None",
"description": null,
"kind": "union",
"base_type": {
"type_str": "Union",
"description": null,
"kind": "simple",
"doc_url": "https://docs.python.org/3/library/typing.html#typing.Union"
},
"parameters": [
{
"type_str": "MistralTool",
"description": null,
"kind": "simple",
"doc_url": "/docs/v1/api/core/mistral/tool#mistraltool"
},
{
"type_str": "None",
"description": null,
"kind": "simple",
"doc_url": "https://docs.python.org/3/library/constants.html#None"
}
]
},
"description": "Returns the 0th tool for the 0th choice message."
},
{
"name": "common_finish_reasons",
"type_info": {
"type_str": "list[FinishReason] | None",
"description": null,
"kind": "union",
"base_type": {
"type_str": "Union",
"description": null,
"kind": "simple",
"doc_url": "https://docs.python.org/3/library/typing.html#typing.Union"
},
"parameters": [
{
"type_str": "list[FinishReason]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "list",
"description": null,
"kind": "simple",
"doc_url": "https://docs.python.org/3/library/stdtypes.html#list"
},
"parameters": [
{
"type_str": "FinishReason",
"description": null,
"kind": "simple",
"doc_url": "/docs/v1/api/core/openai/call_response_chunk#finishreason"
}
]
},
{
"type_str": "None",
"description": null,
"kind": "simple",
"doc_url": "https://docs.python.org/3/library/constants.html#None"
}
]
}
},
{
"name": "common_message_param",
"type_info": {
"type_str": "BaseMessageParam",
"description": null,
"kind": "simple",
"doc_url": "/docs/v1/api/core/base/message_param#basemessageparam"
}
},
{
"name": "common_user_message_param",
"type_info": {
"type_str": "BaseMessageParam | None",
"description": null,
"kind": "union",
"base_type": {
"type_str": "Union",
"description": null,
"kind": "simple",
"doc_url": "https://docs.python.org/3/library/typing.html#typing.Union"
},
"parameters": [
{
"type_str": "BaseMessageParam",
"description": null,
"kind": "simple",
"doc_url": "/docs/v1/api/core/base/message_param#basemessageparam"
},
{
"type_str": "None",
"description": null,
"kind": "simple",
"doc_url": "https://docs.python.org/3/library/constants.html#None"
}
]
}
},
{
"name": "cost_metadata",
"type_info": {
"type_str": "CostMetadata",
"description": null,
"kind": "simple",
"doc_url": "/docs/v1/api/core/base/types#costmetadata"
},
"description": "Get metadata required for cost calculation."
}
]}
/>
## <ApiType type="Function" path="core/mistral/call_response" symbolName="tool_message_params" /> tool_message_params
Returns the tool message parameters for tool call results.
<ParametersTable
parameters={[
{
"name": "cls",
"type_info": {
"type_str": "Any",
"description": null,
"kind": "simple",
"doc_identifier": null
}
},
{
"name": "tools_and_outputs",
"type_info": {
"type_str": "Sequence[tuple[MistralTool, str]]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "Sequence",
"description": null,
"kind": "simple",
"doc_identifier": "Sequence"
},
"parameters": [
{
"type_str": "tuple[MistralTool, str]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "tuple",
"description": null,
"kind": "simple",
"doc_url": "https://docs.python.org/3/library/stdtypes.html#tuple"
},
"parameters": [
{
"type_str": "MistralTool",
"description": null,
"kind": "simple",
"doc_url": "/docs/v1/api/core/mistral/tool#mistraltool"
},
{
"type_str": "str",
"description": null,
"kind": "simple",
"doc_url": "https://docs.python.org/3/library/stdtypes.html#str"
}
]
}
]
},
"description": "The sequence of tools and their outputs from which the tool\nmessage parameters should be constructed."
}
]}
/>
<ReturnTable
returnType={{
"type_info": {
"type_str": "list[ToolMessage]",
"description": null,
"kind": "generic",
"base_type": {
"type_str": "list",
"description": null,
"kind": "simple",
"doc_url": "https://docs.python.org/3/library/stdtypes.html#list"
},
"parameters": [
{
"type_str": "ToolMessage",
"description": null,
"kind": "simple",
"doc_identifier": "ToolMessage"
}
]
},
"description": "The list of constructed `ChatMessage` parameters."
}}
/>