Create spreadsheets & documents with Mistral
Mistral models support function calling with the same tools schema you'd use with OpenAI. Define a create_spreadsheet tool, run the matching API request when the model calls it, and return the link. Works with the Mistral Python client.
Mistral (Python)
tools = [{
"type": "function",
"function": {
"name": "create_spreadsheet",
"description": "Create a shareable spreadsheet and return its URL.",
"parameters": {
"type": "object",
"properties": {
"title": {"type": "string"},
"rows": {"type": "array", "items": {"type": "array"}}
},
"required": ["title", "rows"]
}
}
}]
# When the model returns a tool_calls entry:
import requests
def create_spreadsheet(title, rows):
r = requests.post("https://openofficeai.com/api/v1/sheets",
headers={"Authorization": "Bearer YOUR_API_KEY"},
json={"title": title, "sheets": [{"rows": rows}]})
return r.json()["url"]How to create a spreadsheet with Mistral
- 1Declare the create_spreadsheet tool in the tools array.
- 2Pass tools to client.chat.complete and check tool_calls in the response.
- 3Run the matching function and POST to /api/v1/sheets.
- 4Send the url back as a tool message for the next turn.
Why use OpenOfficeAI with Mistral
- OpenAI-compatible tools schema — reuse the same definition.
- Works with Mistral Large and the smaller tool-capable models.
- Minimal glue between the tool spec and the API body.
Frequently asked questions
Is the tools format the same as OpenAI?
Largely yes. Mistral uses the same function/tool JSON structure, so a definition written for OpenAI function calling works with minimal or no changes.
How do I send the result back?
Append a message with role "tool", the tool_call_id, and the url as content, then call the model again so it can present the link to the user.
Can I force a tool call?
Yes. Set tool_choice to "any" (or name the function) to require the model to call a tool rather than answer directly.
Start creating documents with Mistral
Free tier includes 500 API calls per month — no card required.
Related integrations