---
title: Text Generation
description: Chat, summarization, RAG, structured output, and function calling for African languages.
icon: MessageSquareText
---
import { Tab, Tabs } from 'fumadocs-ui/components/tabs';
The Text Generation API is powered by **`Addis-፩-አሌፍ`**, our flagship large language model.
Use it when your application needs chat, summarization, extraction, classification, RAG, structured output, function calling, or multi-turn conversation in African-language workflows.
Use Text Generation for chat, summarization, extraction, classification, RAG, structured output, and multi-turn conversations. Use the dedicated Translation API for direct language-to-language translation.
## Basic request
Send a prompt and a target language to get an immediate response.
```ts
import AddisAI from "addisai";
const addis = new AddisAI();
const response = await addis.chat.completions.create({
messages: [{
role: "user",
content: "የአድዋ ጦርነት ታሪክ በአጭሩ",
}],
temperature: 0.7,
max_tokens: 500,
});
console.log(response.choices[0].message.content);
```
```python
from addisai import AddisAI
addis = AddisAI()
response = addis.chat.completions.create(
messages=[{
"role": "user",
"content": "የአድዋ ጦርነት ታሪክ በአጭሩ",
}],
temperature=0.7,
max_tokens=500,
)
print(response["choices"][0]["message"]["content"])
```
```bash
curl https://api.addisassistant.com/api/v1/chat_generate \
-H "Content-Type: application/json" \
-H "x-api-key: $ADDIS_API_KEY" \
-d '{
"prompt": "የአድዋ ጦርነት ታሪክ በአጭሩ",
"target_language": "am",
"generation_config": {
"temperature": 0.7,
"maxOutputTokens": 500
}
}'
```
## Guides
Keep context across turns.
Control identity and behavior.
Let the model request your actions.
Show replies as they are written.
## API reference
Every request field, generation setting, and response field is documented in [POST /api/v1/chat_generate](/docs/api-reference/chat-generate).
## Best Practices
Follow these architectural patterns to ensure production readiness.
{/* Temperature Card */}
Temperature
0.1 - 0.3
**Factual.** Extraction, classification, and historical data.
0.7 - 0.9
**Creative.** Storytelling, brainstorming, and casual chat.
{/* Language Card */}
Localization
Native Script: Models perform significantly better with Ge'ez input (e.g., "ሰላም") than Latin ("Selam").
Explicit Mode: Always set the target_language param to "am" or "om" to force the correct tokenizer.
{/* Token Card */}
Economy
Exact count
usage_metadata
Token counts vary by language, script, punctuation, and input structure. For Amharic, one word typically uses around 1.5 to 1.8 tokens. For the exact count, use usage_metadata returned in the REST API response or the corresponding usage value returned by the official SDK.
{/* Reliability Card */}
Robustness
Retries: Implement exponential backoff for 500 or 429 status codes.
Safety: Handle finish_reason: "safety" gracefully in your UI if the model refuses a prompt.