> ## 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.

# Google Vertex AI

> Genera Word, PowerPoint, Excel y PDF desde un agente con Google Vertex AI.

Las credenciales salen de tu entorno de Google Cloud (`gcloud auth application-default login` o una cuenta de
servicio), como en el resto de tu código.

## Con el AI SDK

```bash theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
npm install ai @ai-sdk/google-vertex @doconda/sdk
```

```ts theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
import { createVertex } from "@ai-sdk/google-vertex"
import { generateText, isStepCount, jsonSchema, tool } from "ai"
import { Doconda } from "@doconda/sdk"

const vertex = createVertex({ project: "mi-proyecto", location: "europe-west1" })
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: vertex("gemini-3.8-flash"),
  tools,
  stopWhen: isStepCount(5),
  prompt: "Crea una presentación de 5 diapositivas sobre nuestros resultados del trimestre",
})

console.log(text)
```

## Con @google/genai

```bash theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
npm install @google/genai @doconda/sdk
```

El mismo bucle que en [Gemini](/es/agents/gemini), con `vertexai: true`:

```ts theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
import { type Content, GoogleGenAI } from "@google/genai"
import { Doconda } from "@doconda/sdk"

const ai = new GoogleGenAI({ vertexai: true, project: "mi-proyecto", location: "europe-west1" })
const tools = new Doconda().tools()
const contents: Content[] = [{ role: "user", parts: [{ text: "Hazme un Excel con el presupuesto del evento" }] }]

while (true) {
  const res = await ai.models.generateContent({
    model: "gemini-3.8-flash",
    contents,
    config: { tools: [{ functionDeclarations: tools.map((t) => ({ name: t.name, description: t.description, parametersJsonSchema: t.inputSchema })) }] },
  })
  if (!res.functionCalls?.length) {
    console.log(res.text)
    break
  }
  contents.push(res.candidates![0].content!)
  const parts = await Promise.all(
    res.functionCalls.map(async (call) => ({
      functionResponse: { name: call.name, response: { result: await tools.find((t) => t.name === call.name)!.run(call.args ?? {}) } },
    })),
  )
  contents.push({ role: "user", parts })
}
```

## Con Python

```bash theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
pip install google-genai doconda
```

```python theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
from doconda import Doconda
from google import genai
from google.genai import types

client = genai.Client(vertexai=True, project="mi-proyecto", location="europe-west1")
tools = Doconda().tools()
config = types.GenerateContentConfig(
    tools=[types.Tool(function_declarations=[
        types.FunctionDeclaration(name=t.name, description=t.description, parameters_json_schema=t.input_schema) for t in tools
    ])]
)
contents = [types.Content(role="user", parts=[types.Part.from_text(text="Hazme un Excel con el presupuesto del evento")])]

while True:
    res = client.models.generate_content(model="gemini-3.8-flash", contents=contents, config=config)
    if not res.function_calls:
        break
    contents.append(res.candidates[0].content)
    parts = [
        types.Part.from_function_response(name=c.name, response={"result": next(t for t in tools if t.name == c.name).run(dict(c.args or {}))})
        for c in res.function_calls
    ]
    contents.append(types.Content(role="user", parts=parts))

print(res.text)
```


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