Text Generation
Chat, summarization, and RAG optimized for Ethiopian languages.
The Text Generation API is powered by Addis-፩-አሌፍ, our flagship Large Language Model.
Our model is trained on extensive native datasets to master not only the complex morphology (word structure) and syntax but also the deep **cultural context ** of Ethiopia. It is culturally nuanced, understanding the specific way we live, interact, and communicate ensuring every response feels natural, respectful, and authentic to our reality.
Endpoint
Usage Guide
You can use this endpoint for simple one-off tasks (like translation) or complex multi-turn conversations.
Basic Request
Send a prompt and a target language to get an immediate response.
curl -X POST https://api.addisassistant.com/api/v1/chat_generate \
-H "Content-Type: application/json" \
-H "X-API-Key: sk_YOUR_KEY" \
-d '{
"prompt": "የአድዋ ጦርነት ታሪክ በአጭሩ",
"target_language": "am",
"generation_config": {
"temperature": 0.7
}
}'// Full Example: Basic Text Generation
const API_KEY = "sk_YOUR_KEY";
async function generateText() {
try {
const response = await fetch("https://api.addisassistant.com/api/v1/chat_generate", {
method: "POST",
headers: {
"Content-Type": "application/json",
"X-API-Key": API_KEY,
},
body: JSON.stringify({
prompt: "የአድዋ ጦርነት ታሪክ በአጭሩ", // "History of Adwa briefly"
target_language: "am",
generation_config: {
temperature: 0.7,
maxOutputTokens: 500
}
}),
});
if (!response.ok) throw new Error(`Error: ${response.status}`);
const data = await response.json();
console.log("Response:", data.response_text);
} catch (error) {
console.error(error);
}
}
generateText();import requests
def generate_text():
url = "https://api.addisassistant.com/api/v1/chat_generate"
headers = {"X-API-Key": "sk_YOUR_KEY"}
payload = {
"prompt": "የአድዋ ጦርነት ታሪክ በአጭሩ",
"target_language": "am",
"generation_config": {
"temperature": 0.7,
"maxOutputTokens": 500
}
}
try:
response = requests.post(url, headers=headers, json=payload)
response.raise_for_status() # Check for errors
data = response.json()
print("Response:", data['response_text'])
except requests.exceptions.RequestException as e:
print(f"Error: {e}")
generate_text()Multi-Turn Chat (Context)
The API is stateless. This means the model does not "remember" what you said in the previous request.
To build a chatbot that maintains context, you must append the conversation history to the conversation_history array in every new request.
curl --location 'https://api.addisassistant.com/api/v1/chat_generate' \
--header 'X-API-Key: sk_YOUR_KEY' \
--header 'Content-Type: application/json' \
--data '{
"prompt": "በጣም ጥሩ። ለነዚህ ለጁኒየር ዴቨሎፐር ስራዎች በብዛት የሚፈለጉት የፕሮግራሚንግ ቋንቋዎች የትኞቹ ናቸው?",
"target_language": "am",
"conversation_history": [
{
"role": "user",
"content": "በሶፍትዌር ኢንጂነሪንግ ተመርቄያለሁ። አዲስ አበባ ውስጥ ለጀማሪዎች ምን አይነት የስራ እድሎች አሉ?"
},
{
"role": "assistant",
"content": "እንኳን ደስ አለህ! በአዲስ አበባ ለሶፍትዌር ኢንጂነሪንግ ተመራቂዎች እንደ ጁኒየር ዴቨሎፐር፣ የሶፍትዌር ጥራት ማረጋገጫ (QA) እና የ የቴክኒክ ድጋፍ ስፔሻሊስት ያሉ እድሎች አሉ።"
}
],
"generation_config": {
"temperature": 0.7,
"stream": false,
"maxOutputTokens": 1200
}
}'// Full Example: Chat with History
const API_KEY = "sk_YOUR_KEY";
async function chatWithHistory() {
// 1. Define the conversation history so far
const history = [
{ role: "user", content: "ኢትዮጵያ ውስጥ ስንት ክልሎች አሉ?" },
{ role: "assistant", content: "በአሁኑ ጊዜ 12 ክልሎች አሉ።" }
];
// 2. Send the NEW question along with the HISTORY
try {
const response = await fetch("https://api.addisassistant.com/api/v1/chat_generate", {
method: "POST",
headers: {
"Content-Type": "application/json",
"X-API-Key": API_KEY
},
body: JSON.stringify({
prompt: "የሁለተኛው ክልል ስም ማን ነው?", // "What is the name of the second one?"
target_language: "am",
conversation_history: history // <--- Important: Pass history here
}),
});
const data = await response.json();
console.log("Answer:", data.response_text);
} catch (error) {
console.error("Chat Failed:", error);
}
}
chatWithHistory();import requests
def chat_with_history():
# 1. Define the conversation history so far
history = [
{"role": "user", "content": "ኢትዮጵያ ውስጥ ስንት ክልሎች አሉ?"},
{"role": "assistant", "content": "በአሁኑ ጊዜ 12 ክልሎች አሉ።"}
]
# 2. Send the NEW question along with the HISTORY
payload = {
"prompt": "የሁለተኛው ክልል ስም ማን ነው?",
"target_language": "am",
"conversation_history": history
}
try:
response = requests.post(
"https://api.addisassistant.com/api/v1/chat_generate",
headers={"X-API-Key": "sk_KEY"},
json=payload
)
response.raise_for_status()
data = response.json()
print("Answer:", data['response_text'])
except Exception as e:
print(f"Chat Failed: {e}")
chat_with_history()API Reference
Request Parameters
These parameters go in the root of your JSON body.
Prop
Type
Generation Config
Use generation_config to tune the creativity and length of the response.
Prop
Type
Response Schema
The API returns a JSON object.
{
"response_text": "The generated text response...",
"finish_reason": "stop",
"usage_metadata": {
"prompt_token_count": 12,
"candidates_token_count": 45,
"total_token_count": 57
},
"modelVersion": "Addis-፩-አሌፍ"
}Prop
Type
Token Counting
Note that for Amharic, token counts may be higher than English due to the Ge'ez script encoding. Typically 1 word ≈ 1.5 to 1.8 tokens.
Best Practices
Follow these architectural patterns to ensure production readiness.
Temperature
0.1 - 0.3Factual. Extraction, translation, and historical data.0.7 - 0.9Creative. Storytelling, brainstorming, and casual chat.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.
Economy
1 Word ≈ 1.8 TokensAmharic is token-dense. Keep system prompts concise to reduce latency and costs.
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.