> ## Documentation Index
> Fetch the complete documentation index at: https://docs.doconda.com/llms.txt
> Use this file to discover all available pages before exploring further.

# How to generate a PowerPoint from Azure OpenAI

> Pass doconda.tools() as functions to your Azure OpenAI deployment: the model creates an editable .pptx with its PDF and gives you the link.

Install `openai` and `doconda` (or `@ai-sdk/azure` and `@doconda/sdk`) and pass `doconda.tools()` as functions to your
Azure OpenAI deployment. When you ask for a presentation, the model calls `create_document` with `format: "pptx"` and you
get the PowerPoint file and its PDF with their download links.

## Steps

1. Have an Azure OpenAI deployment with function calling. `model` is your **deployment** name.
2. Put your Azure credentials in the environment and your Doconda API key (dashboard → **API keys**) in
   `DOCONDA_API_KEY`.
3. Connect the tools and ask for the presentation:

<CodeGroup>
  ```python Python theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
  # pip install openai doconda
  import json

  from doconda import Doconda
  from openai import AzureOpenAI

  client = AzureOpenAI()
  tools = Doconda().tools()
  specs = [{"type": "function", "function": {"name": t.name, "description": t.description, "parameters": t.input_schema}} for t in tools]
  messages = [{"role": "user", "content": "Create a 5-slide presentation on our quarterly results"}]

  while True:
      message = client.chat.completions.create(model="my-deployment", messages=messages, tools=specs).choices[0].message
      messages.append(message)
      if not message.tool_calls:
          break
      for call in message.tool_calls:
          out = next(t for t in tools if t.name == call.function.name).run(json.loads(call.function.arguments))
          messages.append({"role": "tool", "tool_call_id": call.id, "content": json.dumps(out)})

  print(message.content)
  ```

  ```ts TypeScript theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
  // npm install ai @ai-sdk/azure @doconda/sdk
  import { azure } from "@ai-sdk/azure"
  import { generateText, isStepCount, jsonSchema, tool } from "ai"
  import { Doconda } from "@doconda/sdk"

  const doconda = new Doconda()
  const tools = Object.fromEntries(
    doconda.tools().map((t) => [
      t.name,
      tool({ description: t.description, inputSchema: jsonSchema(t.inputSchema), execute: (input) => t.run(input as Record<string, unknown>) }),
    ]),
  )

  const { text } = await generateText({
    model: azure("my-deployment"),
    tools,
    stopWhen: isStepCount(5),
    prompt: "Create a 5-slide presentation on our quarterly results",
  })

  console.log(text)
  ```
</CodeGroup>

`AzureOpenAI()` reads `AZURE_OPENAI_ENDPOINT`, `AZURE_OPENAI_API_KEY` and `OPENAI_API_VERSION`; the AI SDK's `azure`
reads `AZURE_RESOURCE_NAME` and `AZURE_API_KEY`.

## What you get back

```json theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
{
  "id": "doc_01JAB3…",
  "format": "pptx",
  "status": "ready",
  "links": { "pptx": "https://…", "pdf": "https://…" },
  "links_note": "Links expire in 5 minutes: call get_document for fresh ones."
}
```

* An editable 16:9 PowerPoint with native charts and a theme that slides you add later follow, plus its PDF.
* `status`: `ready`, `ready_with_warnings`, `needs_review` or `failed` (not charged).
* Links expire after 5 minutes; the agent gets fresh ones with `get_document`.

## FAQ

<AccordionGroup>
  <Accordion title="Does it work with Azure AI Foundry?">
    Yes, with any Foundry deployment that supports function calling: the tools are standard JSON Schema.
  </Accordion>

  <Accordion title="Can it start from our corporate template?">
    Yes. Pass the presentation as a source and ask for "our template's design": the result starts from its slides (at
    `standard` and `best` quality).
  </Accordion>

  <Accordion title="Where are the documents stored?">
    In the European Union (Ireland), and the AI that processes them also runs in the EU.
  </Accordion>

  <Accordion title="How much does it cost?">
    You pay per delivered document; failed ones are not charged. See [pricing](/en/guides/account#pricing).
  </Accordion>
</AccordionGroup>

## Keep reading

* [Azure OpenAI](/en/agents/azure): the full guide.
* [Quickstart](/en/quickstart).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.