Skip to content
+

Generate Word, Excel, PowerPoint and PDF
with Azure OpenAI

Azure runs the model. Doconda builds the file.

Give your Azure OpenAI agent Doconda's tools and it will deliver finished, editable, reviewed Word, Excel, PowerPoint and PDF files.

  • The model is your deployment

    `model` takes the name of your Azure deployment, not the model's name. With Azure AI Foundry, any deployment that supports function calling works.

  • The variables each client reads

    `AzureOpenAI()` reads `AZURE_OPENAI_ENDPOINT`, `AZURE_OPENAI_API_KEY` and `OPENAI_API_VERSION`. In TypeScript, `azure` from `@ai-sdk/azure` reads `AZURE_RESOURCE_NAME` and `AZURE_API_KEY`.

  • If the model never calls a tool

    When the model never uses a tool, the deployment's model doesn't support function calling. Pick one that does and the same code works.

  1. 01Install the SDKpip install doconda or npm install @doconda/sdk, and your API key.
  2. 02Give your agent the toolsDoconda's tools, in Azure OpenAI's format.
  3. 03Your agent delivers the fileYour agent gets the link to the reviewed file.
import json
from doconda import Doconda
from openai import AzureOpenAI

client = AzureOpenAI()  # AZURE_OPENAI_ENDPOINT, AZURE_OPENAI_API_KEY, OPENAI_API_VERSION
tools = Doconda().tools()
spec = [{"type": "function", "function": {"name": t.name, "description": t.description,
         "parameters": t.input_schema}} for t in tools]

msg = client.chat.completions.create(model="my-deployment", tools=spec, messages=[
    {"role": "user", "content": "Write a quarterly sales report in Word"}]).choices[0].message
call = msg.tool_calls[0]  # create_document
out = next(t for t in tools if t.name == call.function.name).run(json.loads(call.function.arguments))
out["links"]  # {"docx": "https://…", "pdf": "https://…"}
+

Generate Word, Excel, PowerPoint and PDF
with Azure OpenAI

Code

Python or TypeScript

Azure runs the model. Doconda builds the file.

Give your Azure OpenAI agent Doconda's tools and it will deliver finished, editable, reviewed Word, Excel, PowerPoint and PDF files.

  • The model is your deployment

    `model` takes the name of your Azure deployment, not the model's name. With Azure AI Foundry, any deployment that supports function calling works.

  • The variables each client reads

    `AzureOpenAI()` reads `AZURE_OPENAI_ENDPOINT`, `AZURE_OPENAI_API_KEY` and `OPENAI_API_VERSION`. In TypeScript, `azure` from `@ai-sdk/azure` reads `AZURE_RESOURCE_NAME` and `AZURE_API_KEY`.

  • If the model never calls a tool

    When the model never uses a tool, the deployment's model doesn't support function calling. Pick one that does and the same code works.

  1. 01Install the SDKpip install doconda or npm install @doconda/sdk, and your API key.
  2. 02Give your agent the toolsDoconda's tools, in Azure OpenAI's format.
  3. 03Your agent delivers the fileYour agent gets the link to the reviewed file.
import json
from doconda import Doconda
from openai import AzureOpenAI

client = AzureOpenAI()  # AZURE_OPENAI_ENDPOINT, AZURE_OPENAI_API_KEY, OPENAI_API_VERSION
tools = Doconda().tools()
spec = [{"type": "function", "function": {"name": t.name, "description": t.description,
         "parameters": t.input_schema}} for t in tools]

msg = client.chat.completions.create(model="my-deployment", tools=spec, messages=[
    {"role": "user", "content": "Write a quarterly sales report in Word"}]).choices[0].message
call = msg.tool_calls[0]  # create_document
out = next(t for t in tools if t.name == call.function.name).run(json.loads(call.function.arguments))
out["links"]  # {"docx": "https://…", "pdf": "https://…"}

FAQ

Common questions

01 / 04

How do I generate a Word document with Azure OpenAI?

Install the SDK (pip install doconda or npm install @doconda/sdk), pass doconda.tools() as tools in the AzureOpenAI client's chat.completions and run the tool the model asks for. Doconda returns the link to the Word file and its PDF.

The document API for AI agents, ready for production.