doconda.tools() as Gemini function declarations and run the calls Gemini makes. When you ask
for a document, Gemini calls create_document with format: "docx" and gets back download links to an editable Word
file and its PDF. The same code makes a PowerPoint (pptx) or an Excel file (xlsx).
Steps
- Put your Gemini API key in
GEMINI_API_KEY, or use Vertex AI (below). - Put your Doconda API key (dashboard → API keys) in
DOCONDA_API_KEY. - Declare the tools and run the loop: while Gemini asks for functions, run them and hand back the result.
parameters_json_schema (parametersJsonSchema in TypeScript) takes each tool’s JSON Schema as is.
On Vertex AI the code is the same with another client: genai.Client(vertexai=True, project="my-project", location="europe-west1") in Python or new GoogleGenAI({ vertexai: true, project: "my-project", location: "europe-west1" }) in TypeScript, with the credentials from your Google Cloud environment.
What you get back
create_document returns this summary to Gemini:
- An editable Word file: the look lives in the document’s styles (
Normal,Heading 1…), plus its PDF. status:readyorfailed. Failed documents are not charged.- Links expire after 5 minutes; Gemini gets fresh ones with
get_document.
FAQ
How do I generate a PowerPoint with Gemini?
How do I generate a PowerPoint with Gemini?
The same way: ask for a presentation (“Create a 5-slide presentation on our quarterly results”) and Gemini calls
create_document with format: "pptx". You get a 16:9 .pptx with native charts and its PDF.Can I use MCP instead of declaring the functions?
Can I use MCP instead of declaring the functions?
Yes, with
mcpToTool from @google/genai (experimental) and the remote server https://api.eu.doconda.com/mcp.
See Gemini.Can it edit a Word file I already have?
Can it edit a Word file I already have?
Yes. Gemini uploads it with
upload_file and calls edit_document, which changes only what you ask.How much does it cost?
How much does it cost?
A document from a sentence costs €0.15 at
fast, €0.50 at standard and €1.50 at best. Failed documents are not
charged. See pricing.Related
- Gemini and Google Vertex AI: the full guides.
- How do I make an Excel file from Gemini on Vertex AI?