---
name: llm_acompletion_retry
kind: function
lang: py
domain: core
version: "1.0.0"
purity: impure
signature: "async def llm_acompletion_retry(model: str, prompt: str, max_retries: int = 10, temperature: float = 0) -> str"
description: "Completion LLM asincrono con retry automatico. Soporte multi-modelo via litellm (OpenAI, Anthropic, etc.)."
tags: [llm, completion, retry, async, litellm, api, pendiente-usar]
uses_functions: []
uses_types: []
returns: []
returns_optional: false
error_type: "error_go_core"
imports: [litellm, asyncio, logging]
params:
  - name: model
    desc: "Nombre del modelo LLM (ej: 'gpt-4o', 'claude-sonnet-4-20250514')"
  - name: prompt
    desc: "Mensaje de usuario a enviar al modelo"
  - name: max_retries
    desc: "Número máximo de reintentos ante errores transitorios"
  - name: temperature
    desc: "Temperatura para la generación (0.0 a 1.0)"
output: "Texto de respuesta del modelo LLM"
tested: false
tests: []
test_file_path: ""
file_path: "python/functions/core/llm_acompletion_retry.py"
source_repo: "https://github.com/VectifyAI/PageIndex"
source_license: "MIT"
source_file: "pageindex/utils.py"
---

## Ejemplo

```python
import asyncio

async def main():
    response = await llm_acompletion_retry("gpt-4o", "Summarize this text: ...")
    print(response)

asyncio.run(main())
```

## Notas

Requiere `pip install litellm`. Version async de llm_completion_retry. Usa asyncio.sleep entre retries. Ideal para procesar multiples prompts en paralelo con asyncio.gather.
