# Agents Best Practices Source: https://docs.pawa-ai.com/agents/agent-best-practices Recommended strategies and design patterns for building reliable, efficient, and effective agents with Pawa AI. ## Overview Building agents in Pawa AI goes beyond just setting up models. To ensure reliability, efficiency, and great user experiences, it’s important to follow certain best practices. This guide covers practical tips for: * Structuring agent instructions * Managing context and memory * Orchestrating multiple agents * Controlling model outputs * Ensuring safety and reliability *** ## 1. Define Clear Agent Roles * **Be specific**: Give each agent a clear purpose (e.g., *“Research Assistant”*, *“Translation Agent”*). * **Avoid overlap**: Minimize redundant functionality across agents to reduce confusion. * **Use a RouterAgent**: When multiple agents exist, let a router orchestrate queries instead of exposing all agents directly. Example: * RouterAgent → Decides where to send the request * TranslationAgent → Handles language tasks * FinanceAgent → Handles financial queries *** ## 2. Write Effective Instructions * Use **concise but detailed instructions** to guide behavior. * Add constraints like *“always cite sources”* or *“keep responses under 100 words”*. * Use **intents** (`["Be gentle", "Be detailed"]`) to fine-tune tone and style. Example: ```json theme={null} "instruction": "Always provide accurate, concise summaries. If information is uncertain, state that clearly." ``` # Agents Conversations Source: https://docs.pawa-ai.com/agents/agents-conversations Learn how to initiate and manage conversations with Pawa AI agents, including context handling, multi-agent routing, and configurable parameters for generating intelligent responses. Agents in Pawa AI can engage in rich, multi-turn conversations with users.\ Each conversation request includes the current user message, optional prior chat history, routing details, and generation parameters. Conversations support: * **Context memory** — preserve prior messages for coherent dialogue. * **Routing** — use orchestration agents (e.g., a `RouterAgent`) to direct queries to specialized agents. * **Custom instructions** — guide the agent’s reasoning and behavior. * **Fine-tuned control** — adjust randomness, response length, and penalties for repetition. *** ## Agent Request Schema Example | Field | Type | Description | | - | - | - | | `name` | string | Name of the agent handling the conversation. | | `description` | string | A brief description of the agent’s purpose. | | `instruction` | string | Behavioral guidance for the agent. | | `intents` | array | Optional: predefined conversational styles or goals (e.g., “Be gentle”, “Be detailed”). | | `model` | string | Model powering the conversation (e.g., `pawa-v1-blaze-20250318`). | | `message` | object | The latest message from the user. | | `agents` | array | IDs of other agents available for orchestration or delegation. | | `memoryChat` | array | Conversation history for context preservation. | | `temperature` | number | Controls randomness of responses (default: `0.1`). | | `reasoning` | object | Increase internal thinking capabilities of the model before answering. | | `top_p` | number | Nucleus sampling threshold (default: `0.95`). | | `max_tokens` | number | Maximum tokens to generate in response. | | `frequency_penalty` | number | Penalizes repeated phrases (default: `0.3`). | | `presence_penalty` | number | Encourages exploration of new topics (default: `0.3`). | | `seed` | number | Random seed for reproducibility. | | `stream` | boolean | Whether to stream the response (`true`) or return once complete (`false`). | *** ## Example Agent Chat Request ```bash theme={null} curl -X POST "https://api.pawa-ai.com/v1/agents/chat/request" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer PAWA_AI_API_KEY" \ -d '{ "name": "RouterAgent", "description": "An orchestration agent responsible for routing user queries to the most appropriate specialist agent. If a query doesn't match any specific agent, this agent will attempt to answer the question directly.", "instruction": "Your primary function is to analyze user queries and determine the best agent to handle them. If the query is unrelated to any known agents or requires general router knowledge, respond directly to the user with helpful information. Prioritize efficient routing and provide clear explanations when responding directly.", "intents": [ "Be gentle", "Be detailed" ], "model": "pawa-v1-blaze-20250318", "message": { "role": "user", "content": [ { "type": "text", "text": "What was the score of Yanga in CAF 2025?" } ] }, "agents": [72], "memoryChat": [ { "role": "user", "content": [ { "type": "text", "text": "Habari yako?" } ] }, { "role": "assistant", "content": [ { "type": "text", "text": "Nzuri sana, asante. Wewe je?" } ] } ], "temperature": 0.1, "reasoning": { "effort": "medium" }, "top_p": 0.95, "max_tokens": 4096, "frequency_penalty": 0.3, "presence_penalty": 0.3, "seed": 2024, "stream": false }' ``` You can send, multiple agents as list if you want to implement agents orchestration, agents collaboration etc. # Agents Handoff Source: https://docs.pawa-ai.com/agents/agents-handoff Learn how Pawa AI handles multi-agent orchestration through agent handoff, where a RouterAgent routes queries to the most suitable specialized agent for execution. ## Overview In Pawa AI, **agent handoff** allows an orchestration agent (e.g., a `RouterAgent`) to delegate user queries to the most appropriate specialist agent. * **Router agent**: An agent designed to analyze user queries and determine the best agent to handle them. * **Specialist agents**: Domain-specific agents (e.g., research, translation, financial assistant). * **Handoff process**: The router inspects the query, decides whether to answer directly or forward it to another agent, and then provides the response. This ensures users always get the **best possible response** without needing to know which agent should handle their request. To access handoff, you technically send the list of agents in agent chat request endpoint. *** # Create Agents Source: https://docs.pawa-ai.com/agents/create-agents Pawa AI lets you create autonomous, task-oriented agents that can reason, act, and interact with users and external tools. These agents can perform complex workflows, automate tasks, and provide intelligent assistance across different domains. Pawa AI agents are autonomous, task-oriented systems designed to perform actions, reason about problems, and interact with users or external tools. They can execute complex workflows, respond to dynamic inputs, and make decisions based on their built-in capabilities. ## Creating an Agent with Pawa AI To create an agent, you typically define: 1. **Name and Description**\ A clear name and concise description help identify the agent's purpose. 2. **Instructions**\ Specific rules or guidance for how the agent should behave. 3. **Intents and Capabilities**\ Optionally define what the agent is capable of doing — for example, answering questions, performing calculations, or interacting with external systems. 4. **Tools and Integrations**\ Optionally list external tools the agent can use to perform its tasks. You can put custom or built-in tools 5. **Knowledge Base ID as References**\ Optionally if the agent needs access to a knowledge base, provide references or IDs to the relevant data sources. ## Create Agent Request You can create a Pawa AI agent by sending a `POST` request to the API endpoint. Below is an example: You can quickly test this endpoint in the API reference: [Try it in the API Reference](/api-reference/endpoint/agents/create?playground=open) ```bash theme={null} curl -X POST "https://api.pawa.ai/agents" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer PAWA_AI_API_KEY" \ -d '{ "name": "TutorAI", "description": "TutorAI is an AI agent designed to assist students with their studies.", "instruction": "Teaching students on subjects ranging from form 0ne to form 4. Follow questions properly and do not answer any other questions apart from what you have been tasked to", "intents": [ "Be gentle", "Be detailed" ], "knowledgeBaseId": 159, "tools": [ { "type": "function", "function": { "name": "convert_usd_to_tsh", "description": "Converts an amount in USD to Tanzanian Shillings.", "strict": true, "parameters": { "type": "object", "properties": { "amount_usd": { "description": "Amount in USD", "type": "number" } }, "required": [ "amount_usd" ], "additionalProperties": false } } }, { "type": "pawa_tool", "pawa_tool": "web_search_tool" } ] }' ``` You can create multiple agents, based on your tier plan, and use the orchestration conversation to chat, and the Pawa AI will dynamically decide what agent(s) to use, contribute, etc. # Introduction Source: https://docs.pawa-ai.com/agents/introduction An overview of agents in Pawa AI — autonomous, task-oriented systems that can reason, act, and interact with users and tools. AI agents are autonomous systems that, given high-level instructions, can plan, use tools, carry out processing steps, and take actions to achieve specific goals, ranging from executing simple workflows to pursuing complex, open-ended objectives. These agents leverage advanced natural language processing capabilities to understand and execute complex tasks efficiently and can even collaborate with each other to achieve more sophisticated outcomes. Unlike a simple question-answer interaction, agents are designed to operate in more complex workflows, independently accomplish tasks on your behalf — where they can make decisions, call tools, and manage multi-step tasks. > **Agents Example** ![Web Browsing Example](https://mintcdn.com/sartifycoltd/h3QvoufTX15l3Mnz/images/Agent.png?fit=max\&auto=format\&n=h3QvoufTX15l3Mnz\&q=85\&s=78bd4166ed7d43c3b8fd502b3e2b6ef3) > An AI agent independently chooses the best actions it needs to perform to achieve those goals. For example, consider a contact center AI agent that wants to resolve customer queries. The agent will automatically ask the customer different questions, look up information in internal documents, and respond with a solution. Based on the customer responses, it determines if it can resolve the query itself or pass it on to a human. > Multiple AI agents can collaborate to automate complex workflows and can also be used in agentic ai systems. They exchange data with each other, allowing the entire system to work together to achieve common goals. Individual AI agents can be specialized to perform specific subtasks with accuracy. An orchestrator agent coordinates the activities of different specialist agents to complete larger, more complex tasks ## Pawa AI Agentic Primitives **Pawa AI** provides a rich set of composable primitives that enable you to build agents. This guide walks through those primitives and how they come together to form a robust agentic platform. > [card] - Models > > Foundation of intelligence — power your agents with state-of-the-art models. > [card] - Multimodal Understanding & Processing > > Process text, images, and audio seamlessly for richer interactions. > [card] - Knowledge Base > > Ground responses with your private or public knowledge sources. > [card] - Memory > > Enable context persistence for more personalized and coherent conversations. > [card] - Structured Outputs > > Generate outputs in JSON or other structured formats for direct integration. > [card] - Voice > > Add speech-to-text and text-to-speech capabilities to your agents. > [card] - Instructions > > Guide agent behavior with system prompts, policies, and custom rules. > [card] - Document Understanding > > Extract, summarize, and reason over raw documents with precision. > [card] - Tool Usage > > Connect external APIs, plugins, and utilities for real-world actions. > [card] - Orchestration > > Coordinate multiple agents, tools, and workflows for complex tasks. ## More Overview on Primitives | Primitive | Purpose | Capabilities | | - | - | - | | **Models** | The foundation of every agent, powering reasoning and language tasks. | Lightweight, large-scale, and specialized models (e.g., African languages). | | **Multimodal Understanding & Processing** | Enables agents to work beyond text and handle multiple input/output forms. | Text, vision (images/docs), and speech (audio input & output). | | **Knowledge Base (KB)** | Provides access to structured and unstructured data for reasoning. | Import documents/databases, query in natural language, combine KB with models. | | **Memory** | Allows agents to retain information over time. | Short-term (conversation context) and long-term (user preferences/history). | | **Structured Outputs** | Ensures machine-readable responses that follow strict schemas. | JSON schemas, reliable integration with APIs/databases/workflows. | | **Voice** | Enables natural voice-based interaction with agents. | Speech-to-Text (STT), Text-to-Speech (TTS), streaming real-time conversations. | | **Instructions** | Shapes agent behavior through role-setting and constraints. | Define roles, goals, tone, or language (e.g., “Always reply in Swahili”). | | **Document Understanding** | Extracts and interprets data from documents. | Parse text, tables, metadata, summarize/translate, structured data extraction. | | **Tool Usage** | Lets agents interact with external systems and APIs. | Call functions, APIs, search engines, or business tools dynamically. | | **Orchestration** | Coordinates multiple primitives for complex workflows. | Multi-step reasoning, chaining tools/KB/memory, autonomous task handling. | *** These **primitives are composable**, meaning you can mix and match them to design agents that: * Understand multimodal inputs. * Retain knowledge over time. * Output reliable structured data. * Use external tools. * Orchestrate complex workflows. ## What Makes Agents Different? * **Autonomous behavior**: Agents can decide the next best action instead of waiting for explicit instructions. * **Goal oriented**: Agents can call APIs, databases, or external services to fetch or manipulate information. * **Reasoning**: Agents break down complex tasks into steps, enabling better problem-solving. * **Collaboration**: Agents break down complex tasks into steps, enabling better problem-solving. *** ## Example Use Cases * **Customer Support Agent**: Answers questions, checks knowledge bases, and integrates with CRM systems. * **Data Analysis Agent**: Queries databases, runs calculations, and summarizes insights. * **Educational Agent**: Tutors students, generates quizzes, and adapts learning paths. * **Research Agent**: Reads documents, extracts entities, and generates structured summaries. *** Agents mark a new era in workflow automation, where systems can reason through ambiguity, take action across tools, and handle multi-step tasks with a high degree of autonomy. Unlike simpler language models applications, agents execute workflows end-to-end, making them well-suited for use cases that involve complex decisions, unstructured data, or brittle rule-based systems. To build reliable agents, start with strong foundations: pair capable models with well-defined tools and clear, structured instructions. Use orchestration patterns that match your complexity level, starting with a single agent and evolving to multi-agent systems only when needed. Guardrails are critical at every stage, from input filtering and tool use to human-in-the-loop intervention, helping ensure agents operate safely and predictably in production. The path to successful deployment isn’t all-or-nothing. Start small, validate with real users, and grow capabilities over time. With the right foundations and an iterative approach, agents can deliver real business value—automating not just tasks, but entire workflows with intelligence and adaptability. If you’re exploring agents for your organization or preparing for your first deployment, feel free to reach out. Our team can provide the expertise, guidance, and hands-on support to ensure your success. # Authentication Source: https://docs.pawa-ai.com/api-reference/authentication Pawa AI APIs requires API Keys as authentication to ensure secure access and usage. This section details the methods and best practices for authenticating your requests. Create and manage your API keys in your **[Dashboard settings](https://builder.pawa-ai.com/dashboard?page=keys)** Your API key is *confidential!*. Treat it like a password. Never share it publicly or include it in client-side code (like in web browsers or mobile apps). Always store your API keys securely, preferably loaded from an environment variable or a key management service on your server. API keys should be provided via **`HTTP Bearer authentication`** ```bash theme={null} Authorization: Bearer PAWA_AI_API_KEY ``` ### Example. ```bash theme={null} curl -X POST "https://api.pawa-ai.com/v1/chat/request" \ -H "Authorization: Bearer PAWA_AI_API_KEY" \ -H "Content-Type: application/json" \ ``` You can view your API usage through the **[Usage Dashboard](https://builder.pawa-ai.com/dashboard?page=data)**. # Agents Conversation Source: https://docs.pawa-ai.com/api-reference/endpoint/agents/conversation POST /agents/chat/request This endpoint is used to receive agent chat request from user through API and return the answer. # Create Agents Source: https://docs.pawa-ai.com/api-reference/endpoint/agents/create POST /agents/create This endpoint used to create the new custom agent to the Pawa AI Platform. # Delete Agent Source: https://docs.pawa-ai.com/api-reference/endpoint/agents/delete DELETE /agents/delete/{id} This endpoint used to delete the custom agent in the Pawa AI Platform. # Agents Handoff Source: https://docs.pawa-ai.com/api-reference/endpoint/agents/handoff POST /agents/chat/request This endpoint is used to receive agent chat request from user through API and return the answer. # Introduction Source: https://docs.pawa-ai.com/api-reference/endpoint/agents/introduction The Pawa API helps you create, manage, and interact with autonomous AI agents. Agents can reason, use tools, perform RAG, and collaborate with chat or external workflows. ## What You Can Do: The endpoint supports full lifecycle management of AI agents: * **Create** → Spin up a new agent with knowledge base, tools, and settings. * **Chat** → Send/receive messages with an agent. * **Update** → Modify agent config, tools, or memory. * **Delete** → Remove an agent when it’s no longer needed. * **Handoff** → Transfer control between agents or from an agent to a human. * **List / Retrieve** → Fetch existing agents and their metadata. *** # Edit Agent Source: https://docs.pawa-ai.com/api-reference/endpoint/agents/update PUT /agents/update/{id} This endpoint used to update the custom agent in the Pawa AI Platform. # Get All Agents Source: https://docs.pawa-ai.com/api-reference/endpoint/agents/view GET /agents/view This endpoint used to retrieve all custom agents created in the Pawa AI Platform. # Get Single Agent Source: https://docs.pawa-ai.com/api-reference/endpoint/agents/view-single GET /agents/view/{id} This endpoint used to get the custom agent by id in the Pawa AI Platform. # Introduction Source: https://docs.pawa-ai.com/api-reference/endpoint/chat/introduction The Pawa AI chat endpoint provides a unified interface for conversation, reasoning, multimodal input, retrieval-augmented generation (RAG), agentic workflows, tools, and structured outputs — all powered by our Pawa model family. ## What You Can Do The endpoint supports a wide range of capabilities to power intelligent applications: * **Basic Chat** → Natural conversation in Swahili, English, and other African languages. * **Multimodal** → Combine text and images as input for richer interactions. * **RAG (Retrieval-Augmented Generation)** → Connect external knowledge sources for contextual, grounded responses. * **Agentic RAG** → Extend RAG with agent workflows for planning, reasoning, and task execution. * **Agents** → Run multi-step autonomous workflows where the model coordinates actions. * **Reasoning** → Handle structured problem solving, logic, and advanced query resolution. * **Tools Calling** → Dynamically call external APIs or functions from within a conversation. * **Structured Output** → Generate reliable, typed JSON for downstream processing. ## Chat Models includes The chat endpoint runs on **Pawa small language models (SLMs)**, optimized for efficiency, long context, and multilingual use. * **Pawa Ember** → Lightweight, efficient model for real-time and low-cost deployments. * **Pawa Blaze** → Advanced model for reasoning, multimodal tasks, and agentic workflows. *** With chat endpoint, you can start simple and scale up to advanced multimodal and agent-based applications — without changing the core interface. # Send Request Source: https://docs.pawa-ai.com/api-reference/endpoint/chat/request POST /chat/request This endpoint is used to receive chat request from user through API and return the answer. # Introduction Source: https://docs.pawa-ai.com/api-reference/endpoint/documents/introduction The Pawa AI Documents API lets you parse or extract any contents from files and documents. This include getting contents from audio, images, text, pdf, docx, excel, ppt. ## What You Can Do with: * **Parsing Documents** → Upload and parse documents. *** ## Parsing Models includes * **Pawa Parsing** → Structured extraction and data understanding for unstructured text, enabling automation and insights. *** # Parse Documents Source: https://docs.pawa-ai.com/api-reference/endpoint/documents/parse POST /documents/parse This endpoint used to parse the documents and extract text from them. # Introduction Source: https://docs.pawa-ai.com/api-reference/endpoint/models/introduction Pawa AI model includes powerful small language models in language, voice, audio, multimodal, embeddings, parsing etc... such as Pawa Ember and Pawa Blaze that supports swahili, english and other African languages. Our ecosystem is designed to support innovation at every level, while reduce cost of AI to almost $0. ## Introducing Pawa Blaze We're thrilled to introduce Pawa Blaze, our latest advanced small language model with reasoning, agentic, multimodal, knowledge-heavy tasks and optimized for multilingual understanding and long-context applications. ### Modalities Text, Image → Text ### Context window 1M ### Features Low cost Multilingual Reasoning Tools calling Test model Here, you’ll find detailed information about model capabilities, inputs/outputs, supported use cases, and examples to help you get started quickly. Our model family includes: * **Pawa Ember** → A smaller, faster small language model(SLM) designed for efficiency, real-time interaction, and lightweight deployments. * **Pawa Blaze** → A powerful small language model (SLM) optimized for reasoning, complex generation, multimodal, tools understanding, agentic workflow, and advanced knowledge tasks. * **Pawa Text-to-Speech (TTS)** → Natural and expressive voice generation for conversational AI, narration, and accessibility. * **Pawa Speech-to-Text (STT)** → Accurate and scalable speech recognition for transcriptions, voice commands, and real-time interaction. * **Pawa Embeddings** → High-quality vector representations for semantic search, clustering, and personalization. * **Pawa Parsing** → Structured extraction and data understanding for unstructured text, enabling automation and insights. # Get All Models Source: https://docs.pawa-ai.com/api-reference/endpoint/models/list GET /models This endpoint used to get all the models registered in the Pawa AI Platform with pagination, search, and filtering support. # Get A Single Model Source: https://docs.pawa-ai.com/api-reference/endpoint/models/single GET /models/{id} This endpoint used to get the model by id in the Pawa AI Platform. # Introduction Source: https://docs.pawa-ai.com/api-reference/endpoint/storage/introduction The Pawa AI Knowledge Base API lets you create, manage, and query documents for agents, RAG, and semantic search applications. ## What You Can Do with: * **Create KBs** → Organize documents for your project or domain. * **Upload Documents** → Add PDFs, DOCX, TXT, or Markdown files. * **Update & Edit** → Keep your knowledge up-to-date. * **Delete KBs** → Remove outdated or irrelevant content. * **Query KBs** → Retrieve relevant entries for RAG or agent workflows. *** *** # Create Knowledge Base Source: https://docs.pawa-ai.com/api-reference/endpoint/storage/knowledge-base/create POST /store/knowledge-base This endpoint used to create the new knowledge base in the Pawa AI Platform. # Delete a Knowledge Base Source: https://docs.pawa-ai.com/api-reference/endpoint/storage/knowledge-base/delete DELETE /store/knowledge-base/{id} This endpoint used to delete the knowledge base by id. # Edit a Knowledge Base Source: https://docs.pawa-ai.com/api-reference/endpoint/storage/knowledge-base/edit PUT /store/knowledge-base/{id} This endpoint used to update the knowledge base in the Pawa AI Platform. # Get All Knowledge Bases Source: https://docs.pawa-ai.com/api-reference/endpoint/storage/knowledge-base/get-all GET /store/knowledge-base This endpoint used to get all the knowledge bases registered in the Pawa AI Platform with pagination, search, and filtering support. # Get Files of KB Source: https://docs.pawa-ai.com/api-reference/endpoint/storage/knowledge-base/get-files GET /store/files/knowledge-base/{id} This endpoint used to list of files used by knowledge base id. # Get a Knowledge Base Source: https://docs.pawa-ai.com/api-reference/endpoint/storage/knowledge-base/get-single GET /store/knowledge-base/{id} This endpoint used to get the knowledge base by id in the Pawa AI Platform. # Semantic Retrieval Source: https://docs.pawa-ai.com/api-reference/endpoint/storage/knowledge-base/semantic-retrival POST /store/knowledge-base/semantic-retrieval This endpoint used to retrieve the relevant chunks of the knowledge base based on the user question in the Pawa AI Platform. # Create Workspace Source: https://docs.pawa-ai.com/api-reference/endpoint/transcribe/create-workspace POST /transcribe/workspace This endpoint is used to create a new workspace for the authenticated user. # Delete Transcription Source: https://docs.pawa-ai.com/api-reference/endpoint/transcribe/delete-transcription DELETE /transcribe/workspace/{id}/transcriptions/{transcriptionId} This endpoint is used to remove a specific transcription from a workspace. # Delete Workspace Source: https://docs.pawa-ai.com/api-reference/endpoint/transcribe/delete-workspace DELETE /transcribe/workspace/{id} This endpoint is used to delete a workspace and all its associated files. # Get Workspace Transcriptions Source: https://docs.pawa-ai.com/api-reference/endpoint/transcribe/get-transcriptions GET /transcribe/workspace/{id}/transcriptions This endpoint is used to retrieve all transcriptions belonging to a specific workspace with pagination support. # Get A Single Workspace Source: https://docs.pawa-ai.com/api-reference/endpoint/transcribe/get-workspace GET /transcribe/workspace/{id} This endpoint is used to retrieve a specific workspace by its ID. # Get All Workspaces Source: https://docs.pawa-ai.com/api-reference/endpoint/transcribe/get-workspaces GET /transcribe/workspace This endpoint is used to retrieve all workspaces created by the authenticated user. # Introduction Source: https://docs.pawa-ai.com/api-reference/endpoint/transcribe/introduction The Pawa AI Transcribe API lets you use an all-in-one transcription capabilities with unlimited audio and video processing. Convert audio and video to accurate text in seconds. ## Key Features: * **99.9% Accuracy** * **35+ Local Languages** * **Speaker Recognition** * **Unlimited Minutes** * **Private & Secure** *** *** # Update Transcription Source: https://docs.pawa-ai.com/api-reference/endpoint/transcribe/update-transcription PATCH /transcribe/workspace/{id}/transcriptions/{transcriptionId} This endpoint is used to update the transcript content of a specific transcription within a workspace. # Update Workspace Source: https://docs.pawa-ai.com/api-reference/endpoint/transcribe/update-workspace PUT /transcribe/workspace/{id} This endpoint is used to update the name of an existing workspace. # Upload Transcriptions Source: https://docs.pawa-ai.com/api-reference/endpoint/transcribe/upload-transcriptions POST /transcribe/workspace/{id}/transcriptions This endpoint is used to upload transcriptions to a specific workspace. # Create Embeddings Source: https://docs.pawa-ai.com/api-reference/endpoint/vectors/embeddings POST /vectors/embedding This endpoint used to create new custom embeddings for the given input text using the specified model. # Introduction Source: https://docs.pawa-ai.com/api-reference/endpoint/vectors/introduction The Pawa AI Vectors API lets you create a high-quality embeddings for languages that can be used for retrieval-augmented generation (RAG), semantic search, personalization, and knowledge grounding. ## What You Can Do with: * **Create Embeddings** → Get a vector representations of your data with your documents. *** ## Embeddings Models includes * **Pawa Embeddings** → High-quality vector representations for semantic search, clustering, and personalization. *** # Introduction Source: https://docs.pawa-ai.com/api-reference/endpoint/voice/introduction Pawa AI provides powerful voice capabilities with Text-to-Speech (TTS) and Speech-to-Text (STT), enabling natural, real-time, multilingual voice interaction for your applications. ## Text-to-Speech (TTS) > Convert text responses into natural, expressive speech across multiple languages and voices.\ > Ideal for **voice assistants, narration, accessibility, and interactive experiences**. **Features:** * Expressive, natural voices * Low-latency streaming * Multilingual support (Swahili, English, and other African languages) * Flexible output formats (MP3, WAV, streaming response) ## Speech-to-Text (STT) > Accurately transcribe audio into text in real-time or batch mode. > Perfect for meeting notes, captions, accessibility, and voice commands. **Features:** * High transcription accuracy * Real-time streaming or async batch processing * Multilingual speech recognition (optimized for African accents + Swahili) * Works with noisy environments ## Voice models include: * **Pawa Text-to-Speech (TTS)** → Natural, expressive multilingual voices (supports Swahili, English, and African accents). Optimized for **real-time streaming** and **low latency**. * **Pawa Speech-to-Text (STT)** → Accurate, multilingual speech recognition tuned for African languages and noisy environments. Supports **streaming transcription** and **batch mode**. # Convert Speech to text Source: https://docs.pawa-ai.com/api-reference/endpoint/voice/speech-to-text POST /voice/speech-to-text This endpoint converts a list files into text for each of one # Convert Text to speech Source: https://docs.pawa-ai.com/api-reference/endpoint/voice/text-to-speech POST /voice/text-to-speech This endpoint converts text into streaming audio. It does streaming automatically so consider sending request as events streams, Server-Sent Events (SSE) or any other streaming method. # Introduction Source: https://docs.pawa-ai.com/api-reference/introduction The Pawa AI APIs are a core component of our mission to empower organizations to build intelligent, AI-powered solutions with ease. They are designed to support teams of any size, providing robust integration capabilities that allow for customization and enable organizations to derive maximum value from Pawa AI. > [!NOTE] > > This section provides a detailed guide to help you understand how to use and integrate with our APIs. > > For additional information, refer to the [documentation](/documentation) page. The Pawa AI API Reference provides everything you need to build, test, and integrate with our services. Here, you’ll find detailed information on endpoints, authentication, request/response formats, and examples to help you get started quickly. ### Account payment types Pawa AI supports two account payment types: **Subscription** and **Pay as you go**. You can switch between them anytime without losing data. On a **Pay as you go** account, **every API request response includes usage** with **tokens in** (input) and **tokens out** (output), so you can track consumption against your credit balance. Learn more about plans, credit tiers, and usage rates on [Pricing](/learn-more/pricing). For how to switch payment types, see [Payment Type Switch](/learn-more/payment-type-switch). You can test our endpoints through: * **[Sandbox](https://builder.pawa-ai.com/dashboard?page=sandbox):** An end-to-end testing environment allowing you to safely experiment with Pawa AI APIs without impacting production systems. * **[Inline playground](/api-reference/endpoint/chat/request):** A convenient inline playground where you can quickly experiment and prototype with Pawa AI APIs directly within the documentation. * **[Postman](https://www.postman.com/):** Utilize Postman for robust API testing, detailed documentation exploration, and building automated workflows to interact with the Pawa AI APIs. * **[Python SDK](/python-sdk/introduction):** Official Python library for the Pawa AI API — install with `pip install pawa-ai`. See also [PyPI](https://pypi.org/project/pawa-ai/#description) and [GitHub](https://github.com/Sartify/pawa-ai-python). ### For quick start with our APIs you can view Blueprints chatbots. > [card] [Pawa AI APIs Blueprint Chatbot](https://github.com/Sartify/pawa-ai-blueprints-chatbots) > > Explore the full real world uses cases made by Pawa AI APIs on Github # Limits Source: https://docs.pawa-ai.com/api-reference/limits Pawa AI have put several limitations to ensure optimal performance and a positive experience on APIs for all users. This includes rate limits, storage limits, and others. ### 1. Rate Limits Pawa AI APIs implement rate limits to ensure fair usage and maintain system stability. These limits restrict the number of requests you can make within a specific timeframe. Exceeding these limits may result in temporary blocking of your API key. ### Why Rate Limits? Rate limits are a common practice for APIs, and they're put in place for several important reasons: * **Prevent Abuse & Misuse:** They protect against malicious actors flooding the API with requests to overload it or disrupt service. Pawa AI prevent this actions. * **Fair Access:** They ensure everyone has fair access to the API, preventing one user from consuming excessive resources and impacting others. * **Infrastructure Management:** They help us manage the overall load on our infrastructure, preventing performance issues and maintaining a consistent experience for all users. > [!NOTE] > > This guide covers Pawa AI's rate limits: how they work, common issues and solutions (with code examples), and how they automatically increase based on your usage tier. ### How Rate Limits work? Pawa AI measures the rate limits in RPM (request per minute) meaning you have a specific number of requests you can make each minute based on your current tier. For example, for the free tier you can send up to 5 requests per minute, if you send the next requests afterward and within the minute, the request will be discarded. Exceeding this limit results in a rate limiting error. ### Tiered Rate Limits Rate limits vary depending on your Pawa AI subscription tier. You can view the rate and usage limits for your tier under the limits section of your billing settings. If your spend on our API goes up, we recommend you to upgrade to the next tier. This usually results in an increase in rate limits across most models, storage and APIs. | Tier | Requests per Minute (RPM) | | - | - | | **Free** | 5 | | **Starter** | 50 | | **Pro** | 500 | | **Enterprise** | Unlimited | *Please note: These limits are subject to change.* You can monitor your current usage and remaining quota through the **[Usage Dashboard](https://builder.pawa-ai.com/dashboard?page=data)**. This dashboard provides real-time insights into your API consumption. ### Handling Rate Limit Errors If you exceed the rate limit, you'll receive an HTTP 429 "Too Many Requests" error. When this happens, please do the following: * **Wait:** The most straightforward solution is to wait for the rate limit window to reset. Usually after the one minute. * **Implement Exponential Backoff:** A more robust approach is to implement exponential backoff in your application. This means increasing the waiting time between retries after each failed attempt. This helps avoid overwhelming the API and improves reliability. > [!NOTE] > > Unsuccessful requests also do contribute to your per-minute limit, so continuously resending a request won’t work. **Using the Tenacity python library** ```python theme={null} import httpx from tenacity import retry, stop_after_attempt, wait_random_exponential API_URL = "https://api.pawa-ai.com/v1/chat/request" API_KEY = "PAWA_AI_API_KEY" headers = { "Authorization": f"Bearer {API_KEY}", "Content-Type": "application/json" } @retry(wait=wait_random_exponential(min=1, max=60), stop=stop_after_attempt(6)) def chat_with_tenacity(**kwargs): with httpx.Client() as client: response = client.post(API_URL, headers=headers, json=kwargs) response.raise_for_status() return response.json() if __name__ == "__main__": result = chat_with_tenacity( model="pawa-v1-ember-20240924", messages=[ { "role": "system", "content": [ {"type": "text", "text": "You are a TanzaBot, a helpful assistant who answers questions about Tanzania"} ] }, { "role": "user", "content": [ {"type": "text", "text": "What is the current president of Tanzania?"} ] } ], temperature=0.1, max_tokens=150, stream=False ) print(result) ``` **Using the backoff python library** ```python theme={null} import backoff import httpx API_URL = "https://api.pawa-ai.com/v1/chat/request" API_KEY = "PAWA_AI_API_KEY" headers = { "Authorization": f"Bearer {API_KEY}", "Content-Type": "application/json" } @backoff.on_exception(backoff.expo, httpx.RequestError, max_tries=5) def chat_with_backoff(**kwargs): with httpx.Client() as client: response = client.post(API_URL, headers=headers, json=kwargs) response.raise_for_status() return response.json() if __name__ == "__main__": result = chat_with_backoff( model="pawa-v1-ember-20240924", messages=[ { "role": "system", "content": [ { "type": "text", "text": "You are a TanzaBot, a helpful assistant who answers questions about Tanzania" } ] }, { "role": "user", "content": [ { "type": "text", "text": "What is the current president of Tanzania?" } ] } ], temperature=0.1, max_tokens=150, stream=False ) print(result) ``` ⚠️ Disclaimer: Pawa AI makes no guarantees regarding the efficiency of those solutions for rate limit control. It is intended as a starting point to help you build your own implementation. ### 2. Storage Limits (Knowledge Base) Pawa AI lets you build and manage your own **knowledge base** by uploading files, documents, and have embeddings into our vector store. To ensure fair use and system performance, we apply storage limits based on your subscription tier. These limits define how much data you can store in our vector store database. Once you exceed the quota, you won’t be able to upload more files and build embeddings until you either free up space or upgrade to a higher tier. ### How Knowledge Base Storage Limits Work When you build a knowledge base through **[our storage platform](https://builder.pawa-ai.com/dashboard?page=storage)** you upload content (e.g., PDFs, text files, CSVs, Images, Audio), Pawa AI processes and stores them in the **vector database**. * If your usage is within your tier’s limit, uploads succeed as normal. * If you exceed the limit, new uploads will be rejected with a Storage quota exceeded error. Example: In the ree Tier, you can store up to 1 GB of knowledge base content. Attempting to upload a new file beyond this limit will fail until you delete existing files or upgrade. ### Tiered Storage Limits | Tier | Knowledge Base Storage | | - | - | | **Free** | 1 GB | | **Starter** | 5 GB | | **Pro** | 50 GB | | **Enterprise** | Unlimited | *Enterprise plans can request custom allocations to handle large-scale datasets.* You can track how much storage you’ve used in the **[Usage Dashboard](https://builder.pawa-ai.com/dashboard?page=data)**, which shows real-time usage and remaining space. ### 3. Other limits based on tier type apply to * Supports (custom vs community) * Security checking (basic & advanced) * Intergrations (free or no assistance at all) * Fine-tuning(no vs yes) * Observality(no vs yes), and etc... # Agentic RAG Source: https://docs.pawa-ai.com/capabilities/agentic-rag Pawa AI APIs enable you to build advanced Agentic Retrieval-Augmented Generation (RAG) systems out of the box—simplifying complexity, reducing cost, and delivering smarter results. Before diving into Agentic RAG, it’s helpful to first understand the fundamentals of [RAG](https://docs.pawa-ai.com/capabilities/rag). Traditional RAG typically requires generating **embeddings** for every request you send to a language model. While effective, this approach can be **time-consuming**, **limited** and often introduces **additional costs**, especially when using other LLM providers. > **Traditional RAG Example** ![Agentic RAG Flow](https://mintlify.s3.us-west-1.amazonaws.com/sartifycoltd/images/rag.png) Recent advancements in language models have introduced the concept of **Agents**. > An **Agent** is an AI-driven system that leverages reasoning, planning, and tool use to achieve user-defined objectives. By combining decision-making with execution, an agent can dynamically determine the best path to solve a task. In the context of RAG, this means that instead of always performing embeddings and semantic retrieval for every query even of those that does not require it, **Pawa AI implements Agentic RAG**. Our models can now intelligently **reason about the request** and decide whether: * The query can be answered directly by the model, **without retrieval**, use available tools supplied such as `web_search_tool` or * Retrieval is required, in which case the model automatically calls the `RAG tool`, fetches the relevant knowledge, and generates an accurate, context-grounded response, and doing this in muilt-steps if required. In an enterprise setting where data sources are diverse with non-homogeneous formats this approach becomes even more important. For example, the data sources could be a mix of structured, semi-structured and unstructured data. This is where agentic RAG comes into play. This **agentic approach** reduces unnecessary computation, lowers cost, and improves efficiency—all while delivering reliable answers powered by your data. ### Agentic Models in Pawa AI. Currently we have one agentic model: * **pawa-v1-blaze-20250318**: Our smaller version language that is Fast, visual, tools & most intelligent. #### Implementing Agentic RAG With Pawa AI in Your System To implement Agentic RAG, you first need a **Knowledge Base (KB)** — think of it as your private reference library for the Pawa model. Traditionally, creating a KB involves setting up complex pipelines for **extraction, chunking, embeddings, and retrieval**. Each step needs to be efficient; otherwise, you risk retrieving irrelevant sources and producing incorrect answers. With Pawa AI, we’ve simplified this process. Our platform automatically handles extraction, chunking, and embedding using our models. Once complete, you’ll receive a **Knowledge Base Reference ID**, which you can pass as a parameter during chat requests. The Pawa API then incorporates your private reference source using **semantic retrieval**, ensuring that the model answers accurately based on your custom data. *** #### Step 1: Create a Pawa AI Account * Sign up for a Pawa AI account. * Verify your email and log in as a **Builder**. #### Step 2: Create a Knowledge Base * Navigate to the **Storage** page in your Builder Dashboard. * Click **Create Vector Store** under the Vectors section. * Upload files in supported formats: `.pdf`, `.docx`, `.txt`, `.mp3`, `.wav`, `.pptx`, `.xlsx`, `.png`, `.jpg`, or provide URLs to your websites or online data. * Copy the generated **Knowledge Base Reference ID**. Eg. `kb-930d251e-8a8b-4ba9-bae1-5fceb47bd654` *** #### Step 3: Make Your RAG-Based API Request * Use the Knowledge Base Reference ID in your chat API request. * Make sure the model is always `pawa-v1-blaze-20250318`. * Send the knowledge base as `isMust: False` * You can optional send tools, or combining reasoning. * The model will decide either to answer normally or retrieve relevant information from your KB to generate grounded, context-aware responses. ```bash theme={null} curl --request POST \ --url https://api.pawa-ai.com/v1/chat/request \ --header "Authorization: Bearer $PAWA_AI_API_KEY" \ --header 'Content-Type: application/json' \ --data '{ "messages": [ { "role": "user", "content": [ { "type": "text", "text": "What was the last years sales of the company?" } ] }] "knowledgeBase": { "kbReferenceId": "kb-930d251e-8a8b-4ba9-bae1-5fceb47bd654", "isMust": "False" }}' ``` ### Example Response demonstrating Agentic RAG based chat ```bash theme={null} { "success": true, "message": "Chat request processed successfully", "data": { "request": [ { "finish_reason": "stop", "message": { "role": "assistant", "content": "At Pawa AI, the last year sales was about 400K$ ARR, do you have any question i can help with?" }, "matched_stop": 128001 } ], "created": "2025-09-09", "model": "pawa-v1-ember-20240924", "object": "chat.request" } } ``` > So this saves cost, and at ease. With this capability you don’t have to worry about building complex retrieval pipelines or managing embeddings yourself, you wont be charged for embeddings and you will reduce latency. Pawa AI handles the heavy lifting, letting you focus on integrating your data and delivering accurate, context-aware responses to your users. # Audio & Transcription Source: https://docs.pawa-ai.com/capabilities/audio-transcription Pawa AI APIs provide seamless audio `input and output capabilities` — `Speech-to-Text (STT)` and `Text-to-Speech (TTS)`. These enable models to chat, speak, and understand audio directly, supporting use cases like voice assistants, transcription, and audio-enhanced knowledge bases. > **Text-to-Speech (TTS) & Speech-to-Text (STT) Examples with Pawa AI** ![Audio & Transcription with Pawa AI](https://mintcdn.com/sartifycoltd/h3QvoufTX15l3Mnz/images/speech%20to%20text%20-%20text%20to%20speech.png?fit=max\&auto=format\&n=h3QvoufTX15l3Mnz\&q=85\&s=166d645de6e89a181954222916578577) *** ### Text-to-Speech (TTS) **Text-to-Speech (TTS)** allows you to generate high-quality, natural-sounding speech directly from text.\ This capability is essential for building **voice-enabled applications**, making content accessible to wider audiences, and creating **immersive user experiences**. > [!NOTE] > > By default, our `tts api endpoint` implements streaming, so in your app you can directly use Server Side Event to get streaming of the audio back. If you dont use the SSE then the api will fallback to normal non sctreaming to wait for the full audio to be generated back give back answer. You can learn about streaming [here](/capabilities/streaming). ### Supported Languages For Text to Speech * `Swahili` * `English` #### Use Cases * **Voice assistants**: Let your chatbot respond with speech instead of text only. * **Learning platforms**: Automatically generate audio versions of documents, lessons, or Q\&A sessions. * **Accessibility tools**: Help users with visual impairments interact with your app through audio. * **Media & podcasts**: Generate narrations from written articles or blogs. #### Voice options The TTS endpoint provides 3 built‑in local voices to control how speech is rendered from text. This includes * `Ame` * `Liora` * `Ayana` #### Models with Text to speech Audio Capabilities * Pawa Text To Speech (`pawa-tts-v1-20250704`) with text to speech conversation. Example Playback Speech > Original Text: "Jina la jamhuri ya muungano wa Tanzania, ni nchi iliyopo Afrika ya Mashariki ndani ya ukanda wa maziwa makuu ya Afrika, imepakana na Uganda na Kenya upande wa kaskazini, Bahari ya Hindi upande wa mashariki, Msumbiji malawi na Zambia upande wa kusini, Congo, Burundi na Rwanda upande wa magharibi, eneo la Tanzania ni takribani kilometa za mraba 940 mb/h. Saa arobaini na dakika elfu 300, eneo linalokaliwa na maji ne asalimia 6.2 - Mlima Kilimanjaro - Mlima mrefu zaidi barani Afrika upo kaskazini mashariki wa Tanzania." #### Text to Speech Request Example ```bash theme={null} curl --request POST \ --url https://api.pawa-ai.com/v1/voice/text-to-speech \ --header "Authorization: Bearer $PAWA_AI_API_KEY" \ --header 'Content-Type: application/json' \ --data '{ "model": "pawa-tts-v1-20250704", "voice": "ame", "max_tokens": 65536, "temperature": 0.5, "top_p": 0.95, "text": "Hello, welcome to Pawa AI. Upgrade now to enjoy Unlimited access to advanced AI" "repetition_penalty": 1.1 }' \ --output speech.mp3 ``` Check the audio file saved in current directory, open it to play and listen to generated audio. ### Speech-to-Text (STT) **Speech-to-Text (STT)** converts audio into text with high accuracy. With optional `speaker identity`, `timestamps`.\ This is powerful for **transcription, audio search, summarization, and voice-enabled interfaces**. ### Supported Languages For Text to Speech * `Swahili` * `English` * `Luo` * `Meru` * `kamba` * `Hausa` * `Igbo` * `Yoruba` * `Zulu` * `Tswana` * `Nyakole` etc... #### Use Cases * **Meeting & call centers transcription**: Turn long discussions into structured notes. * **Customer service**: Convert call center conversations into searchable text. * **Education**: Transcribe lectures, podcasts, and webinars. * **Productivity**: Voice notes and dictation apps. #### Models with Speech to Text Audio Capabilities * Pawa Speech To Text (`pawa-stt-v1-20240701`) with audio input to text conversation. Original Playback Speech > Example Text: "Jina la jamhuri ya muungano wa Tanzania, ni nchi iliyopo Afrika ya Mashariki ndani ya ukanda wa maziwa makuu ya Afrika, imepakana na Uganda na Kenya upande wa kaskazini, Bahari ya Hindi upande wa mashariki, Msumbiji malawi na Zambia upande wa kusini, Congo, Burundi na Rwanda upande wa magharibi, eneo la Tanzania ni takribani kilometa za mraba 940 mb/h. Saa arobaini na dakika elfu 300, eneo linalokaliwa na maji ne asalimia 6.2 - Mlima Kilimanjaro - Mlima mrefu zaidi barani Afrika upo kaskazini mashariki wa Tanzania." #### Speech to Text Request `without Speaker Diarization` Example ```bash theme={null} curl --request POST \ --url https://api.pawa-ai.com/v1/voice/speech-to-text \ --header "Authorization: Bearer $PAWA_AI_API_KEY" \ --header 'Content-Type: multipart/form-data' \ --form files=@sartify_info2.wav \ --form model=pawa-stt-v1-20240701 \ --form language=English \ --form is_speaker_diarization=false ``` #### Example Response Without Speaker Diarization ```json theme={null} { "success": true, "message": "Audio transcribed succesfully", "data": { "transcriptions": [ { "filename": "hello.wav", "transcript": "okay let's break down the products certify has built so far here's a list based on available information hasto astory poll this is the flagship product it's an ai power document processing platform essentially it uses ai to understand and process documents likely automating tasks like data extraction classification and more astor astory to warried an ai powered educational tool designed to improve learning outcomes it likely provides personalized learning experiences tutoring assistance and other educational supports as says the power models these aren't a product per se but rather the underlying ai models that power their other products there are a suite of smaller specialized ai models focusing on african languages vision and audio think of them as the engine behind docipro and tutorai it's worth noting that satilfy is a relatively young company so their product line is still" } ] } } ``` Change `is_speaker_diarization` to `true` to enable speaker identity or diarization capability on the response #### Example Response With Speaker Diarization ```json theme={null} { "success": true, "message": "Audio transcribed succesfully", "data": { "transcriptions": [ { "filename": "hello.wav", "transcript": [ { "Start": 0, "End": 14.87, "Speaker": 0, "Content": "Okay, let's break down the products Certify has built so far. Here's a list based on available information. Astor Astoripo, this is their flagship product. It's an AI-powered document processing platform." }, { "Start": 14.9, "End": 24.61, "Speaker": 0, "Content": "Essentially, it uses AI to understand and process documents, likely automating tasks like data extraction, classification, and more." }, { "Start": 24.87, "End": 38.81, "Speaker": 0, "Content": "As well as Certifiturai, an AI-powered educational tool designed to improve learning outcomes. It likely provides personalized learning experiences, tutoring assistance, and other educational sup-" }, { "Start": 39.05, "End": 47.55, "Speaker": 0, "Content": "As such, as we power models, we aren't a product per se, but rather the underlying AI models that power the other products." }, { "Start": 47.67, "End": 65.76, "Speaker": 0, "Content": "There are a suite of smaller specialized AI models focusing on African languages, vision, and audio. Think of them as the engine behind Docipro and TutorAI. It's worth noting that Certify is a relatively young company, so their product line is still evolving." } ] } ] } } ``` You can upload up to 10 files of types `audio/mp3`, `audio/mpeg`, audio/x-mp3, `audio/wav`, `audio/wave`, `audio/x-wav`, `audio/x-pn-wav`, `audio/aac`, `audio/m4a`, `audio/x-m4a`, `audio/x-mp4`, `audio/ogg`, `audio/opus`, `audio/x-ms-wma`, `audio/wma` with each of less `500MB`. The server runs in batch mode of 5 files default. # Chat Requests Source: https://docs.pawa-ai.com/capabilities/chat-and-text-generation With Pawa AI APIs you can use our models that has been fine-tuned to follow instructions and respond to natural language prompts through chat using prompt. Chat requests includes anything from summarizing articles, generating creative writing, answering questions, providing customer support, to assisting with coding tasks in prompts. A **prompt** is the input you provide to the model. It can take various forms, such as asking a question, giving an instruction, or providing a few examples of a task you want the model to perform. Based on this input, the model generates a text output as a response. The **[Chat request API](/api-reference/endpoint/chat/request?playground=open)** accepts a list of chat messages as input and generates a response. For request messages, send `"content"` as a list of typed content blocks, even for plain text. A text-only message should use this shape: `"content": [{ "type": "text", "text": "Your message here" }]`. The response is returned as a new chat message with the role `"assistant"`, and response `"content"` may be returned as a string. *** ### A Basic Chat Request Example ```bash theme={null} curl --request POST \ --url https://api.pawa-ai.com/v1/chat/request \ --header "Authorization: Bearer $PAWA_AI_API_KEY" \ --header 'Content-Type: application/json' \ --data '{ "model": "pawa-v1-ember-20240924", "messages": [ { "role": "system", "content": [ { "type": "text", "text": "You are a TanzaBot, a helpful AI assistant for answering questions about Tanzania" } ] }, { "role": "user", "content": [ { "type": "text", "text": "Hello what is top three attractions in Tanzania, that i should visit?" } ] } ]}' ``` ### Sample Response Example ```bash theme={null} { "success": true, "message": "Chat request processed successfully", "data": { "request": [ { "finish_reason": "stop", "message": { "role": "assistant", "content": "1. Serengeti National Park: Known for its vast plains, the Great Migration, and diverse wildlife, Serengeti is a must-visit for nature lovers.\n\n2. Ngorongoro Crater: A UNESCO World Heritage Site, this crater is home to the Ngorongoro Conservation Area, offering a unique blend of wildlife, culture, and geology.\n\n3. Kilimanjaro National Park: The highest mountain in Africa, Kilimanjaro offers a challenging trekking experience and stunning views from the summit." }, "matched_stop": 128001 } ], "created": "2025-09-09", "model": "pawa-v1-ember-20240924", "object": "chat.request", "usage": { "tokens_in": 42, "tokens_out": 128 } } } ``` > [!NOTE] > > **Pay as you go accounts:** Every chat request response includes a **usage** object with **tokens in** (input) and **tokens out** (output) for that request, so you can track consumption against your credit balance. See [Pricing](/learn-more/pricing) for rates. > Finish reason can be of `stop` means the generation endeded, or `tool` means tool was called instead, or `cancelled` if the generation was aborted. You can use this to see the reason behind the event occured during the generation, forexample when request has a `tool calling` you can use it to detect and process that request. ### Chat Messages Chat messages (messages) are a collection of prompts or messages, with each message having a specific role assigned to it, such as **system**, **user**, **assistant**, or **tool**. A **system message** is an optional message that sets the behavior and context for an AI assistant in a conversation, such as modifying its personality or providing specific instructions. A system message can include task instructions, personality traits, contextual information, creativity constraints, and other relevant guidelines to help the AI better understand and respond to the user's input.\ See the API reference for explanations on how to set up a custom system prompt. A **user message** is a message sent from the perspective of the human in a conversation with an AI assistant. It typically provides a request, question, or comment that the AI assistant should respond to. User prompts allow the human to initiate and guide the conversation, and they can be used to request information, ask for help, provide feedback, or engage in other types of interaction with the AI. An **assistant message** is a message sent by the AI assistant back to the user. It is usually meant to reply to a previous user message by following its instructions, but you can also find it at the beginning of a conversation, for example to greet the user. A **tool message** only appears in the context of function calling. It is used at the final response formulation step when the model has to format the tool call's output for the user.\ To learn more about function calling, see the guide. *** ### Message Role Orders Required Our message role ordering follows the alternate structure — you **cannot send two consecutive messages with the same role**.\ If you need to add additional context to a role, include it inside the `content` list instead of repeating the role. You can mix **system**, **user**, or **assistant** roles in alternate order for your conversation context. *** #### Example Valid Messages ```json theme={null} [ {"role": "system", "content": [{"type": "text", "text": "..."}]}, {"role": "user", "content": [{"type": "text", "text": "..."}]}, {"role": "assistant", "content": [{"type": "text", "text": "..."}]}, {"role": "user", "content": [{"type": "text", "text": "..."}]} ] ``` #### Invalid: Plain String Content ```json theme={null} [ {"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Hello"} ] ``` #### Invalid: Consecutive Messages With the Same Role ```json theme={null} [ {"role": "system", "content": [{"type": "text", "text": "..."}]}, {"role": "user", "content": [{"type": "text", "text": "..."}]}, {"role": "user", "content": [{"type": "text", "text": "..."}]}, {"role": "assistant", "content": [{"type": "text", "text": "..."}]} ] ``` #### Correct Way to Add Context to the Same Role ```json theme={null} [ {"role": "system", "content": [ { "type": "text", "text": "You are a helpful assistant." }, { "type": "text", "text": "Answer briefly." }, { "type": "text", "text": "Use Swahili when the user writes in Swahili." } ]}, {"role": "user", "content": [{"type": "text", "text": "..."}]}, {"role": "assistant", "content": [{"type": "text", "text": "..."}]} ] ``` ### Stop Generation Unlike to other providers, our **[Chat request API](/api-reference/endpoint/chat/request?playground=open)** has built-in aborting generation mechanism in nature that you can send signal in your front-end to abort the generation anytime. Please check examples front-end code in typescript using `AbortSignal`. # Documents Parsing Source: https://docs.pawa-ai.com/capabilities/documents-parsing Pawa AI offers enterprise-level document processing, combining cutting-edge OCR technology with advanced structured data extraction from any files such as images, audio, pdfs, docx, html, pptsx, xlsx, etc...Experience faster processing speeds, unparalleled accuracy, and cost-effective solutions, all scalable to meet your needs. Pawa AI Document Parsing extracts text, tables, and structured data from various document formats. Perfect for **digitizing paper documents**, **processing forms**, and **building document analysis workflows**. Unlock the full potential of your documents with our multilingual support, annotations and adaptable workflows for all document types, enabling you to extract, comprehend, and analyze information with ease. > **Document Parsing Example** ![Document Parsing Example](https://mintcdn.com/sartifycoltd/h3QvoufTX15l3Mnz/images/Document%20understanding.png?fit=max\&auto=format\&n=h3QvoufTX15l3Mnz\&q=85\&s=db40d7d2ea7527ae31c5dfb3c1982925) ### Parsing Based Models in Pawa AI. Currently we have one parsing model, full advanced, OCR built-in: * **pawa-v1-parser-20250809**: Structured extraction and data understanding for unstructured text, enabling automation and insights. ## Some Use Cases of Our Document Parsing API 📄 **Invoice Processing**Extract vendor details, amounts, dates, and line items from invoices for automated accounting. 📋 **Form Digitization**Convert paper forms into structured data for databases and workflow automation. 📊 **Report Analysis**Extract tables, charts, and key metrics from business reports and presentations. 📚 **Knowledge Base**Process documents for searchable knowledge bases and document management systems. 📝 **Contract Analysis**Extract key terms, dates, and clauses from legal documents and contracts. 🏥 **Medical Records**Process patient forms, prescriptions, and medical reports for digital health systems. ### Supported Formats Pawa AI can parse and understand a wide range of formats, including: * **PDFs** * **DOCX** * **Excel (XLSX)** * **PowerPoint (PPTX)** * **Images (PNG)** * **Audio files** * **Web links / HTML** ### Documents Parsing Request Example ```bash theme={null} curl --request POST \ --url https://api.pawa-ai.com/v1/documents/parse \ --header "Authorization: Bearer $PAWA_AI_API_KEY" \ --header 'Content-Type: multipart/form-data' \ --form model=pawa-v1-parser-20250809 \ --form documents=@example-file ``` ### Response format example ```json theme={null} { "success": true, "message": "Documents parsed successfully", "data": [ { "fileName": "file.pdf", "fileType": "application/pdf", "fileSize": 123456, "content": "This is the content of the document." } ] } ``` ### Use Chat Request to get Structured Data After Extraction After parsing a document, use Pawa AI's chat models to extract structured data, answer questions, or analyze the content. To learn more about structured data, visit [here](/capabilities/structured). #### Example to get structured request ```bash theme={null} # 1. Parse the invoice curl --request POST \ --url https://api.pawa-ai.com/v1/documents/parse \ --header "Authorization: Bearer $PAWA_AI_API_KEY" \ --header 'Content-Type: multipart/form-data' \ --form model=pawa-v1-parser-20250809 \ --form documents=@example-file # 2. Extract structured data using chat curl https://api.pawa-ai.com/v1/chat/request \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $PAWA_AI_API_KEY" \ -d '{ "model": "pawa-v1-blaze-20250318", "messages": [ { "role": "system", "content": [ { "type": "text", "text": "Extract invoice data and return as JSON with fields, as given in the response_format" } ] }, { "role": "user", "content": [ { "type": "text", "text": "Extract data from this invoice is :\n\n'here put the actual textual data extracted.........'" } ] } ], "response_format": { "type": "json_schema", "json_schema": { "name": "invoice_extractor", "strict": true, "schema": { "type": "object", "properties": { "reference_id": { "type": "string", "description":"The id of the invoice", "pattern": "^\\d+$" } }, "required": [ "reference_id" ], "additionalProperties": false } } } }' ``` ### Best Practices for Structured Extraction * **Be specific in prompts**: Clearly define the JSON schema you want * **Use examples**: Show the model the format you expect * **Validate output**: Always parse and validate the JSON response * **Handle errors**: Check for malformed JSON and retry if needed * **Batch processing**: Process multiple documents with the same extraction template ### Limits * **File size**: Maximum 15MB per document * **Rate limits**: Based on your subscription plan # Embeddings Source: https://docs.pawa-ai.com/capabilities/embeddings Pawa AI can create the higher‑quality vector representations of text that capture the semantic meaning of paragraphs through their position in a high-dimensional vector space. Embeddings convert text into numeric vectors that capture semantic meaning. Texts with similar meaning land close together in vector space, enabling fast similarity search and downstream tasks like RAG, recommendations, and clustering. > **Embeddings Example** ![Web Browsing Example](https://mintcdn.com/sartifycoltd/h3QvoufTX15l3Mnz/images/embedding.png?fit=max\&auto=format\&n=h3QvoufTX15l3Mnz\&q=85\&s=5a00b6bd2c824a1c729acd7cd06b1f9a) ### What you can build * Semantic search and retrieval‑augmented generation (where results are ranked by relevance to a query string) * Recommendations (where items with related text strings are recommended) * Deduplication and near‑duplicate detection * Document classification and intent matching * Classification (where text strings are classified by their most similar label) * Clustering (where text strings are grouped by similarity) * Anomaly detection (where outliers with little relatedness are identified) * Semantic code or knowledge base search * Diversity measurement (where similarity distributions are analyzed) ### Embeddings Based Models in Pawa AI. Currently we have one vision model: * **pawa-embeddings-v1-20241001**: High-quality vector representations for semantic search, clustering, and personalization. ### Create embeddings with Pawa AI To get an embedding, send your text string to the embeddings API endpoint along with the embedding model name: ```bash theme={null} curl --request POST \ --url https://api.pawa-ai.com/v1/vectors/embedding \ --header "Authorization: Bearer $PAWA_AI_API_KEY" \ --header 'Content-Type: application/json' \ --data '{ "model": "pawa-embeddings-v1-20241001", "input": [ "Africa leads the next wave of AI innovation.", "Tanzania's tech ecosystem is growing fast." ] }' ``` ### The example of embedding response The response contains the embedding vector (list of floating point numbers) along with some additional metadata. You can extract the embedding vector, save it in a vector database, and use for many different use cases. ``` { "success": true, "message": "Embeddings created successfully", "data": { "embeddings": [ [ 0.0047908169, -0.0000800654, -0.0000212658, 0.0144227119, 0.0173993539, -0.0002167973 ], [ 0.0047908169, -0.0000800654, -0.0000212658, 0.0144227119, 0.0173993539, -0.0002167973 ] ] } } ``` > [!NOTE] > > By default, the `pawa-embeddings-v1-20241001` gives the length of the embedding vector which is **4066**. ### Best practices * Chunk long documents (1024–2500 chars) with small overlaps (25-100) * Normalize text consistently at index and query time * Store embeddings in a vector database (pgvector, Milvus, Pinecone) with cosine similarity # Finetuning (beta) Source: https://docs.pawa-ai.com/capabilities/finetuning Customize Pawa AI models to your domain, brand, and data. Train chat and voice models with your own datasets for more accurate, personalized outputs. Finetuning lets you adapt **Pawa AI chat and voice models** with your own data, creating assistants and applications that reflect your **tone, terminology, and domain expertise**. This reduce cost and latency by using a small yet efficient fine-tuned domain focused model. By providing curated examples, you can improve response style, accuracy, and consistency beyond what prompt engineering alone can achieve. ### Benefits of Fine-tuning * Works significantly better than prompting * Typically works better than a larger model (faster and cheaper because it doesn't require a very long prompt) * Provides a better alignment with the task of interest because it has been specifically trained on these tasks * Can be used to teach new facts and information to the model (such as advanced tools or complicated workflows) ## Available Models For finetuning. **Chat Models** Personalize conversational behavior, domain-specific Q\&A, or task-specific reasoning. **Example**: Make a support bot respond in your brand’s tone or a tutor model explain math in Swahili. * **Pawa Ember** → A smaller, faster small language model(SLM) designed for efficiency, real-time interaction, and lightweight deployments. * **Pawa Blaze** → A powerful small language model (SLM) optimized for reasoning, complex generation, multimodal, tools understanding, agentic workflow, and advanced knowledge tasks. **Voice Models** Adapt speech synthesis to match accents, pronunciations, or specialized vocabulary.\ **Example**: Train a medical assistant to pronounce terms correctly or a local app to speak in regional dialects. * **Pawa Text-to-Speech (TTS)** → Natural and expressive voice generation for conversational AI, narration, and accessibility. * **Pawa Speech-to-Text (STT)** → Accurate and scalable speech recognition for transcriptions, voice commands, and real-time interaction. *** ## Use Cases 📚 **Education**Fine-tune models to explain concepts in simple terms, local languages, or curriculum-specific styles. 💼 **Enterprise Support**Customize responses to match company knowledge, policies, and preferred tone of voice. 🩺 **Healthcare**Train models to handle medical vocabulary for reports, dictations, and patient interactions. 🎙️ **Voice Applications**Adapt TTS models to better fit cultural pronunciation, product names, or personalized voices. *** ## Contact Us for Custom Fine-Tuning Solutions **Get in Touch** Looking for tailored fine-tuning solutions with Pawa AI? Our team can help you build custom models designed for your unique workflows and data. [Contact Us](https://api.whatsapp.com/send/?phone=255688067709\&text\&type=phone_number\&app_absent=0) # In Memory Chat Source: https://docs.pawa-ai.com/capabilities/in-memory-chat With Pawa AI APIs you can make your app or system remember previous conversations by processing the context of your request history. This can be achieved by providing **previous chat prompts and responses** to a new chat request, allowing the model to process your new request with the context in mind. *** ### Example Request: In-Memory Chat ```bash theme={null} curl --request POST \ --url https://api.pawa-ai.com/v1/chat/request \ --header "Authorization: Bearer $PAWA_AI_API_KEY" \ --header 'Content-Type: application/json' \ --data '{ "model": "pawa-v1-ember-20240924", "messages": [ { "role": "system", "content": [ { "type": "text", "text": "Your name is TanzaBot, a helpful assistant in answering questions about Tanzania." } ] }, { "role": "user", "content": [ { "type": "text", "text": "How?" } ] } ] "memoryChat":[ { "role": "user", "content": [ { "type": "text", "text": "Who is the president of Tanzania, currently?" } ] }, { "role": "assistant", "content": [ { "type": "text", "text": "The current president of Tanzania is Samia Suluhu Hassan." } ] }, ] }' ``` ### Example Response demonstrating in-memory chat ```bash theme={null} { "success": true, "message": "Chat request processed successfully", "data": { "request": [ { "finish_reason": "stop", "message": { "role": "assistant", "content": "Samia Suluhu Hassan became the president of Tanzania on March 19, 2021, following the death of her predecessor, John Pombe Magufuli. She was sworn in as the country's first female president and has since been recognized for her leadership and efforts to promote gender equality in Tanzania." }, "matched_stop": 128001 } ], "created": "2025-09-09", "model": "pawa-v1-ember-20240924", "object": "chat.request" } } ``` > With this capability in Pawa AI, you can build **context-aware assistants** that provide continuity across conversations, enabling more natural and human-like interactions. Instead of treating every request as isolated, your app can “remember” what was said earlier and respond accordingly, making the experience smoother for your users. # Knowledge Base Source: https://docs.pawa-ai.com/capabilities/knowledge-base Pawa AI Knowledge Base capability offers a managed, scalable vectors document store with semantic indexing and retrieval. Upload files, search by meaning, and power your innovative RAG in minutes. Pawa Knowledge Base is a managed content store that automatically indexes your documents for semantic search and retrieval-augmented generation (RAG). Upload files (PDF, DOCX, images, HTML, PPTX, XLSX, text) and query them with natural language in English or Swahili. You can create and update your knowledge base at any time. Explore the full list of endpoint workflows in the [API reference](/api-reference/endpoint/storage/introduction). Unlock the value of your documents by transforming them into **searchable, AI-ready knowledge**, enabling you to build grounded assistants that cite your own content. You can knowledge base in : * **Your agents chat request**. * **Your RAG pipelines**. > **Knowledge Base Example Using Pawa AI** ![Document Parsing Example](https://mintcdn.com/sartifycoltd/h3QvoufTX15l3Mnz/images/Document%20understanding-1.png?fit=max\&auto=format\&n=h3QvoufTX15l3Mnz\&q=85\&s=ebac84973a6bec733595bba9ca4b88db) ## Use Cases of Knowledge Base 📚 **Company Knowledge**Centralize policies, HR docs, and manuals for employees to query in natural language. ⚖️ **Legal Document Search**Retrieve clauses, dates, and rules from contracts and compliance files instantly. 🏥 **Healthcare Records**Index medical reports and prescriptions for secure semantic search in digital health systems. 📊 **Research & Reports**Store and retrieve insights from research papers, presentations, and business reports. ### Supported Formats Pawa AI can help build a knowledge base with a wide range of formats, including: * **PDFs** * **DOCX** * **Excel (XLSX)** * **PowerPoint (PPTX)** * **Images (PNG)** * **Audio files** * **Web links / HTML** *** ## Pawa AI Knowledge Base Workflow 1. **Create a knowledge base container, with reference files** 2. **Query with natural language using semantic retrieval** to retrieve top-K passages 3. **Feed semantic results into chat** for grounded RAG answers. 4. **Out of the box RAG request**, just pass the `knowledge_base_id` as parameter. *** ### Create a Knowledge Base, With multiple files. ```bash theme={null} curl --request POST \ --url https://api.pawa-ai.com/v1/store/knowledge-base \ --header "Authorization: Bearer $PAWA_AI_API_KEY" \ --header 'Content-Type: multipart/form-data' \ --form 'name=Pawa Knowledge Base' \ --form 'description=This is a sample knowledge base for Pawa.' \ --form knowledgeBase=@example-file ``` ### The Example Response ```json theme={null} { "success": true, "message": "Knowledge base created successfully", "data": { "id": 21, "name": "WCF Knowledge Base", "kbReferenceId": "kb-5d76835d-fe3e-4793-b0d6-f2e1a668eb5d", "description": "This is a knowledge base for WCF, it contains information about various concerns about Workers Compesation Fund., it is used to answer questions about WCF", "status": "ACTIVE", "createdAt": "2025-08-04T16:35:37.522Z", "updatedAt": "2025-08-04T16:35:37.522Z" } } ``` After creating the knowledge base, now you can anything with it, such as performing semantic retrieval, or sending your out-of-the-box RAG chat request. ### Semantic retrieval on Knowledge Base ```bash theme={null} curl --request POST \ --url https://api.pawa-ai.com/v1/store/knowledge-base/semantic-retrieval \ --header "Authorization: Bearer $PAWA_AI_API_KEY" \ --header 'Content-Type: application/json' \ --data '{ "knowledge_base_id": "21", "question_asked_by_user": "When WCF got started?" }' ``` ### Grounded answers (RAG) on Knowledge Base ```bash theme={null} curl --request POST \ --url https://api.pawa-ai.com/v1/chat/request \ --header "Authorization: Bearer $PAWA_AI_API_KEY" \ --header 'Content-Type: application/json' \ --data '{ "model": "pawa-v1-blaze-20250318", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "What was the last years sales of the company?" } ] }] "knowledgeBase": { "kbReferenceId": "kb-930d251e-8a8b-4ba9-bae1-5fceb47bd654", "isMust": "True" }}' ``` ### Troubleshooting * Low relevance: rephrase query; ensure documents are properly parsed * Missing files: confirm `knowledge_base_id` and upload success * Slow retrieval: reduce `top_k` or filter by metadata # RAG Source: https://docs.pawa-ai.com/capabilities/rag Pawa AI APIs make it easy to build Retrieval-Augmented Generation (RAG) systems out of the box, without unnecessary complexity or technical jargon and at low cost. ### RAG (Retrieval-Augmented Generation) Retrieval-Augmented Generation, or **RAG**, is a technique that combines the power of language models with your own data sources. This approach ensures that AI responses are both **relevant** and **accurate**, even when the model has not been trained on your specific data. > [card] [Build a RAG powered Apps, with Pawa AI](https://builder.pawa-ai.com/dashboard?page=home) > > Register to Pawa AI, create a knowledge by uploading documents of your favorite, copy the kb-reference-id and send RAG requests. #### Why RAG is Needed Language models are typically trained on large amounts of publicly available internet data. While powerful, this training has two main limitations: 1. **Hallucinations (false answers):**\ Models may generate responses that sound correct but are factually inaccurate, especially when asked about data outside their training set. 2. **Missing internal or private knowledge:**\ Your business or organization may rely on proprietary or domain-specific data that is not included in public training datasets.\ Examples: * Internal company policies * Proprietary research papers * Product manuals * Customer support knowledge base Without access to this data, the model cannot provide reliable answers. #### How RAG Solves This Problem RAG reduces hallucinations and improves accuracy by retrieving **relevant, trusted information** from your data sources at the time of the request, and then passing that context along with the query to the model. This means: * The model has the **latest, most relevant information** available. * Responses are **grounded in your data** instead of relying solely on general training. * You can maintain **accuracy and trust** in critical use cases. > **RAG enables you to enhance the model with your own knowledge base**, ensuring that it can answer domain-specific questions correctly and reliably. With Pawa AI APIs, you can implement RAG systems easily, without dealing with unnecessary complexity. #### Implementing RAG With Pawa AI in Your System To implement RAG, you first need a **Knowledge Base (KB)** — think of it as your private reference library for the Pawa model. Traditionally, creating a KB involves setting up complex pipelines for **extraction, chunking, embeddings, and retrieval**. Each step needs to be efficient; otherwise, you risk retrieving irrelevant sources and producing incorrect answers. With Pawa AI, we’ve simplified this process. Our platform automatically handles extraction, chunking, and embedding using our models. Once complete, you’ll receive a **Knowledge Base Reference ID**, which you can pass as a parameter during chat requests. The Pawa chat API then incorporates your private reference source using **semantic retrieval**, ensuring that the model answers accurately based on your custom data. *** #### Step 1: Create a Pawa AI Account * Sign up for a Pawa AI account. * Verify your email and log in as a **Builder**. #### Step 2: Create a Knowledge Base * Navigate to the **Storage** page in your Builder Dashboard. * Click **Create Vector Store** under the Vectors section. * Upload files in supported formats: `.pdf`, `.docx`, `.txt`, `.mp3`, `.wav`, `.pptx`, `.xlsx`, `.png`, `.jpg`, or provide URLs to your websites or online data. * Copy the generated **Knowledge Base Reference ID**. Eg. `kb-930d251e-8a8b-4ba9-bae1-5fceb47bd654` *** #### Step 3: Make Your RAG-Based API Request * Use the Knowledge Base Reference ID in your chat API request. * The model will retrieve relevant information from your KB to generate grounded, context-aware responses. ```bash theme={null} curl --request POST \ --url https://api.pawa-ai.com/v1/chat/request \ --header "Authorization: Bearer $PAWA_AI_API_KEY" \ --header 'Content-Type: application/json' \ --data '{ "model": "pawa-v1-blaze-20250318", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "What was the last years sales of the company?" } ] }] "knowledgeBase": { "kbReferenceId": "kb-930d251e-8a8b-4ba9-bae1-5fceb47bd654", "isMust": "True" }}' ``` ### Example Response demonstrating RAG based chat ```bash theme={null} { "success": true, "message": "Chat request processed successfully", "data": { "request": [ { "finish_reason": "stop", "message": { "role": "assistant", "content": "At Pawa AI, the last year sales was about 400K$ ARR, do you have any question i can help with?" }, "matched_stop": 128001 } ], "created": "2025-09-09", "model": "pawa-v1-ember-20240924", "object": "chat.request" } } ``` > So, with this capability you don’t have to worry about building complex retrieval pipelines or managing embeddings yourself. Pawa AI handles the heavy lifting, letting you focus on integrating your data and delivering accurate, context-aware responses to your users. # Reasoning Source: https://docs.pawa-ai.com/capabilities/reasoning Pawa AI help getting higher‑quality answers on complex tasks by enabling structured internal reasoning. Pawa AI Reasoning capabilities helps the model plan before answering. When enabled, the model allocates extra compute for internal planning and verification, which typically improves accuracy on multi‑step tasks like analysis, transformation, and decision support. > **Reasoning Example** ![Web Browsing Example](https://mintcdn.com/sartifycoltd/h3QvoufTX15l3Mnz/images/reasoning%20beta.png?fit=max\&auto=format\&n=h3QvoufTX15l3Mnz\&q=85\&s=67fab92e8beb6cba59bbe1b1b17906e2) Reasoning is the next step of CoT (Chain of Thought), naturally used to describe the logical steps generated by the model before reaching a conclusion. Reasoning strengthens this characteristic by going through training steps that encourage the model to generate chains of thought freely before producing the final answer. This allows models to explore the problem more profoundly and ultimately reach a better solution to the best of their ability by using extra compute time to generate more tokens and improve the answer—also described as `Test Time Computation.` ### When to use Reasoning > [!NOTE] > > Reasoning adds latency and may consume more tokens. Use only when the task benefits from deeper planning ### Reasoning Models in Pawa AI. Currently we have one reasoning model: * **pawa-v1-blaze-20250318**: A powerful small language model (SLM) optimized for reasoning, complex generation, multimodal, tools understanding, agentic workflow, and advanced knowledge tasks. ### Enable Reasoning Add the optional `reasoning` field to your request with an `effort` level. Effort levels (guidelines): * `low`: small planning budget; minimal latency increase * `medium` (default): balanced quality vs. latency * `high`: larger budget for complex tasks; highest latency #### Example Reasoning Request ```json theme={null} { "model": "pawa-v1-blaze-20250318", "reasoning": { "effort": "medium" }, "messages": [ { "role": "system", "content": [ { "type": "text", "text": "You are a careful analyst. Always verify numbers." } ] }, { "role": "user", "content": [ { "type": "text", "text": "Compare these quarterly figures and tell me the key trends: Q1: 124, Q2: 171, Q3: 163, Q4: 205." } ] } ] } ``` *** ### Examples Reasoning request in Pawa AI ```bash theme={null} curl --request POST \ --url https://api.pawa-ai.com/v1/chat/request \ --header "Authorization: Bearer $PAWA_AI_API_KEY" \ --header 'Content-Type: application/json' \ --data '{ "model": "pawa-v1-blaze-20250318", "reasoning": { "effort": "medium" }, "messages": [ { "role": "system", "content": [ { "type": "text", "text": "You are a careful analyst. Always verify numbers." } ] }, { "role": "user", "content": [ { "type": "text", "text": "Compare Q1=124, Q2=171, Q3=163, Q4=205 and summarize trends." } ] } ] }' ``` Example assistant output (shortened): ```text theme={null} Growth accelerates through the year. Largest jump Q1→Q2 (+47). Q3 dips slightly (−8), then Q4 reaches a new high (+42 over Q3). Overall upward trend. ``` *** ### Prompting tips * Give concrete goals and constraints ("compare, then list 3 key trends"). * Ask for a structured output (bullets or JSON) to reduce ambiguity. * Combine with Tools Calling for grounded answers (e.g., fetch data, then analyze). ### Performance & limits * Effort increases latency and token usage; prefer `low` for lightweight tasks. * Reasoning works with multimodal inputs and tool calls. * Streaming is supported; the final answer streams as usual. ### Troubleshooting * Output feels generic: raise `effort` or tighten instructions with examples. * Too slow: lower `effort` or trim the context to essential inputs. * Inconsistent numbers: add a system rule to verify calculations and show working as bullet points (not raw scratchpad). *** ### Example: Reasoning + Tools Calling Reason over live data by enabling reasoning and offering a retrieval tool. ```bash theme={null} curl --request POST \ --url https://api.pawa-ai.com/v1/chat/request \ --header "Authorization: Bearer $PAWA_AI_API_KEY" \ --header 'Content-Type: application/json' \ --data '{ "model": "pawa-v1-blaze-20250318", "reasoning": { "effort": "low" }, "tools": [{ "type": "pawa_tool", "pawa_tool": "web_search_tool" }], "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Summarize today\'s top Pawa AI news in 3 bullets for a CTO." } ] } ] }' ``` The model will plan, search, and produce a concise, CTO‑friendly summary. # Semantic Retrieval Source: https://docs.pawa-ai.com/capabilities/semantic-retrieval Pawa AI helps find relevant documents and information using natural language queries instead of exact keyword matches. Semantic retrieval finds relevant information by understanding the meaning behind your query, not just matching keywords. It uses embeddings to search through your knowledge base and return the most contextually relevant documents. Pawa AI make implement advanced mathematics that make it ease and accurate for you to search exactly the simmilar informations on the documents by just sending request to our api > **Semantic Retrieval Example** ![Semantic Retrieval Example](https://mintcdn.com/sartifycoltd/h3QvoufTX15l3Mnz/images/Semantic%20Retrieval.png?fit=max\&auto=format\&n=h3QvoufTX15l3Mnz\&q=85\&s=28a1d9a1b006b18149197beebc92ce64) ### How it works 1. **Index your documents** into Pawa AI's knowledge base 2. **Query with natural language** - ask questions in plain English or Swahili 3. **Get ranked results** - most relevant documents appear first based on semantic similarity 4. **Use in RAG** or elsewhere - feed retrieved context to chat models for grounded answers > [!NOTE] > > This is the **FREE** endpoint, not cost associated with it. After creating knowledge base with Pawa AI , you can use the retrieval endpoint to get the top-k relevant results, that can be used in your RAG or else use cases. ### What you can build * **Intelligent search** across documents, PDFs, and knowledge bases * **Question answering** systems that find relevant context * **Content recommendations** based on semantic similarity * **Document discovery** for large repositories * **Customer support** with instant access to relevant help articles ### Using Pawa AI Knowledge Base Pawa AI provides a managed knowledge base with built-in semantic retrieval. Upload your documents and query them naturally. To learn more knowledge base in Pawa AI, see [here](/capabilities/knowledge-base). #### 1. Create a Knowledge Base & Upload documents ```bash theme={null} curl --request POST \ --url https://api.pawa-ai.com/v1/store/knowledge-base \ --header "Authorization: Bearer $PAWA_AI_API_KEY" \ --header 'Content-Type: multipart/form-data' \ --form 'name=WCF Knowledgebase' \ --form 'description=This is the knowledgebase about WCF (Workers compensation fund) in Tanzania......etc...' \ --form knowledgeBase=@67f22be974bbec7dacd9cfdb.pdf ``` #### 2. Semantic Search across your knowledge ```bash theme={null} curl --request POST \ --url https://api.pawa-ai.com/v1/store/knowledge-base/semantic-retrieval \ --header "Authorization: Bearer $PAWA_AI_API_KEY" \ --header 'Content-Type: application/json' \ --data '{ "knowledge_base_id": "23", "question_asked_by_user": "When WCF got started?" }' ``` ### Response Format Example ```json theme={null} { "finalRelevantChunk": [ "Hello Pawa AI, I am the final relevant chunk you need" ], "filteredResults": [ { "id": 63, "knowledgeBaseId": 7, "documentName": "131.3-Visa-Requirements-Schengen-2021-05 (1) (1).pdf", "chunk": "and for the whole period of staying in the Schengen area. In order to have a flexible travel schedule it is suggested to issue the Insurance for a few days longer than the planned travel time...", "distance": 0.7506968916261936 }, { "id": 76, "knowledgeBaseId": 7, "documentName": "131.3-Visa-Requirements-Schengen-2021-05 (1) (1).pdf", "chunk": "plan agreed with the clinic. Medical health documentation issued by the applicant’s country of residence...", "distance": 0.7515738980069386 } ] ``` ### Integration retrieval with Chat Setup Combine semantic retrieval with chat models for powerful RAG applications: ```bash theme={null} # 1. Search for relevant context curl --request POST \ --url https://api.pawa-ai.com/v1/store/knowledge-base/semantic-retrieval \ --header "Authorization: Bearer $PAWA_AI_API_KEY" \ --header 'Content-Type: application/json' \ --data '{ "knowledge_base_id": "23", "question_asked_by_user": "When WCF got started?" }' # 2. Use retrieved context in chat curl https://api.pawa-ai.com/v1/chat/request \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $PAWA_AI_API_KEY" \ -d '{ "model": "pawa-v1-blaze-20250318", "messages": [ { "role": "system", "content": [ { "type": "text", "text": "Answer based on the provided context. If you cannot find the answer in the context, say so." } ] }, { "role": "user", "content": [ { "type": "text", "text": "Context: [retrieved documents]\n\nQuestion: How do I request time off?" } ] } ] }' ``` ### Best Practices * **Use descriptive queries**: "What are the steps to file a complaint?" vs "complaint" * **Optimize chunk size**: 500-1000 characters work well for most documents * **Filter by metadata**: Use file types, dates, or categories to narrow results * **Combine with keywords**: Use both semantic and keyword search for comprehensive results * **Monitor relevance scores**: Adjust top\_k based on score thresholds #### Multi-language Support Query in English or Swahili - Pawa AI understands both: ```bash theme={null} # English query "Find information about employee benefits" # Swahili query "Tafuta taarifa kuhusu faida za wafanyakazi" ``` ### Troubleshooting * **Low relevance scores**: Try rephrasing queries or checking document quality * **Missing results**: Ensure documents are properly indexed and not corrupted * **Slow responses**: Reduce top\_k or optimize document chunk sizes * **Language mismatch**: Query in the same language as your documents for best results ### Limits * Maximum query length: 1000 characters * Maximum documents per knowledge base: depends on your plan * Response time: typically under 2 seconds for most queries # Streaming Responses Source: https://docs.pawa-ai.com/capabilities/streaming Pawa AI enables continuous generation of partial results from the model within moments, even if the full generation takes longer. Streaming responses are beneficial for providing real-time updates, enhancing user interaction by allowing text to be displayed as it’s generated. This approach improves user experience by lowering perceived latency — letting text appear word by word, similar to typing, instead of a single block at the end. > **Streaming Example**\ > When you use **Pawa Chat** or the **Sandbox**, you’re already benefiting from streaming: the text flows in gradually, enhancing interactivity and responsiveness. Streaming responses use **Server-Sent Events (SSE)** to deliver partial outputs (deltas) in real time, instead of waiting for the entire generation to complete. To enable streaming, you must set `stream : true` in your chat request request, or agent chat request. But for the text to speech streaming is already done on our side so you change the request set-up to stream the response from our servers. ### Basic chat request with Streaming ```bash theme={null} curl --request POST \ --url https://api.pawa-ai.com/v1/chat/request \ --header "Authorization: Bearer $PAWA_AI_API_KEY" \ --header 'Content-Type: application/json' \ --data '{ "model": "pawa-v1-ember-20240924", "temperature": 0.1, "top_p": 0.95, "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Explain RAG in simple terms" } ] } ], "max_tokens": 4096, "frequency_penalty": 0.3, "presence_penalty": 0.3, "seed": 2024, "stream": true }' ``` ### Streaming Response Example You will receive the chunks of the response, been given out at a time, so so you should show that to the user in real-time. ```json theme={null} {"success":true,"message":"Chunk completions generated successfully","data":{"id":null,"conversationId":null,"feedback":null,"message":{"role":"assistant","content":"N"},"status":null,"createdAt":null,"updatedAt":null}} {"success":true,"message":"Chunk completions generated successfully","data":{"id":null,"conversationId":null,"feedback":null,"message":{"role":"assistant","content":"ait"},"status":null,"createdAt":null,"updatedAt":null}} {"success":true,"message":"Chunk completions generated successfully","data":{"id":null,"conversationId":null,"feedback":null,"message":{"role":"assistant","content":"wa"},"status":null,"createdAt":null,"updatedAt":null}} {"success":true,"message":"Chunk completions generated successfully","data":{"id":null,"conversationId":null,"feedback":null,"message":{"role":"assistant","content":" P"},"status":null,"createdAt":null,"updatedAt":null}} {"success":true,"message":"Chunk completions generated successfully","data":{"id":null,"conversationId":null,"feedback":null,"message":{"role":"assistant","content":"awa"},"status":null,"createdAt":null,"updatedAt":null}} ``` ### Tool calling request with Streaming. > In a tool-calling request, when the model decides to call one of your custom tools, it will **not stream the response**, even if `stream=true` is set.\ > This makes it easier to parse the tool response and then send a follow-up request. ```bash theme={null} curl --request POST \ --url https://api.pawa-ai.com/v1/chat/request \ --header "Authorization: Bearer $PAWA_AI_API_KEY" \ --header 'Content-Type: application/json' \ --data '{ "model": "pawa-v1-ember-20240924", "temperature": 0.1, "top_p": 0.95, "messages": [ { "role": "user", "content": [ { "type": "text", "text": "convert 45 USD to tsh" } ] } ], "tools": [ { "type": "function", "function": { "name": "convert_usd_to_tsh", "description": "Converts an amount in USD to Tanzanian Shillings.", "strict": true, "parameters": { "type": "object", "properties": { "amount_usd": { "description": "Amount in USD", "type": "number" } }, "required": [ "amount_usd" ], "additionalProperties": false } } } ], "max_tokens": 4096, "frequency_penalty": 0.3, "presence_penalty": 0.3, "seed": 2024, "stream": true }' ``` ### Response format example for tools calling stream ```json theme={null} { "success": true, "message": "Chat request processed successfully", "data": { "request": [ { "finish_reason": "tool_calls", "message": { "role": "assistant", "content": "In this request, the model has made a tool call, extract the tool call from the response, process it accordingly and return the result", "tool_calls": [ { "id": "call_01", "type": "function", "function": { "name": "convert_usd_to_tsh", "arguments": { "amount_usd": "45"} } } ] } } ], "created": "2025-09-25", "model": "pawa-v1-blaze-20250318", "object": "chat.request" } } ``` ### Error recovery When a streaming request is interrupted due to network issues, timeouts, or other errors, you can recover by resuming from where the stream was interrupted. This approach saves you from re-processing the entire response. #### The basic recovery strategy involves: * Capture the partial response: Save all content that was successfully received before the error occurred * Construct a continuation request: Create a new API request that includes the partial assistant response as the beginning of a new assistant message * Resume streaming: Continue receiving the rest of the response from where it was interrupted ​ # Structured Output Source: https://docs.pawa-ai.com/capabilities/structured Pawa AI structured output capabilities gives a way to define, request, and get JSON structured outputs directly from models for more reliable and machine-readable responses. When utilizing language models within a lengthy process, chain, or pipeline, it is often necessary for the outputs to adhere to a specific structured format. Structured output allows you to enforce predictable formats in model responses. Instead of free-form text, you can guide the model to return **JSON objects, schemas, or other structured data** that is easy to parse and integrate into applications. We offer a reliable method to obtain structured output in your desired format. Our system includes a built-in mode for JSON output. It lets you define schemas using tools like `Pydantic` or `Zod` to enforce data types, constraints, and structure. > **Structured Output Example** ![Document Parsing Example](https://mintcdn.com/sartifycoltd/h3QvoufTX15l3Mnz/images/structured%20output.png?fit=max\&auto=format\&n=h3QvoufTX15l3Mnz\&q=85\&s=9110d7ce9559c2bde9264ee414c983ba) ## Use Cases of Structured Output 📄 **Document Parsing**Extract and organize content from PDFs, Word files, and other unstructured documents into usable data. 🔎 **Entity Extraction**Identify and capture names, dates, amounts, and other key entities from raw text with precision. 📊 **Report Generation**Automatically generate structured reports from language model outputs for analytics and insights. 📝 **Resume Creation**Transform plain text into professional resumes or structured job application documents. > [!NOTE] > > **For JSON mode, it is essential to explicitly instruct the model in your prompt to output JSON and specify the desired format.** > > Custom structured outputs are more reliable and are recommended whenever possible. However, it is still advisable to iterate on your prompts. > Use JSON mode when more flexibility in the output is required while maintaining a JSON structure, and customize it if you want to enforce a clearer format to improve reliability. ## Why Use Structured Output? * Ensure consistent responses * Prevent parsing errors from free-form text * Enable integrations with APIs, databases, or other systems * Make automation workflows more reliable *** ## Sending Structured Output Request in Pawa AI. > Sending request in Pawa AI you simply state your desired output format, for now the default is in JSON mode. You request the model to return the request in the specific JSON format you described in `response_format` parameter. #### JSON Output You can specify a `response_format` when calling the model to enforce a JSON schema. #### Supported Schemas For structured output, the following schema types are supported: * **string** * **number** * **integer** * **float** * **object** * **array** * **boolean** * **enum** * **anyOf** #### Example: Resume Information Extraction with Structured Outputs A common use case for Structured Outputs is parsing resumes. Resumes contain structured data such as a candidate’s name, contact details, education, and work history — but extracting this data from raw text can be error-prone. Structured Outputs ensure that the extracted data always matches a predefined schema. *** ### Step 1: Defining the Schema ```python theme={null} from typing import List from datetime import date from pydantic import BaseModel, Field class Education(BaseModel): institution: str = Field(description="Name of the institution") degree: str = Field(description="Degree obtained") graduation_year: int = Field(description="Year of graduation") class Experience(BaseModel): company: str = Field(description="Company name") role: str = Field(description="Job title or role") start_date: date = Field(description="Job start date") end_date: date = Field(description="Job end date") responsibilities: List[str] = Field(description="List of key responsibilities") class Resume(BaseModel): full_name: str = Field(description="Candidate's full name") email: str = Field(description="Candidate's email address") phone: str = Field(description="Candidate's phone number") education: List[Education] = Field(description="List of education records") experience: List[Experience] = Field(description="List of professional experiences") skills: List[str] = Field(description="List of candidate's skills") ``` *** ### Step 2: System Prompt The system prompt instructs the model to extract structured resume data. ```text theme={null} Given a raw resume, carefully analyze the text and extract the relevant data into JSON format. ``` **Example Resume Text** ``` Name: Jane Doe Email: jane.doe@example.com Phone: +255 688067709 Education: - B.Sc. Computer Science, UDSM, 2020 Experience: - Software Engineer at TechCorp (Jan 2021 – Dec 2023) Responsibilities: Built APIs, Managed cloud infrastructure Skills: Python, JavaScript, AWS, Docker ``` *** ### Step 3: Example API Request to Pawa AI ```json theme={null} POST https://api.pawa-ai.com/v1/chat/request Content-Type: application/json { "model": "pawa-v1-ember-20240924", "messages": [ { "role": "system", "content": [ { "type": "text", "text": "You are an AI assistant that extracts resume information into structured JSON." } ] }, { "role": "user", "content": [ { "type": "text", "text": "Here is a resume: Name: Jane Doe, Email: jane.doe@example.com, Phone: +1 555-123-4567, Education: B.Sc. Computer Science, MIT, 2020, Experience: Software Engineer at TechCorp (Jan 2021 – Dec 2023), Skills: Python, JavaScript, AWS, Docker" } ] } ], "response_format": { "type": "json_schema", "json_schema": { "name": "resume_schema", "strict": true, "schema": { "type": "object", "properties": { "full_name": { "type": "string" }, "email": { "type": "string" }, "phone": { "type": "string" }, "education": { "type": "array", "items": { "type": "object", "properties": { "institution": { "type": "string" }, "degree": { "type": "string" }, "graduation_year": { "type": "integer" } }, "required": ["institution", "degree", "graduation_year"] } }, "experience": { "type": "array", "items": { "type": "object", "properties": { "company": { "type": "string" }, "role": { "type": "string" }, "start_date": { "type": "string", "format": "date" }, "end_date": { "type": "string", "format": "date" }, "responsibilities": { "type": "array", "items": { "type": "string" } } }, "required": ["company", "role", "start_date", "end_date"] } }, "skills": { "type": "array", "items": { "type": "string" } } }, "required": ["full_name", "email", "phone", "education", "experience", "skills"], "additionalProperties": false } } } } ``` *** ### Step 4: Example Type-Safe Output ```json theme={null} { "full_name": "Jane Doe", "email": "jane.doe@example.com", "phone": "+255 768067709", "education": [ { "institution": "UDSM", "degree": "B.Sc. Computer Science", "graduation_year": 2020 } ], "experience": [ { "company": "TechCorp", "role": "Software Engineer", "start_date": "2021-01-01", "end_date": "2023-12-31", "responsibilities": ["Built APIs", "Managed cloud infrastructure"] } ], "skills": ["Python", "JavaScript", "AWS", "Docker"] } ``` *** This shows how **Pawa AI** can enforce schemas to reliably extract structured resume data. # Tools Calling Source: https://docs.pawa-ai.com/capabilities/tools-calling Give the model actions using function call. Define function call with structured arguments, to make Pawa AI models communicate with external systems and access data outside their training data. ⚙️ Tools Calling Pawa AI Tools Calling lets you expose safe actions (functions/APIs) that the model can invoke with JSON arguments. Use it to search, query databases, fetch weather, run payments, or orchestrate internal services—while you stay in control of execution and access. > **Pawa AI Tool Calling Example** ![Web Browsing Example](https://mintcdn.com/sartifycoltd/h3QvoufTX15l3Mnz/images/Tools%20calling.png?fit=max\&auto=format\&n=h3QvoufTX15l3Mnz\&q=85\&s=f77cba55ec17d57d2f9b2a5f792e31e5) ### When to use Tools Calling ### Example use cases 🌦️ **Weather & Events**Get today's weather for a location, then craft user‑facing summaries. 🧾 **Account Ops**Access account details by user ID and enforce role‑based checks. ↩️ **Post‑order Actions**Issue refunds, re‑ship items, or create tickets after verification. ### Types of tools in Pawa AI ### Tools Calling Models in Pawa AI. Currently we have one tool calling model: * **pawa-v1-blaze-20250318**: A powerful small language model (SLM) optimized for reasoning, complex generation, multimodal, tools understanding, agentic workflow, and advanced knowledge tasks. #### Built‑in Tools Pawa provides platform tools you can enable without hosting your own code. Include them in the `tools` array with type `pawa_tool`. ```bash theme={null} curl https://api.pawa-ai.com/v1/chat/request \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $PAWA_AI_API_KEY" \ -d '{ "model": "pawa-v1-blaze-20250318", "tools": [ { "type": "pawa_tool", "pawa_tool": "web_search_tool" }, { "type": "pawa_tool", "pawa_tool": "pesa_pay_tool" } ], "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Find the latest news about Pawa AI and summarize it." } ] } ] }' ``` > [!NOTE] > > * Built‑in tools are executed by Pawa; you typically receive the final summarized answer without sending a second request. > * Some tools may accept options; consult the tool’s reference for supported fields. #### Custom Tools Custom tools are the tools you define on yourself and send through chat request. This normally has the following steps:
  1. Define the tool in JSON schema
  2. Make a request to the model with the tools it can call
  3. Receive a tool call from the model
  4. Execute your code with the provided arguments
  5. Send a second request including the tool result
  6. Receive the final response (or additional tool calls)
#### Step‑by‑step example on custom tools. 1\) Define the toolDescribe your function with JSON Schema. This shapes the arguments the model will produce. ```json theme={null} { "type": "function", "function": { "name": "get_weather", "description": "Get current weather by city", "parameters": { "type": "object", "properties": { "city": {"type": "string"}, "unit": {"type": "string", "enum": ["celsius","fahrenheit"], "default": "celsius"} }, "required": ["city"], "additionalProperties": false } } } ``` Each tool entry follows a consistent shape. The `function` object uses JSON Schema to precisely describe the arguments you expect. **type**: Must be `function` for custom tools. **function.name**: Short, unique identifier the model will reference in `tool_calls`. **strict** **function.description**: One sentence describing when to use the tool; critical for good tool selection. **function.parameters.type**: Usually `object` (a set of named arguments). **properties**: Map of argument names to schemas. Use `type`, `description`, and constraints (`enum`, `minimum`, `maxLength`, etc.). **required**: Array of argument names that must be present. **tool\_choice** **additionalProperties**: Set to `false` to prevent unexpected fields. Optional fields like **default**, **examples**, and **format** help the model produce better arguments. 2\) Send initial requestProvide the tool definition and a user question. The model decides whether to call the tool. ```bash theme={null} curl https://api.pawa-ai.com/v1/chat/request \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $PAWA_AI_API_KEY" \ -d '{ "model": "pawa-v1-blaze-20250318", "tools": [{ "type": "function", "function": { "name": "get_weather", "parameters": { "type": "object", "properties": { "city": {"type":"string"} } , "required": ["city"] } } }], "messages": [ { "role": "user", "content": [ { "type": "text", "text": "What is the weather in Dar es Salaam?" } ] } ] }' ``` 3\) Receive tool callThe assistant replies with `tool_calls` including the tool name and arguments. ```json theme={null} { "success": true, "message": "Chat request processed successfully", "data": { "request": [ { "finish_reason": "tool_calls", "message": { "role": "assistant", "content": "In this request, the model has made a tool call, extract the tool call from the response, process it accordingly and return the result", "tool_calls": [ { "id": "call_01", "type": "function", "function": { "name": "get_weather", "arguments": { "city": "Dar es Salaam", "unit": "celsius" } } } ] } } ], "created": "2025-09-25", "model": "pawa-v1-blaze-20250318", "object": "chat.request" } } ``` 4\) Execute your codeYour backend runs the function safely and prepares a compact JSON result. ```javascript theme={null} async function getWeather({ city, unit = "celsius" }) { // Replace with a real API return { city, unit, temp_c: 28, condition: "Sunny" }; } ``` 5\) Send tool result backPost a follow‑up message with role `tool`, the tool `name`, and the JSON output. ```bash theme={null} curl https://api.pawa-ai.com/v1/chat/request \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $PAWA_AI_API_KEY" \ -d '{ "model": "pawa-v1-blaze-20250318", "messages": [ {"role":"user","content":"What is the weather in Dar es Salaam?"}, { "role": "system", "name": get_weather, "content": [ {"type": "text", "text": str({\"city\":\"Dar es Salaam\",\"unit\":\"celsius\",\"temp_c\":28,\"condition\":\"Sunny\"})}, { "type": "text", "text": "Now the tool has helped you got the above answers required by user. Explain this back to the user as it is", } ], } ] }' ``` 6\) Receive final answerThe model grounds its response on the tool output. It may request more tools if needed. ```json theme={null} { "role": "assistant", "content": "In Dar es Salaam it is Sunny at around 28°C." } ``` ### Best practices for authoring schemas ### Multiple tools in one request You can provide several tools at the same time (custom and built‑in). The model may call one or more in sequence, or even in parallel. ```bash theme={null} curl https://api.pawa-ai.com/v1/chat/request \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $PAWA_AI_API_KEY" \ -d '{ "model": "pawa-v1-blaze-20250318", "tools": [ { "type": "function", "function": { "name": "get_weather", "parameters": { "type": "object", "properties": { "city": {"type":"string"} }, "required": ["city"] } } }, { "type": "function", "function": { "name": "get_events", "parameters": { "type": "object", "properties": { "city": {"type":"string"}, "date": {"type":"string", "format": "date"} }, "required": ["city"] } } }, { "type": "pawa_tool", "pawa_tool": "web_search_tool" } ], "messages": [ { "role": "user", "content": [ { "type": "text", "text": "I am in Dar es Salaam tomorrow. What should I prepare for?" } ] } ] }' ``` Example tool\_calls (parallel): ```json theme={null} { "success": true, "message": "Chat request processed successfully", "data": { "request": [ { "finish_reason": "tool_calls", "message": { "role": "assistant", "content": "In this request, the model has made a tool call, extract the tool call from the response, process it accordingly and return the result", "tool_calls": [ { "id": "call_weather", "type": "function", "function": { "name": "get_weather", "arguments": { "city": "Dar es Salaam" } } }, { "id": "call_events", "type": "function", "function": { "name": "get_events", "arguments": { "city": "Dar es Salaam", "date": "2025-09-12" } } } ] } } ], "created": "2025-09-25", "model": "pawa-v1-blaze-20250318", "object": "chat.request" } } ``` Handle both calls concurrently in your backend, then post two `tool` messages with the results. The final model message will synthesize both. > With Pawa AI tool calling, you get the most powerful up to date techninique to build advanced agentic AI bot that solves complex problems by using and integrating with the external sources or systems. # Vision Source: https://docs.pawa-ai.com/capabilities/vision Pawa AI models’ vision capabilities enable analyzing images and providing insights based on visual content, in addition to text. This multimodal approach opens up new possibilities for applications that require both textual and visual understanding. With Pawa AI’s vision capabilities, your applications can go **beyond text-only understanding** and incorporate **visual information** into reasoning, analysis, and decision-making. > **Pawa AI Vision Example** ![Vision Example](https://mintcdn.com/sartifycoltd/h3QvoufTX15l3Mnz/images/vision.png?fit=max\&auto=format\&n=h3QvoufTX15l3Mnz\&q=85\&s=b6c71066b4e3387b6fd16f6a6a45ca60) For more specific use cases related to **document parsing and data extraction**, we recommend exploring our **Document Parsing documentation** [here](/capabilities/documents-parsing). ### Vision Based Models in Pawa AI. Currently we have one vision model: * **pawa-v1-blaze-20250318**: A powerful small language model (SLM) optimized for reasoning, complex generation, multimodal, tools understanding, agentic workflow, and advanced knowledge tasks. ### How to send multimodal chat request with Pawa AI ? ```bash theme={null} curl https://api.pawa-ai.com/v1/chat/request \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $PAWA_AI_API_KEY" \ -d '{ "model": "pawa-v1-blaze-20250318", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe the main objects in this image and their colors." }, { "type": "image_url", "image_url": { "url": "https://example.com/path/to/image.jpg" } } ] } ] }' ``` ```bash theme={null} curl https://api.pawa-ai.com/v1/chat/request \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $PAWA_AI_API_KEY" \ -d '{ "model": "pawa-v1-blaze-20250318", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "What is the difference of these images?" }, { "type": "image_url", "image_url": { "url": "https://example.com/path/to/image.jpg" } } { "type": "image_url", "image_url": { "url": "https://example.com/path/to/image.jpg" } } { "type": "image_url", "image_url": { "url": "https://example.com/path/to/image.jpg" } } ] } ] }' ``` #### Use Cases > [accordion] Image classification > > Classify the overall content of an image into one or more categories. > > ```bash theme={null} > curl https://api.pawa-ai.com/v1/chat/request \ > -H "Content-Type: application/json" \ > -H "Authorization: Bearer $PAWA_AI_API_KEY" \ > -d '{ > "model": "pawa-v1-blaze-20250318", > "messages": [ > { > "role": "user", > "content": [ > { "type": "text", "text": "Classify this image by scene and mood." }, > { "type": "image_url", "image_url": { "url": "https://example.com/path/to/image.jpg" } } > ] > } > ] > }' > ``` > > Example output: > > ```json theme={null} > { > "labels": ["outdoor", "campfire", "night"], > "confidence": {"outdoor": 0.97, "campfire": 0.94, "night": 0.90}, > "summary": "A night outdoor scene with a campfire and people nearby." > } > ``` > [accordion] Object detection > > Detect and locate multiple objects in the image with rough descriptions. > > ```bash theme={null} > curl https://api.pawa-ai.com/v1/chat/request \ > -H "Content-Type: application/json" \ > -H "Authorization: Bearer $PAWA_AI_API_KEY" \ > -d '{ > "model": "pawa-v1-blaze-20250318", > "messages": [ > { > "role": "user", > "content": [ > { "type": "text", "text": "List the objects you see and their approximate positions." }, > { "type": "image_url", "image_url": { "url": "https://example.com/path/to/store-shelf.jpg" } } > ] > } > ] > }' > ``` > > Example output: > > ```json theme={null} > { > "objects": [ > {"label": "laptop", "bbox": [120, 80, 460, 320]}, > {"label": "coffee-cup", "bbox": [480, 260, 560, 340]} > ], > "summary": "A laptop on a desk with a coffee cup on the right." > } > ``` > [accordion] OCR and document parsing > > Extract text or structured fields from receipts, invoices, or forms. For advanced usage you can combine with `response_format` > > ```bash theme={null} > curl https://api.pawa-ai.com/v1/chat/request \ > -H "Content-Type: application/json" \ > -H "Authorization: Bearer $PAWA_AI_API_KEY" \ > -d '{ > "model": "pawa-v1-blaze-20250318", > "messages": [ > { > "role": "user", > "content": [ > { "type": "text", "text": "Extract the total, date and vendor name from this receipt." }, > { "type": "image_url", "image_url": { "url": "https://example.com/path/to/receipt.jpg" } } > ] > } > ] > }' > ``` > > Example output: > > ```json theme={null} > { > "vendor": "Moshi Supermarket", > "date": "2025-03-18", > "total": 16450, > "currency": "TZS" > } > ``` ### Best practices * Resize large images to a reasonable resolution (e.g., 1024px max on the longest side) to reduce latency without losing salient details. * Prefer `image_url` for repeatable, production traffic. Use signed URLs that expire quickly if assets are private. * Provide clear textual instructions that set expectations ("list objects with colors and approximate positions"). * For OCR, favor sharp, high‑contrast images. If possible, crop to the relevant region before sending. * When sending multiple images, order them logically and reference them in the text ("in the second photo, compare…"). ### Supported formats and limits * Formats: `jpg/jpeg`, `png` * Max image size: 25 MiB per image * Number of images per request: no hard limit; practical limits depend on latency and payload size * Base64 payloads should include the MIME type in the content object ### Privacy & security * Assets sent via `image_url` are fetched server‑side only for the duration of the request. Use time‑limited signed URLs for private content. * Inputs may be logged for abuse monitoring and quality unless you enable data controls in your dashboard. ### Troubleshooting * Image not found: Ensure the `image_url` is publicly reachable or signed correctly; test with `curl -I `. * Payload too large: Downscale images or switch to `image_url`. * Poor OCR quality: Increase resolution, improve lighting/contrast, or crop tighter around text. * Slow responses: Host images on a nearby region/CDN and reduce image dimensions. # Web Browsing Source: https://docs.pawa-ai.com/capabilities/web-browsing Pawa AI APIs enable access and retrieval of real-time information from the web. With browsing capabilities, your assistant can go beyond its training data to fetch the latest news, check live events, validate facts, and provide up-to-date answers. Usually, language models have a **knowledge cut-off** based on the data used for training. With web browsing functionality into Pawa AI, instead of orchestrating searches and tool calls yourself, you can get **chat responses enriched with live data** directly from the API. > **Our Built-in Web Search Tool Example** ![Web Browsing Example](https://mintcdn.com/sartifycoltd/h3QvoufTX15l3Mnz/images/Browsing.png?fit=max\&auto=format\&n=h3QvoufTX15l3Mnz\&q=85\&s=e3b38295f3c9c0689688c96947f3e8a5) This can be done using the **built-in `web_search_tool`**, which you pass as a parameter to your chat request. Unlike other providers, this feature has **no extra charges or request limits** for browsing. > [!NOTE] > > This can be done using the **built-in `web_search_tool`**, which you pass as a parameter to your chat request. Unlike other providers, this feature has **no extra charges or request limits** for browsing. ### Web browsing Models in Pawa AI. Currently we have one web browsing model: * **pawa-v1-blaze-20250318**: A powerful small language model (SLM) optimized for reasoning, complex generation, multimodal, tools understanding, agentic workflow, and advanced knowledge tasks. ### Web Browsing Request Example ```bash theme={null} curl --request POST \ --url https://api.pawa-ai.com/v1/chat/request \ --header "Authorization: Bearer $PAWA_AI_API_KEY" \ --header 'Content-Type: application/json' \ --data '{ "model": "pawa-v1-blaze-20250318", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "What was the score of Yanga SC vs Walliete FC yesterday ?" } ] } ], "tools": ["web_search_tool"] }' ``` > This request allows the model to fetch live information from the web, returning up-to-date and accurate responses directly in the chat. # Changelog Source: https://docs.pawa-ai.com/get-started/changelog Stay up-to-date with the latest features, releases, and improvements in Pawa AI. ## August 14, 2026 * Shipped **Account Payment Type Switch** — switch between **Subscription** and **Pay as you go** on the fly from Manage → Billing or account profile settings, without losing data. See [Payment Type Switch](/learn-more/payment-type-switch). * Released **Reasoning** — enable structured internal planning on supported models for higher-quality answers on complex tasks. See [Reasoning](/capabilities/reasoning). * **Pay as you go** API responses now include **usage tokens in and out** so you can track input and output token usage per request. ## February 14, 2026 * Updated the audio transcription api to include the speaker diarization capability. * Changed the output response of the audio transcription to include the speaker diarization capability. ## February 11, 2026 * Released **Transcribe** in Pawa Builder. The gives the UI to upload audio and get transcriptions * Changed **Pawa STT** model — optimized for long, more languages and fast execution. ## September 25, 2025 * Released **Pawa Builder platform**. * Launched **Pawa Blaze** model — optimized for reasoning, tool usage, and multimodal capabilities. ### December 2024, USA, CA, San Francisco * Released **Pawa Ember** model — designed for general daily use and high-quality responses across tasks. *** # Glossary Source: https://docs.pawa-ai.com/get-started/glossary A reference of key terms and concepts used throughout Pawa AI or AI industry in general Here you’ll find clear explanations of important terms to help you understand AI ecosystem. ## SLM (Small Language Model) SLMs (Small Language Models) are AI models that are trained on relatively smaller datasets and have fewer parameters compared to LLMs. They are lightweight, cost-efficient, and optimized for tasks that don’t require the full capacity of a large-scale model. SLMs are particularly useful for edge deployments, latency-sensitive applications, or environments with limited computational resources. While they may not have the broad generalization power of LLMs, SLMs excel in focused domains or task-specific scenarios. ## Embedding Embeddings are vectorial representations of text, images, or other data types. They map complex data into a high-dimensional vector space where semantically similar inputs are located close together. For example, the words *king* and *queen* will have similar embeddings. Embeddings are crucial for tasks like semantic search, clustering, and classification. In Pawa AI, embeddings are stored in a vector database and power retrieval-augmented generation (RAG), recommendation systems, and knowledge discovery. ## Agents Agents are AI-driven systems designed to perform autonomous tasks by combining reasoning, planning, and action. They use an LLM or SLM as a reasoning engine, often enhanced with memory, tools, and external APIs. Agents can handle multi-step workflows such as booking appointments, answering domain-specific questions, or orchestrating business processes. They can be reactive (responding to prompts) or proactive (taking initiative based on goals and triggers). ## Knowledge Base A knowledge base is a structured repository of information — such as documents, FAQs, manuals, or articles — used to improve the accuracy of AI systems. When paired with embeddings and vector search, knowledge bases enable retrieval-augmented generation (RAG). This allows models to ground their responses in authoritative, up-to-date information instead of relying solely on pretraining data. Pawa AI supports uploading and managing knowledge bases that seamlessly integrate into workflows. ## Vectors Vectors are numerical arrays representing data in a continuous high-dimensional space. In AI, they are used to encode semantic information about text, audio, or images. For example, a sentence like *“AI is powerful”* might be represented as a 1024-dimensional vector. Similar sentences will have vectors that are geometrically close. These properties make vectors essential for nearest-neighbor searches, recommendations, and similarity comparisons. ## Context Window The context window refers to the maximum number of tokens (input + output) that a model can process at once. A larger context window allows the model to remember more information during a conversation or task. For example, with a 128k token context window, a model can handle entire books or large datasets in a single prompt. However, larger context windows require more computation and memory. ## Fine-tuning Fine-tuning is the process of adapting a pre-trained model to a specific dataset, task, or domain. Instead of training from scratch, the model’s existing weights are adjusted slightly to learn task-specific patterns. Fine-tuning can improve accuracy, enforce domain-specific language, and reduce errors in specialized use cases. Variants include **instruction tuning** (aligning responses to follow directions better) and **parameter-efficient fine-tuning (PEFT)** methods such as LoRA, which reduce resource costs. ## RAG (Retrieval-Augmented Generation) Retrieval-Augmented Generation (RAG) combines the power of LLMs with information retrieval systems. First, relevant documents or data are retrieved from a vector store using embeddings. Then, that information is injected into the model’s prompt to improve generation accuracy. RAG reduces hallucinations and ensures responses are factually grounded in external knowledge. It is widely used for chatbots, customer support, and enterprise knowledge management. ## Temperature Temperature is a parameter that controls the randomness of model outputs. A lower temperature (e.g., 0.1) produces more deterministic and predictable results, useful for factual or structured tasks. A higher temperature (e.g., 0.9) increases creativity and variety, making it better for brainstorming or storytelling. Adjusting temperature lets developers balance precision and creativity depending on the application. ## Function Calling Function calling allows a model to interact with external tools, APIs, or functions. Instead of just generating text, the model can decide to call a structured function, e.g., `get_weather("Dar-es-salaam")`. The API executes the function and returns the result, which the model then incorporates into its response. This makes AI systems more powerful, as they can combine natural language reasoning with deterministic external operations, such as retrieving real-time data, making calculations, or triggering business workflows. ### Observability The ability to monitor, trace, and understand the internal state of a system through metrics, logs, and dashboards. *** # Quickstart Source: https://docs.pawa-ai.com/get-started/quickstart Get started with Pawa AI and integrate powerful AI capabilities in minutes Follow these steps to start using Pawa AI models in your applications. *** ### Step 1: Create a Pawa AI Account * Sign up for a Pawa AI account [Register](https://pawa-ai.com/auth). * Verify your email and log in as a Builder ### Step 2: Generate an API Key * Navigate to the **API Keys** page in your [Builders Dashboard](https://builder.pawa-ai.com/dashboard). * Click **Create new key**. * Copy the key and save it securely. We recommend storing it as an environment variable: ```bash theme={null} export PAWA_AI_API_KEY="your_api_key_here" ``` ### Step 3: Make Your First API Call > [tab] Chat > > With your API key set, you can make your first chat request: > > ```bash theme={null} > curl https://api.pawa-ai.com/v1/chat/request \ > -H "Content-Type: application/json" \ > -H "Authorization: Bearer $PAWA_AI_API_KEY" \ > -d '{ > "model": "pawa-v1-ember-20240924", > "messages": [ > { > "role": "system", > "content": [ > { > "type": "text", > "text": "You are a TanzaBot, a helpful AI assistant for developers in Africa." > } > ] > }, > { > "role": "user", > "content": [ > { > "type": "text", > "text": "Hello, How can I use AI in my app?" > } > ] > } > ], > "stream": false > }' > ``` > > You should receive a JSON response with Pawa's chat completion. > [tab] Text to Speech > > Convert text to speech: > > ```bash theme={null} > curl https://api.pawa-ai.com/v1/voice/text-to-speech \ > -H "Content-Type: application/json" \ > -H "Authorization: Bearer $PAWA_AI_API_KEY" \ > -d '{ > "model": "pawa-tts-v1-20250704", > "text": "Hello, this is Pawa AI speaking!", > "voice": "liora" > }' > ``` > > You'll receive an audio file in the response. We technically do auto streaming of speech(text to speech), so if need that please send request as as streaming using server sent events(SSE). > [tab] Speech to Text > > Convert speech to text: > > ```bash theme={null} > curl https://api.pawa-ai.com/v1/voice/speech-to-text \ > -H "Authorization: Bearer $PAWA_AI_API_KEY" \ > -F "file=@audio_file.wav" \ > -F "model=pawa-stt-v1-20240701" > ``` > > The response will contain the transcribed text. > [tab] Embeddings > > Generate embeddings for NLP tasks: > > ```bash theme={null} > curl https://api.pawa-ai.com/v1/vectors/embedding \ > -H "Content-Type: application/json" \ > -H "Authorization: Bearer $PAWA_AI_API_KEY" \ > -d '{ > "model": "pawa-embeddings-v1-20241001", > "input": ["Embed this sentence.", "And this one too."], > "lang":"multi" > }' > ``` > > The response will include numerical vectors for each input text. The list of vector representations of each sentence. > [tab] Document Parsing > > Parse documents to extract text: > > ```bash theme={null} > curl https://api.pawa-ai.com/v1/documents/parse \ > -H "Authorization: Bearer $PAWA_AI_API_KEY" \ > -F "documents=@document.pdf" \ > -F "model=pawa-v1-parser-20250809" > ``` > > The response will contain the extracted textual data. > [!NOTE] > > **Pay as you go accounts:** Every API response includes a **usage** object with **tokens in** (input) and **tokens out** (output) for that request—so you can track consumption against your credit balance. See [Pricing](/learn-more/pricing) for rates. *** ## Next Steps Now that your account is ready and you've made your first requests, explore other Pawa AI's capabilities: > [card] [Tools calling](/capabilities/tools-calling) > > Enable your AI to call external tools and APIs for enhanced functionality. > [card] [Reasoning](/capabilities/reasoning) > > Build AI systems that can think through complex problems step by step. > [card] [Agents](/agents/introduction) > > Create autonomous AI agents that can perform multi-step tasks independently. > [card] [Multimodal](/capabilities/vision) > > Process text, images, and other media types in a single AI conversation. > [!NOTE] > > **Need help?** Check the [API Reference](/api-reference/introduction) or visit our [Sandbox](https://builder.pawa-ai.com/dashboard?page=sandbox) to test the models. # Best Practices Source: https://docs.pawa-ai.com/going-production/deployment Comprehensive guidelines for securely, efficiently, and responsibly using the Pawa AI API in production environments. Moving from a prototype to a production-ready system requires careful planning and thoughtful implementation. This guide outlines the **best practices** for integrating the Pawa AI API securely and reliably, while also considering performance, cost, monitoring, and compliance. *** ### Managing Billing & Usage Limits Once you’ve set up billing, you will be assigned a **monthly or yearly usage limit**. This limit ensures that unexpected spikes in activity do not result in runaway costs. As you build trust with the platform through consistent usage, your quota may **automatically increase** over time. You can always request a higher limit if your project requires it. It is strongly recommended that you **track and monitor your billing consumption** in real time: * Use the **dashboard** to review your current spend and limits. * Treat billing limits as a **safety net**, not a primary control mechanism. Design your application logic to gracefully handle the situation where requests fail due to exceeding budget limits. This ensures your application continues to deliver a stable experience for users while preventing unexpected charges. *** ### API Keys and Authentication Pawa AI uses **API keys** to authenticate requests. This system is straightforward, but it requires diligence to ensure security: * **Never hardcode your API keys** directly in your codebase. Doing so risks accidental exposure if your repository is ever shared or made public. * Instead, use **environment variables** (`.env` files) or a secret management service (such as AWS Secrets Manager, GCP Secret Manager, or HashiCorp Vault) to inject keys into your application at runtime. * Restrict access to the keys only to the systems and team members that need them. * Regularly **rotate keys** to minimize risk in the event of a leak. * Immediately revoke compromised keys. ### Tracking & Monitoring Usage In production, monitoring isn’t optional — it is essential. You should track: * **Request counts**: How many requests are being sent per minute/hour/day. * **Token usage**: How many tokens are being consumed across different models. * **Response times**: Latency trends that may affect user experience. * **Error rates**: Frequency and types of errors (timeouts, rate limit exceeded, etc.). Use the **Pawa AI dashboard** for basic insights, but for more advanced observability, integrate with tools like **Prometheus, Grafana, or Datadog**. Set up **alerts** that notify your team when you approach rate or billing limits. For example, a Slack notification could be triggered when 80% of your monthly budget is consumed. Monitoring not only protects against outages but also provides data for **optimization and scaling decisions**. *** ### Staging vs Production Projects As you grow, it is crucial to separate your environments: * **Staging environments** are used for testing new features, fine-tuning prompts, or experimenting with new models. * **Production environments** handle live traffic and real user interactions. Separating the two helps avoid: * Accidental disruptions to live applications during testing. * Mixing test usage with production usage, which can lead to confusing billing and usage reports. You can also apply **different spend limits and access controls** to staging projects. For example, developers may have broader access to staging but restricted access to production. This separation is a standard **DevOps practice** that reduces risk and increases the reliability of your deployment pipeline. *** ### Scaling Your Application When traffic increases, you need an architecture that can scale smoothly. Scaling can be approached in multiple ways: #### - Horizontal Scaling Add more servers or containers to distribute requests across multiple nodes. This requires a **load balancer** to ensure requests are evenly spread. Horizontal scaling is resilient because failure of one node does not bring down the system. #### - Vertical Scaling Increase resources (CPU, RAM, GPU) of your existing servers. This is simpler but can become expensive and introduces a single point of failure if that machine fails. ### Caching Many applications repeatedly request the same or similar data. By caching results in memory (e.g., Redis, Memcached) or at the application layer, you can dramatically reduce API calls, improve response times, and save costs. ### Batching If you are making multiple requests in quick succession, batch them into a single request. The Pawa AI API supports multiple inputs in one call, which reduces network overhead and improves efficiency. *** ### Managing Latency Latency is the delay between sending a request and receiving a response. For real-time or user-facing applications, latency has a direct impact on user satisfaction. Factors influencing latency include: * **Model size**: Larger, more capable models take longer to generate responses. Consider using smaller models for tasks where speed is more important than raw accuracy. * **Token count**: Longer outputs require more time to generate. Use `max_tokens` to restrict length and **stop sequences** to cut off unnecessary output. * **Streaming**: Use `stream: true` to receive tokens as they are generated. This reduces time-to-first-token and allows you to display partial results earlier. * **Infrastructure placement**: Deploy your servers close to Pawa AI’s infrastructure to reduce network round-trip time. * **Batching**: Sending multiple inputs in a single request reduces per-request latency and overhead. Designing for latency is about balancing **speed, cost, and quality**. *** ### Handling Rate Limits To ensure fair usage, APIs often enforce **rate limits**. Hitting a rate limit can cause your requests to fail. To handle this gracefully: * Implement **retry logic with exponential backoff**. Instead of retrying immediately, wait progressively longer between retries (e.g., 1s → 2s → 4s). This prevents overloading the system. * Queue requests if limits are reached, and process them as capacity becomes available. * Monitor your usage to identify whether you need to **upgrade your plan** for higher throughput. Failing to plan for rate limits can lead to degraded user experience. Thoughtful handling ensures your application remains stable even under heavy load. *** ### Security & Compliance Security is a **non-negotiable** part of production readiness: * Always send API requests over **HTTPS**. * Encrypt data both at rest and in transit. * Use the **principle of least privilege**: only grant API key access to the systems that need it. * Review compliance requirements (e.g., GDPR, HIPAA, local data laws). * Implement **logging and auditing** to track access and activity. Security failures in production can lead to **data breaches, financial losses, and compliance violations**. Following best practices reduces this risk. *** ### Error Handling Errors are inevitable in distributed systems. The key is how your application responds: * **Timeouts**: Retry requests with backoff. Don’t leave users hanging; provide fallback messaging. * **Network errors**: Design retries and redundancy in your networking layer. * **Persistent failures**: If retries don’t resolve the issue, log the error and notify your team. Contact Pawa AI support with the request ID, timestamp, and error details. * **Graceful degradation**: Design fallback behavior — e.g., use cached data or a simpler model — so users still get a response. Proper error handling improves resilience and trust in your application. *** Building with AI is not just about what your application does — it’s about building something that will **scale, last, and remain safe** for your users. # Frequency and Presence Penalties Source: https://docs.pawa-ai.com/guides/frequency-and-presence-penalty An in-depth guide on understanding and using frequency and presence penalties in LM requests to control repetition, improve diversity, and optimize output quality. When using language models (LMs) for text generation, one common challenge is **repetition**. Without guidance, a model may repeat words, phrases, or concepts excessively, especially in **long-form outputs**. This can reduce readability, coherence, and the overall usefulness of the generated text. To address this, most LLMs provide two complementary mechanisms: **frequency penalty** and **presence penalty**. Both of these parameters adjust the probabilities of tokens during sampling, encouraging the model to generate more **diverse, creative, and contextually rich outputs**. ### Understanding Frequency Penalty The **frequency penalty** discourages the model from repeating tokens that have already appeared in the generated text. Importantly, this penalty is **proportional to how many times a token has occurred**. * If a token appears once, the penalty slightly reduces its probability. * If it appears multiple times, the probability reduction becomes stronger. ### Mathematical Intuition A simplified formula for frequency penalty is: P\_adjusted(token) = P(token) - (frequency\_penalty × count(token)) Where: * `P(token)` = original probability of the token * `frequency_penalty` = user-defined weight (usually 0–2) * `count(token)` = number of times the token has already appeared > Think of frequency penalty as a **progressively increasing deterrent** against repetition. The more a token has been used, the less likely it is to appear again. ### Use Cases for Frequency Penalty * **Long-form content generation**: Articles, reports, or essays where repeated words reduce readability. * **Dialogue generation**: Multi-turn conversations where the model may redundantly repeat phrases or instructions. * **Structured outputs**: Preventing repeated labels, keys, or values in generated lists or tables. *** ### Understanding Presence Penalty The **presence penalty**, in contrast, discourages the model from using tokens that **have appeared at least once**, regardless of frequency. * Even if a token has only appeared once, the presence penalty reduces its probability for subsequent selections. * It is ideal for encouraging the model to introduce **new concepts and words**. ### Mathematical Intuition A simplified formula for presence penalty is: P\_adjusted(token) = P(token) - (presence\_penalty × indicator(token\_present)) Where: * `indicator(token_present)` = 1 if token has appeared, 0 otherwise * `presence_penalty` = user-defined weight (usually 0–2) > Presence penalty works as a **binary gate** — it discourages tokens that already exist in the text, making the model explore new vocabulary or ideas. ### Use Cases for Presence Penalty * **Creative writing**: Stories, poetry, slogans, and marketing copy. * **Brainstorming outputs**: Generating multiple unique ideas in a single prompt. * **Reducing monotony**: Ensuring repeated words do not dominate multi-turn outputs. *** ### Frequency vs Presence: Key Differences | Parameter | Mechanism | Effect on Repetition | Best For | | - | - | - | - | | Frequency Penalty | Penalizes tokens **proportional to occurrence** | Gradually reduces likelihood of repeated tokens | Long-form text, structured outputs, multi-turn dialogues | | Presence Penalty | Penalizes tokens **once they appear at least once** | Discourages any reuse of tokens regardless of frequency | Creative writing, brainstorming, idea expansion, slogans | > In practice, these penalties are often **combined** to control repetition while maintaining creativity. *** **Guidelines:** 1. Start with small penalties and test outputs incrementally. 2. Combine with temperature (controls randomness) and top-p (limits sampling nucleus) for fine-grained control. 3. Monitor outputs in production to adjust penalties dynamically based on content quality. *** # Max Tokens Source: https://docs.pawa-ai.com/guides/max-tokens Understanding and controlling the maximum number of tokens a model can generate. The **`max_tokens`** parameter is a critical setting when interacting with language models. It defines the **maximum number of tokens** that the model can produce in a single response. Tokens can be thought of as chunks of text—words, subwords, or even punctuation—so controlling `max_tokens` effectively limits the length of the model's output. ## How Max Tokens Works 1. **Definition of a Token** * A token is not necessarily a full word. For example: * `"Hello"` → 1 token * `"Pawa is amazing!"` → 5 tokens (`Pa`, `a`, `w`, `is`, `amazing`, `!`) * The exact tokenization depends on the model's tokenizer. 2. **Response Length Control** * Setting `max_tokens` ensures the model does not exceed a certain number of tokens. 3. **Impact** * Limiting `max_tokens` helps control costs by preventing excessively long responses. 4. **Truncation Behavior** * If a model is asked to generate more than `max_tokens`, the output is **truncated** at the token limit. * Important: truncation may cut sentences mid-way. For precise or complete outputs, consider requesting multiple completions or smaller chunks. 5. **Best Practices** * **Set appropriate limits:** Use `max_tokens` based on your application's needs. Short prompts often require fewer tokens. * **Combine with streaming:** For very long outputs, consider streaming responses and dynamically managing token limits. 6. **Example Use Cases** * Summarization: Limit tokens to produce concise summaries. * Chatbots: Control message length to maintain readability. * Content Generation: Prevent excessively long articles that may exceed processing or display limits. *** **Summary:**\ The `max_tokens` parameter gives you **precise control** over the length of the model's output, impacting both the **user experience** and **cost efficiency**. Setting it correctly is a key step in designing predictable and reliable AI applications. # Observability Source: https://docs.pawa-ai.com/guides/obervability Understanding observability in AI systems for monitoring, debugging, and improving performance. **Observability** is the practice of gaining deep insights into the behavior, performance, and state of a system. In AI systems, observability helps developers, operators, and product teams **monitor model performance, understand user interactions, and troubleshoot issues effectively**. ## Why Observability Matters AI models and agents can behave unpredictably due to complex reasoning, dynamic inputs, or stochastic outputs. Observability enables: 1. **Monitoring** * Track model usage, response times, error rates, and other performance metrics. * Example: Monitoring average response latency for a chatbot over time. 2. **Debugging** * Identify why a model produced unexpected output. * Log inputs, outputs, intermediate reasoning steps, and context for analysis. 3. **Optimization** * Measure the effectiveness of prompts, parameters, or agent behavior. * Use metrics such as token usage, top-p/temperature settings, and success rates to optimize model efficiency. 4. **Reliability & Compliance** * Ensure models adhere to safety, fairness, and regulatory requirements. * Observability helps audit decisions and detect anomalous behavior. ## Key Components of Observability 1. **Logging** * Record requests, responses, and system events. * Include metadata such as timestamps, model version, user context, and API parameters. 2. **Metrics** * Quantitative measures that track system health. * Examples: * Request throughput (requests/sec) * Latency (ms) * Error rate (%) * Token usage per request 3. **Tracing** * Track the flow of data or tasks across different system components. * Helps understand how multi-agent systems or pipelines execute tasks and where delays occur. 4. **Alerting** * Automatically notify operators when performance or behavior falls outside expected thresholds. * Examples: Spike in failed requests, unusual token consumption, or inconsistent outputs. 5. **Visualization** * Dashboards, charts, and logs help teams quickly identify trends, anomalies, or issues. * Tools like Grafana, Kibana, or custom dashboards are commonly used. ## Observability in Multi-Agent AI Systems In complex systems where multiple agents interact: * Track **which agent handled which task**. * Record **tool usage and decision paths**. * Correlate **user inputs with agent outputs** for audit and improvement. ## Open-Source Tools for Observability To build a robust observability stack, the following open-source tools are widely used: ### Metrics & Monitoring * **Prometheus** – Time-series metrics collection and alerting. * **Grafana** – Visualization and interactive dashboards. * **Thanos & Cortex** – Scalable solutions for Prometheus with long-term storage. ### Tracing * **Jaeger** – Distributed tracing for microservices. * **Zipkin** – Lightweight distributed tracing system. ### Logging & Aggregation * **Fluentd / Fluent Bit** – Log collection and forwarding. * **ELK Stack (Elasticsearch, Logstash, Kibana)** – Centralized log storage, search, and visualization. * **SigNoz** – Full-stack observability platform alternative to Datadog. ### AI & LLM Observability * **Langfuse** – Track model outputs, user interactions, and performance metrics. * **Opik** – Monitor LLM usage and performance. * **OpenLLMetry** – Collect and visualize LLM metrics. * **Helicone** – Monitor LLM performance and user interactions. ### Data Observability * **SodaCore** – Monitor data quality and pipelines. * **Great Expectations** – Data validation and testing. * **Datafold** – Data diffing and pipeline testing tool. ## Best Practices * **Structured Logging:** Use JSON or structured formats to facilitate search and analysis. * **Centralized Observability:** Consolidate logs and metrics from all agents and services in a unified platform. * **Anomaly Detection:** Use automated systems to detect unusual patterns before they impact users. * **Privacy & Security:** Ensure observability practices comply with data privacy regulations. *** **Summary:**\ Observability in AI is crucial for **reliability, trust, and performance optimization**. By systematically monitoring, logging, tracing, and analyzing AI behaviors, teams can maintain high-quality systems, debug effectively, and improve user experiences. # Prompt Engineering Source: https://docs.pawa-ai.com/guides/prompt-engineering Techniques and best practices for designing effective prompts for AI models. **Prompt Engineering** is the process of designing, refining, and optimizing prompts to guide AI models toward producing **accurate, relevant, and useful outputs**. It is a key skill when working with language models (LMs) and AI agents, as the prompt directly influences the behavior and quality of the model’s response. ## Why Prompt Engineering Matters AI models generate outputs based on the input they receive. A well-crafted prompt can: * Reduce errors and irrelevant responses. * Guide models to follow specific formats or rules. * Enhance creativity or analytical reasoning. * Improve consistency and reliability in multi-turn conversations. ## Key Principles of Prompt Engineering 1. **Clarity** * Use concise and precise language. * Avoid ambiguity to minimize misinterpretation. * Example: ```text theme={null} Poor: "Tell me about space." Better: "Explain the process of star formation in simple terms suitable for a 12-year-old." ``` 2. **Context** * Provide relevant context for the model. * Include instructions, background, or examples. * Example: ```text theme={null} "You are an expert nutritionist. Provide a 3-day meal plan for a vegetarian athlete." ``` 3. **Constraints** * Set clear boundaries on output format, length, style, or tone. * Example: ```text theme={null} "List 5 benefits of meditation in bullet points, each no longer than 20 words." ``` 4. **Step-by-Step Guidance** * Break complex tasks into steps to improve accuracy. * Example: ```text theme={null} "First summarize the article in 3 sentences. Then list the key takeaways." ``` 5. **Examples & Demonstrations** * Show the model the expected output format using examples. * Example: ```text theme={null} Q: Convert this sentence to passive voice: "The cat chased the mouse." A: "The mouse was chased by the cat." ``` 6. **Iterative Refinement** * Test and adjust prompts based on model output. * Fine-tune phrasing, context, and examples to achieve better results. ## Techniques for Advanced Prompt Engineering * **Chain-of-Thought Prompting:** Encourage reasoning by asking the model to explain its thought process before giving an answer. * **Zero-Shot Prompting:** Ask the model to perform tasks without examples, relying only on clear instructions. * **Few-Shot Prompting:** Provide a few examples of inputs and outputs to guide the model. * **Role-Playing:** Assign the model a role to improve context and output relevance. * **Conditional Prompts:** Include conditions, constraints, or rules that the model must follow. ## Best Practices * Keep prompts **simple but specific**. * Avoid overly long or ambiguous instructions. * Always **test multiple variations** to find the most effective prompt. * Document prompts and results for future reuse and optimization. * Combine prompts with **temperature, top-p, and token limits** for predictable outputs. *** **Summary:**\ Prompt engineering is both an **art and a science**. By applying clear instructions, context, examples, and iterative testing, you can guide AI models to produce more accurate, consistent, and relevant responses, unlocking the full potential of AI systems. # Temperature Source: https://docs.pawa-ai.com/guides/temperature A comprehensive guide to understanding and using the temperature parameter in language model requests, including practical recommendations, examples, and advanced tips. # Temperature The **temperature parameter** is one of the most critical hyperparameters when making requests to a language model (LM). It fundamentally influences how the model generates text, affecting **creativity, randomness, and determinism**. Understanding temperature deeply allows you to control the behavior of your LM effectively and tailor it to different production scenarios, from precise data extraction to highly creative content generation. *** ### What Temperature Is In mathematical terms, temperature is a **scaling factor applied to the probability distribution of the model’s next token predictions**. The model calculates a probability for each possible next token based on the prompt and context. Temperature then transforms these probabilities before sampling the token: P\_adjusted(token) = P(token)^(1/T) divided by the sum over i of P(i)^(1/T) Where (T) is the temperature: * **T = 0**: The model becomes fully deterministic, always picking the highest probability token. * **T = 1**: The probabilities are unmodified, producing the “default” behavior of the model. * **T > 1**: The distribution flattens, increasing randomness and diversity. * **0 \< T \< 1**: The distribution sharpens, favoring high-probability tokens even more strongly. In simpler terms, **temperature controls how “adventurous” the model is**. A low temperature is conservative, producing safe and consistent outputs. A high temperature is creative, generating unexpected and diverse results. *** ### Practical Temperature Guide Here’s a detailed guide to how temperature values affect model behavior in real-world applications: | Temperature | Behavior | Example Use Cases | Detailed Notes | | - | - | - | - | | **0.0** | Fully deterministic | Structured data extraction, formal responses, reproducible testing | The model will always select the token with the highest probability. Ideal for use cases where **predictability is critical**, such as automated form filling, parsing, or fact-checking. | | **0.1 – 0.3** | Very low randomness | Summaries, FAQs, customer support answers | Slight variation may occur, but responses remain very consistent. Useful for applications that require **precision and clarity** but can tolerate minimal variation. | | **0.4 – 0.6** | Balanced | General-purpose content creation, Q\&A, instructional text | Produces text that is mostly consistent but includes some minor diversity. A **good starting point for most production use cases**. | | **0.7 – 0.9** | Creative | Marketing copy, social media posts, idea generation | The model begins exploring alternative ways to phrase or approach prompts. May generate **novel insights or phrasing**, but can occasionally produce slightly off-topic content. | | **1.0 – 1.3** | High creativity | Poetry, storytelling, brainstorming | The outputs are diverse and imaginative. The model may generate **unexpected ideas** and creative expressions, but coherence may sometimes suffer. | | **1.4 – 2.0** | Very high randomness | Experimental content, extreme creative applications | Responses can be incoherent or inconsistent. Only suitable for **experimentation or artistic purposes**. High temperature is rarely recommended in production unless deliberate unpredictability is desired. | *** ### How Temperature Affects LM Behavior 1. **Determinism vs. Creativity** * Low temperatures lead to **predictable outputs**, which is ideal for structured tasks. * High temperatures increase **creative exploration**, but you trade off consistency. 2. **Probability Distribution** * The model assigns probabilities to all possible next tokens. * Temperature rescales these probabilities: * **Low T** sharpens the distribution → favors high-probability tokens. * **High T** flattens the distribution → increases chances of selecting lower-probability tokens. 3. **Impact on Multi-Token Outputs** * Temperature affects the generation of **entire sequences**, not just individual tokens. * Even a small change can compound over long outputs, producing significantly different results. 4. **Interaction with Other Sampling Parameters** * **Top-p (nucleus sampling):** Restricts sampling to a cumulative probability (e.g., top 90% of tokens). * Combining temperature with top-p can balance creativity and safety. * Example: `temperature=0.7` and `top_p=0.9` allows controlled randomness while avoiding completely unexpected tokens. *** ### Practical Guidelines ### Choosing Temperature for Your Use Case * **Low Temperature (0.0–0.3)** * Use for applications requiring **precision, reproducibility, and reliability**. * Examples: parsing structured documents, generating code, or automated data validation. * **Medium Temperature (0.4–0.6)** * Balanced approach, suitable for **general-purpose content generation**. * Produces reliable outputs with some stylistic variety. * Example: generating knowledge base answers or instructional text. * **High Temperature (0.7–1.0)** * Encourages **creativity and diversity** in outputs. * Ideal for marketing, storytelling, or brainstorming where variety is valued more than exact reproducibility. * **Extreme Temperature (1.1–2.0)** * Highly experimental outputs. * Use sparingly and only when unpredictability is acceptable. *** ### Examples: Same Prompt, Different Temperatures Prompt: *“Suggest a creative slogan for a productivity app.”* * **Temperature = 0.2**: > “Work smarter. Achieve more.” * Direct, safe, predictable. * **Temperature = 0.6**: > “Boost your focus, get things done, every day.” * Slightly varied phrasing, still coherent. * **Temperature = 0.9**: > “Turn every idea into action and conquer your to-do list with ease.” * More creative, dynamic phrasing, potentially inspiring. * **Temperature = 1.2**: > “Unleash the chaos of productivity and ride the wave of achievement!” * Highly imaginative but less consistent, may not suit professional communication. *** ### Best Practices and Considerations 1. **Start Low and Experiment** * Begin with a low-to-medium temperature (0.3–0.6) for your use case. * Gradually increase if more creativity is desired. 2. **Pair with Top-p** * Using top-p along with temperature can prevent **extreme randomness** while allowing diversity. 3. **Long Outputs Require Care** * High temperatures in long sequences can accumulate errors or drift off-topic. * Consider **segmenting prompts** or generating smaller pieces sequentially. 4. **Domain-Specific Tuning** * For structured or technical domains, keep temperature low to avoid factual errors. * For creative writing, higher temperature encourages expressive outputs. 5. **Testing and Iteration** * Always test multiple temperature values in your application context. * Monitor outputs and adjust to find the optimal balance between **creativity and reliability**. *** # Top-p (Nucleus Sampling) Source: https://docs.pawa-ai.com/guides/top-p A comprehensive guide to understanding and using top-p (nucleus sampling) in LM requests, including practical examples, best practices, and advanced tips. # Top-p (Nucleus Sampling) Top-p, also known as **nucleus sampling**, is a powerful parameter used in language model (LM) requests that controls **the diversity of the generated text**. Along with the temperature parameter, top-p plays a central role in determining how **creative, coherent, or safe** the model’s output will be. Unlike temperature, which rescales the probability distribution of all tokens, top-p **limits the sampling to the most probable subset of tokens** whose cumulative probability mass reaches a certain threshold `p`. This makes top-p an essential tool for balancing **creativity and control**. *** ### What Top-p Is Top-p (nucleus sampling) works as follows: 1. The model generates a **probability distribution** over all possible next tokens. 2. Tokens are sorted from **highest to lowest probability**. 3. The model selects the **smallest set of tokens** whose cumulative probability is ≥ `p`. 4. The next token is sampled **only from this set**. For example: * Suppose the top token probabilities are `[0.4, 0.3, 0.2, 0.05, 0.05]`. * If `top_p = 0.8`, the model will only consider `[0.4, 0.3, 0.2]` (cumulative probability = 0.9 ≥ 0.8). * Tokens outside this subset (0.05, 0.05) are **ignored**, reducing the risk of unlikely or irrelevant outputs. > Think of top-p as a **dynamic cutoff** — it only considers the "nucleus" of high-probability options. *** ### How Top-p Affects Model Behavior Top-p influences how deterministic or creative the model output is, in ways that complement the **temperature parameter**: | Top-p Value | Behavior | Example Use Cases | Notes | | - | - | - | - | | **0.0 – 0.1** | Extremely conservative | Data extraction, structured tasks | Only the very top token(s) are considered. Outputs are highly deterministic, almost identical every time. | | **0.2 – 0.5** | Low diversity | Summarization, customer support | Mostly deterministic but allows slight variation. Prevents repetition and adds mild naturalness. | | **0.6 – 0.8** | Balanced | General-purpose text, Q\&A, light creative writing | Includes enough options for variety without producing irrelevant or incoherent content. | | **0.9 – 0.95** | High diversity | Creative content, brainstorming, storytelling | Generates varied outputs with some risk of deviation from the prompt. | | **>0.95** | Very high diversity | Experimental or artistic applications | Almost all tokens are considered; output may be highly unpredictable. Rarely used in production for structured tasks. | *** ### Comparison: Top-p vs Temperature | Parameter | Effect | Key Difference | | - | - | - | | **Temperature** | Rescales probability distribution globally | Controls randomness in selection but considers all tokens | | **Top-p** | Limits sampling to the "nucleus" of high-probability tokens | Provides a **dynamic cutoff**, ignoring low-probability tokens entirely | > **Tip:** Top-p and temperature can be **combined** for fine-grained control. Example: `temperature=0.7` and `top_p=0.9` → encourages creativity but avoids wild outputs. *** ### Choosing Top-p for Your Use Case ### Low Top-p (0.0 – 0.5) * Use for tasks that require **reliability and determinism**. * Examples: filling forms, extracting structured data, generating code, summarizing official documents. ### Medium Top-p (0.6 – 0.8) * Balanced approach for general content creation. * Allows **natural variation** without producing off-topic responses. * Examples: blog summaries, FAQs, instructional text, standard Q\&A. ### High Top-p (0.9 – 0.95) * For **creative or generative tasks** where variety is desired. * Examples: poetry, storytelling, marketing copy, idea generation. ### Extreme Top-p (>0.95) * Experimental scenarios only. * May produce incoherent or unpredictable outputs. * Rarely recommended for production. *** ### Practical Examples ### Example 1: Same Prompt, Different Top-p Prompt: *“Write a tagline for an AI productivity app.”* * **Top-p = 0.3** > “Work smarter, achieve more.” * Short, safe, deterministic. * **Top-p = 0.7** > “Boost focus, conquer your tasks, and get more done every day.” * Balanced, slightly creative. * **Top-p = 0.95** > “Turn ideas into action, ride the wave of productivity, and make every second count!” * Highly creative, risk of slightly over-the-top phrasing. *** # Introduction Source: https://docs.pawa-ai.com/index Solving Africa’s Biggest Untapped AI Potential—**Localization** Pawa AI is a next-generation AI platform designed for **Africa** by Sartify Co. Ltd — making it easy for developers, startups, and enterprises to build advanced, accessible, cultural awareness and cost-efficient AI solutions. Whether you’re building chatbots, intelligent agents, documents processing, named entity recognition, computer visions, transcription or any voice automation workflows, fine-tuning custom language models for privacy issues and others, Pawa AI gives you the tools you need to innovate. *** > [!NOTE] > > With Pawa AI, we envision AI that is small, secure, advanced, affordable, providing correct local information that can't be found in the internet, and easy to use, designed specifically for African context in understanding our cultures, images, language and voices. ## The Big Picture **Localization** isn't just about language — it’s much more than that. Pawa AI is built to solve **Africa’s challenges** when comes to AI- such as: * **Cultural context awareness**\ AI that understands local idioms, traditions, and social norms in voices and images so its responses feel natural and respectful. * **End of digital illiteracy**\ AI built *for us, not just by us*. AI that understands our daily lives, enabling seamless **local payments, cities navigation, markets understanding and daily tasks** — without the tech barrier. Just the language we all know. * **Closing Africa’s data gap for SMEs**\ Many African SMEs remain invisible online, trapped in fragmented data silos. Global models like ChatGPT cannot uncover these local solutions — but Pawa AI can. Our mission: **“The Internet for African SMEs & Users.”** * **Affordable & accessible AI**\ Global LLMs are too big, too expensive, and too detached from African realities. Inference providers charging per token make costs unpredictable, models untunable, and relevance low. Pawa AI is designed to be **small, secure, advanced, affordable**, and **fine-tuned for local needs**. *** ## Some of Our End to End Products, Built With Pawa AI. We’ve built real-world, end-to-end commercial products powered by Pawa AI — harnessing advanced reasoning, multimodality, local voice, and accessibility to solve everyday challenges. > [card] [Pawa Chat](https://pawa-ai.com/chat) > > Built on Pawa AI. A free AI assistant for local SMEs instant help and individuals to discover knowledge, brainstorm ideas, summarize information, and get creative help — powered by our agentic, multilingual reasoning models. > [card] [Pawa Pay](/products/pawa-pay) > > Built on Pawa AI. Click & Write to Pay — Pawa Pay is an AI-powered payment solution for transactions, bills, and bundles in your everyday language > [card] [Pawa Resume](/products/pawa-resume) > > Built on Pawa AI. Resume is an AI-powered agent career assistant to craft standout resumes, navigation job applications, and guide your professional growth. > [card] [Pawa Serve](/products/pawa-serve) > > Built on Pawa AI. A complete AI customer service platform for building and deploying multilingual, voice-ready support agents that deliver natural, human-like assistance. *** ## Start Building Your Own Today. Pawa AI offers different features, whether you’re a **developer**, a **founder**, or an **enterprise team**, Pawa AI helps you build intelligent applications out of the box with: > [card] [Chat & Reasoning](/capabilities/chat-and-text-generation) > > Build conversational agents and reasoning systems with support for structured outputs and function calling. > [card] [Multimodal Inputs](/capabilities/vision) > > Combine text and image understanding to power your creative and analytical apps. > [card] [Tools Calling](/capabilities/tools-calling) > > Orchestrate workflows in your apps by letting models connect with external tools and APIs, for things like payments, real time informations. > [card] [Documents Understanding](/capabilities/documents-parsing) > > Let your system ingest, search, and understand documents such as audio files, images, docs, pdf, spreadsheets, pptx seamlessly with extractions capabilities. > [card] [Agents](/agents/introduction) > > Build autonomous AI agents that can reason, plan, and act — connecting models with tools, memory, and workflows to accomplish complex tasks. > [card] [Web Browsing](/capabilities/web-browsing) > > Let your apps browse the internet in real time — retrieving fresh information, verifying facts, and enhancing responses beyond training data. > [card] [Speech To Text](/capabilities/audio-transcription) > > Convert spoken language into accurate, transcribed text with multilingual support — perfect for voice commands, meeting notes, and accessibility. > [card] [Text To Speech](/capabilities/audio-transcription) > > Generate natural, human-like speech from text in multiple languages and voices — ideal for assistants, accessibility, and interactive apps. *** ## Community & Support We’re building an **AI ecosystem for Africa and the world**. Connect with us, share feedback, and showcase your projects. > [card] [Join the community](https://teams.live.com/l/community/FEAWxSeAW2y8D-orAI) > > Connect with other developers building with Pawa AI. > [card] [Support & Help](https://api.whatsapp.com/send/?phone=255688067709\&text\&type=phone_number\&app_absent=0) > > Access FAQs, guides, and direct support from the Pawa AI team. # Features Source: https://docs.pawa-ai.com/learn-more/feature Pawa AI offers different features, whether you’re a **developer**, a **founder**, or an **enterprise team**, Pawa AI helps you build intelligent applications out of the box. ## Explore different features > [card] [Chat & Reasoning](/api-reference/chat) > > Build conversational agents and reasoning systems with support for structured outputs and function calling. > > **Example:** Create a customer service chatbot that can answer questions about products, process returns, and even schedule appointments . You can also build a virtual assistant that reasons through complex scenarios and provides tailored advice. > > ![Multimodal Inputs Example](https://mintcdn.com/sartifycoltd/h3QvoufTX15l3Mnz/images/Chat%20&%20reasoning.png?fit=max\&auto=format\&n=h3QvoufTX15l3Mnz\&q=85\&s=9885b787312737cb1f8e96c7a86dd892) > [card] [Multimodal Inputs](/api-reference/vision) > > Combine text and image understanding to power creative and analytical apps. > > **Example:** Develop an app that identifies plant diseases from photos taken by farmers, providing immediate recommendations. Or analyze product images to automatically generate descriptions for e-commerce platforms. > > ![Multimodal Inputs Example](https://mintcdn.com/sartifycoltd/h3QvoufTX15l3Mnz/images/Multimodel%20input.png?fit=max\&auto=format\&n=h3QvoufTX15l3Mnz\&q=85\&s=0c2170cd45cbab38fc32b8a6064096ab) > [card] [Tools Calling](/api-reference/tools) > > Call external functions and APIs directly from your AI agents to extend their capabilities. > > **Example:** Connect to a weather API to answer live forecast questions, trigger a payment function to process transactions, or integrate custom business logic that automates workflows. > > ![Tools Calling Example](https://mintcdn.com/sartifycoltd/h3QvoufTX15l3Mnz/images/Tools%20calling.png?fit=max\&auto=format\&n=h3QvoufTX15l3Mnz\&q=85\&s=f77cba55ec17d57d2f9b2a5f792e31e5) > [card] [Documents Understanding](/api-reference/documents) > > Automate the understanding, extraction, and parsing of document contents for RAG based use cases. > > **Example:** Parse and extract structured data such as vendor name, invoice number, amount due, and due date from scanned invoices, contracts, or reports in different formats to streamline business processes. > > ![Documents Understanding Example](https://mintcdn.com/sartifycoltd/h3QvoufTX15l3Mnz/images/Document%20understanding-1.png?fit=max\&auto=format\&n=h3QvoufTX15l3Mnz\&q=85\&s=ebac84973a6bec733595bba9ca4b88db) > [card] [Agents](/api-reference/agents) > > Agents are AI-powered assistants that can reason, plan, and take actions by connecting with external tools, APIs, and knowledge bases. They allow you to automate complex workflows, delegate tasks, and create intelligent systems that interact with the real world. > > **Example:** Build an agent that checks weather forecasts, sends SMS reminders to farmers about optimal planting times, and places seed orders automatically if inventory is low. Or create a customer support agent that integrates with your CRM, retrieves order details, and schedules follow-up calls without human intervention. > > ![Agents Example](https://mintcdn.com/sartifycoltd/h3QvoufTX15l3Mnz/images/Agents.png?fit=max\&auto=format\&n=h3QvoufTX15l3Mnz\&q=85\&s=f0c0eeabf38c4cdbb815119997ad2d0d) > [card] [Web Browsing & Payments](/api-reference/pesapay) > > Seamlessly connect AI agents to the web, or enable secure, real-time payments. With browsing, agents can fetch up-to-date information, compare products, or verify facts. With payments, they can complete transactions natively inside conversations, unlocking end-to-end commerce flows powered by AI. > > **Example:** Create an e-commerce chatbot that answers product questions, checks stock availability online, and securely payments processes directly within the chat interface. Or build a travel agent that searches flight prices on the web, compares options, and books tickets while handling payments in one smooth interaction. > > ![Web Browsing & Payments Example](https://mintcdn.com/sartifycoltd/h3QvoufTX15l3Mnz/images/web%20browsing%20and%20payment.png?fit=max\&auto=format\&n=h3QvoufTX15l3Mnz\&q=85\&s=6895dd7dafb180fb1f3e2ef042631d93) > [card] [Speech to Text](/api-reference/speech-to-text) > > Convert spoken audio into accurate text in real time. > > **Example:** Enable users to dictate messages, take notes, or control applications hands-free by speaking instead of typing. > > ![Speech to Text Example](https://mintcdn.com/sartifycoltd/h3QvoufTX15l3Mnz/images/speech%20to%20text.png?fit=max\&auto=format\&n=h3QvoufTX15l3Mnz\&q=85\&s=72361b3375f385c43d32f5e2051b2755) > [card] [Text to Speech](/api-reference/text-to-speech) > > Transform written text into natural, human-like speech. > > **Example:** Read out articles, assist visually impaired users, or provide lifelike voices for virtual assistants and chatbots. > > ![Text to Speech Example](https://mintcdn.com/sartifycoltd/h3QvoufTX15l3Mnz/images/speech%20to%20text%20-%20text%20to%20speech.png?fit=max\&auto=format\&n=h3QvoufTX15l3Mnz\&q=85\&s=166d645de6e89a181954222916578577) # Languages Supported Source: https://docs.pawa-ai.com/learn-more/languages Pawa AI is built for inclusive intelligence, supporting local and global languages so anyone can access AI regardless of where they are or what language they speak. With support for dozens of local and global languages, Pawa AI enables people and businesses to communicate, build, and interact with AI using the languages they use every day. *** Pawa AI supports a wide range of commonly used local languages across the Global South through our text and voice apis. For each endpoints (text to speech, speech to text, chat) check the languages and code allowed. **Most languages include:** * Swahili * English * French * Hausa * Igbo * Luo * Meru * Kamba * Yoruba * Zulu * Arabic * Bemba * Tswana * Nyakole * Portuguese * Amharic * Akan * Bengali * Bemba * Assamese * Bambara * Sukuma * Basaa * etc.. *** ## Expanding Language Access Our mission is to make AI truly global by supporting **underserved languages and communities**.\ Pawa AI continuously adds new languages to ensure people everywhere can interact with technology in the language they understand best. # Models Source: https://docs.pawa-ai.com/learn-more/models Pawa Models are a new family of African-built AI small language models (SLM) developed by Sartify Company Limited to open new wave of innovations in Africa. Learn about the capabilities, and how to choose the right one for your use case. ## Introducing Pawa Blaze We're thrilled to introduce Pawa Blaze, our latest advanced small language model with reasoning, agentic, multimodal, knowledge-heavy tasks and optimized for multilingual understanding and long-context applications. ### Modalities Text, Image → Text ### Context window 1M ### Features Low cost Multilingual Reasoning Tools calling Test model ## Models Categories The Pawa Models family is built to power applications ranging from chatbots and assistants to document analysis, search, reasoning and agentic systems. The following are the categories of our models * **Chat Models**: For chat, agentic, tools calling, reasoning, multilingual & multimodal. Eg.*Pawa Ember*, *Pawa Blaze*. * **Text to Speech**: For converting text to hearable audio. Eg. *Pawa Text To Speech*, * **Speech to Text**: For converting audio to readable text. Eg. *Pawa Speech To Text*. * **Embeddings**: For converting audio to readable text. Eg. *Pawa Embeddings* * **Documents Parsing**: For converting audio to readable text. *Pawa Parsing*, ### Chat Models Chat models are designed to handle conversational AI, reasoning, multilingual support, agentic and multimodal inputs. They are ideal for building chatbots, virtual assistants, and agentic systems capable of tool calling and complex problem solving.
Model Name Alias Name Description Input Type Output Type Context Length Status
pawa-v1-ember-20240924 Pawa Ember Funny & great for everyday tasks text text 100K ACTIVE
pawa-v1-blaze-20250318 Pawa Blaze Fast, visual, tools & most intelligent text, image text 1M ACTIVE
### Voice Models Chat models are designed to handle conversational AI, reasoning, multilingual support, agentic and multimodal inputs. They are ideal for building chatbots, virtual assistants, and agentic systems capable of tool calling and complex problem solving.
Model Name Alias Name Description Input Type Output Type Status
pawa-stt-v1-20240701 Pawa Speech To Text Converts spoken audio into written text for transcription or analysis. audio text ACTIVE
pawa-tts-v1-20250704 Pawa Text To Speech Generates high-quality audio from written text for narration or voice assistants. text audio ACTIVE
### Embedding Models Chat models are designed to handle conversational AI, reasoning, multilingual support, agentic and multimodal inputs. They are ideal for building chatbots, virtual assistants, and agentic systems capable of tool calling and complex problem solving.
Model Name Alias Name Description Input Type Output Type Status
pawa-embeddings-v1-20241001 Pawa Embeddings Transforms text into numerical vectors for search, similarity, or AI reasoning tasks. text embeddings ACTIVE
### Parsing Models Chat models are designed to handle conversational AI, reasoning, multilingual support, agentic and multimodal inputs. They are ideal for building chatbots, virtual assistants, and agentic systems capable of tool calling and complex problem solving.
Model Name Alias Name Description Input Type Output Type Status
pawa-v1-parser-20250809 Pawa Parsing Extracts text and structured data from various document formats for analysis or AI processing. documents text ACTIVE
## Additional Information Regarding Models #### 1.Use `web_search_tool` for auto realtime updated data Pawa chat models have no knowledge of current events or data beyond what was present in their training data.\ To incorporate realtime data with your request, please use builtin web\_search\_tool, or pass any realtime data using custom tools or RAG as context in your system prompt. #### 2. For chat models, roles should alternate. Don't send two same roles mutiple times, use contents instead, to add other informations on that role. Don't send two same roles mutiple times, use contents instead, to add other informations on that role for your conversation context. ### 3. For Image input models * Maximum image size: 25MiB * Maximum number of images: No limit * Supported image file types: `jpg/jpeg` or `png` * Any image/text input order is accepted (e.g. text prompt can precede image prompt) ### 3. For Embedding models * Maximum document size: 15MiB * Maximum number of documents: 15, upgrade to get many more. * Supported file types: `jpg/jpeg`, `png`, \`\` ### 4. For Voice models * Maximum document size: 15MiB * Maximum number of documents: 15, upgrade to get many more. * Supported file types: `jpg/jpeg`, `png`, \`\` ### 5. For Parsing models * Maximum document size: 15MiB * Maximum number of documents: 15, upgrade to get many more. * Supported file types: `jpg/jpeg`, `png`, \`\` *** ## Next Steps * [API Reference](/api-reference/introduction) * [What can i build ?](/learn-more/what-can-you-build) # Payment Type Switch Source: https://docs.pawa-ai.com/learn-more/payment-type-switch Learn about Pawa AI's two account payment types—**Subscription** and **Pay as you go**—and how to switch between them anytime without losing data. Pawa AI accounts support two payment types. You can start on either one and switch between them on the fly—your projects, API keys, bots, knowledge bases, and other data stay intact. > [!NOTE] > > Switching payment type does **not** delete or reset your account data. Click switch, and your account updates immediately. ## Payment Types > [card] Subscription > > Fixed monthly or annual billing with STARTER, PRO, or ENTERPRISE plans. Predictable costs, and **one month free** when you subscribe. Best if you want a set plan and recurring billing. > [card] Pay as you go > > Credit-based billing. You get **\$3 free credits** on sign up (Tier One). Top up anytime—your tier unlocks based on your credit balance (Tier One through Tier Four). Best if you want flexible spend that grows with you. ### At a glance | | Subscription | Pay as you go | | - | - | - | | How you pay | Monthly or annual plan | Top up credits anytime | | Plans / tiers | STARTER, PRO, ENTERPRISE | Tier One–Four (by credit balance) | | Free start | One month free | \$3 free credits | | Limits & features | Based on your plan | Based on your credit-balance tier | | Best for | Predictable recurring spend | Flexible, usage-driven spend | For full limits and features, see [Pricing](/learn-more/pricing). ## How to Switch Payment Type You can switch from Subscription to Pay as you go, or from Pay as you go to Subscription, from either of these places in the [Builders Dashboard](https://builder.pawa-ai.com/dashboard): ### Option 1: Manage → Billing **1. Open Manage** Go to **Manage** in your Builders Dashboard. **2. Open Billing** Select **Billing**. **3. Switch payment type** Click the **Switch** button for your account payment type. Your account switches immediately—no data loss. ### Option 2: Account profile settings **1. Open Settings** Go to your **account profile** settings in the Builders Dashboard. **2. Switch payment type** Click the **Switch** button for payment type. Your account updates on the fly—same data, new payment type. > [!TIP] > > Either path works the same way: click **Switch**, and your account payment type changes instantly. You can switch back whenever you need. ## After You Switch * **Subscription → Pay as you go**: Your account moves to credit-based tiers. Top up credits to unlock higher tiers. Existing resources remain available. * **Pay as you go → Subscription**: Choose STARTER, PRO, or ENTERPRISE. Recurring billing applies (with one month free when you subscribe). Existing resources remain available. You can change plans, top up, or switch payment types again at any time. See [Pricing](/learn-more/pricing) for plan and tier details. # Pricing Source: https://docs.pawa-ai.com/learn-more/pricing Simple, transparent pricing with **Subscription** plans or **Pay as you go** credit tiers. No unexpected costs due to token-based billing. Unlike most AI providers with opaque billing, Pawa AI offers clear pricing. Choose a monthly or annual **Subscription**, or **Pay as you go** with credits that unlock higher tiers as your balance grows—plus transparent per-request token usage on Pay as you go. > [!NOTE] > > **Start Free Now**: Every new builder gets **\$3 Free Credits** on sign up (Tier One). Top up anytime to unlock higher Pay as you go tiers, or subscribe to STARTER, PRO, or ENTERPRISE—**subscriptions include one month free**. ## Choose How You Pay > [tab] Pay as you go > > Top up anytime. Your tier unlocks based on your credit balance—start with free credits and grow as you go. > > > [card] [Pay as you go](https://pawa-ai.com/auth) > > > > **\$3 Free Credits** on sign up. Start with tiers that grow with you. Top up anytime—your tier unlocks based on your credit balance. > > ### Credit Tiers > > | Features | Tier One less than \$14 credits | Tier Two \$15 to \$34 credits | Tier Three \$35 to \$149 credits *Most Popular* | Tier Four \$150 credits and above | > | - | - | - | - | - | > | Best for | Explore Pawa AI with core access and community support at no cost | Higher limits and added tools for individuals and small teams | Advanced limits, observability, and custom controls for growing teams | Unlimited scale, dedicated security, and support for large organizations | > | Get started | Top up to unlock | Top up to unlock | Top up to unlock | Top up to unlock | > | All APIs access | ✅ | ✅ | ✅ | ✅ | > | Knowledge bases | Limited | 5 max | 15 max | Unlimited | > | Requests per minute | Basic rate limits | 50 | 500 | Unlimited | > | Built-in web search tool | ✅ | ✅ | ✅ | ✅ | > | Max agentic bots | Limited | 5 | 15 | Unlimited | > | Deployment channels | Custom, Web | Custom, Web | Custom, Web, WhatsApp, USSD | Custom, Web, WhatsApp, USSD | > | Bot branding | — | Pawa AI word branding | Custom branding word | Custom branding word | > | Transcribe workspaces | Limited | 3 max | 10 max | Unlimited | > | Files per workspace | Limited | 15 | 50 | 200 | > | Unlimited export formats (pdf, docx, txt, srt etc.) | — | ✅ | ✅ | ✅ | > | Enhance & Translate scripts | — | ✅ | ✅ | ✅ | > | Usage Analytics | ✅ | ✅ | ✅ | ✅ | > | Observability | — | — | ✅ | ✅ | > | Security checks | — | Basic autonomous model security checks | Advanced autonomous model security checks | Dedicated autonomous model security checks | > | Fine-tuning | — | — | No-code fine-tuning our models | No-code fine-tuning our models & export weights locally | > | Free APIs integration & deployment | — | — | ✅ | ✅ | > | Monitoring & maintenance | — | — | Regular monitoring & maintenance support | Regular monitoring & maintenance support | > | Support | Community support and email | Community support and email | Custom support | Dedicated support | > > > [!TIP] > > > > Free \$3 credits are provided upon sign up. Top up anytime—your tier unlocks based on your credit balance. Every API response includes **usage tokens in and out** so you can see exactly what each request consumed. > > ### Usage in every API response > > On Pay as you go, each API response includes **usage** with tokens **in** (input) and **out** (output). Use this to track consumption per request and reconcile against your credit balance. > > ### How Pay as you go is charged > > Credits are deducted based on what you use. Rates below are in **USD**. > > #### Chat & generation > > | Usage | Price | > | - | - | > | Input tokens | \$0.50 per 1M tokens | > | Output tokens | \$0.70 per 1M tokens | > | Reasoning tokens | \$0.90 per 1M tokens | > > #### Speech (TTS & STT) > > | Usage | Price | > | - | - | > | TTS input tokens | \$0.75 per 1M tokens | > | TTS output tokens | \$1.50 per 1M tokens | > | STT (speech-to-text) | \$1.70 per minute of audio | > > #### Embeddings & knowledge base > > | Usage | Price | > | - | - | > | Embeddings input tokens | \$0.05 per 1M tokens | > | Knowledge base storage | \$0.00005 per KB | > > #### Credits, deposits & tier thresholds > > | Setting | Value | What it means | > | - | - | - | > | Free signup credit | \$3 | Credited when you sign up (Tier One) | > | Minimum deposit | \$15 | Lowest amount you can top up | > | Tier One (Free) | Less than \$14 credits | Explore with core access | > | Tier Two (Starter) | \$15 to \$34 credits | Higher limits for individuals and small teams | > | Tier Three (Pro) | \$35 to \$149 credits | Advanced limits and controls | > | Tier Four (Enterprise) | \$150 credits and above | Unlimited scale and dedicated support | > > > [!NOTE] > > > > Your tier is based on your **credit balance**, not lifetime spend. Top up to unlock higher tiers; usage deducts from your balance at the rates above. > [tab] Subscription > > Predictable monthly or annual billing—**one month free** when you subscribe. Know your costs upfront and scale without worrying about usage spikes. > > ### Pricing Plans > > | Features | STARTER \$15/month or \$155/year | PRO \$35/month or \$360/year | ENTERPRISE \$150/month or \$1550/year | > | - | - | - | - | > | All APIs access | ✅ | ✅ | ✅ | > | Knowledge bases | 5 | 15 | Unlimited | > | Requests per minute (Chat, Voices, Agent Chat) | 50 each | 500 each | Unlimited | > | Built-in web search tool | ✅ | ✅ | ✅ | > | Max agentic bots | 5 | 15 | Unlimited | > | Deployment channels | Custom, Web | Custom, Web, WhatsApp, USSD | Custom, Web, WhatsApp, USSD | > | Bot branding | Pawa AI word branding | Custom branding word | Custom branding word | > | Transcribe workspaces | 3 | 10 | Unlimited | > | Files per workspace | 15 | 50 | 200 | > | Unlimited export formats (pdf, docx, txt, srt etc.) | ✅ | ✅ | ✅ | > | Enhance & Translate scripts | ✅ | ✅ | ✅ | > | Usage Analytics | ✅ | ✅ | ✅ | > | Observability | — | ✅ | ✅ | > | Security checks | Basic | Advanced | Dedicated | > | Fine-tuning | — | No-code fine-tuning | No-code fine-tuning + export weights locally | > | Free APIs integration & deployment | — | ✅ | ✅ | > | Monitoring & maintenance | — | ✅ | ✅ | > | Support | Community & email | Custom | Dedicated | ## Why Our Pricing? > [card] Predictable Costs > > No surprise bills. Know exactly what you'll pay—whether you subscribe or top up credits. > [card] Transparent Usage > > Subscriptions stay simple with fixed plans. On Pay as you go, every response reports tokens in and out so you always know what you used. > [card] Easy Budgeting > > Plan your AI expenses like any other software cost. Simple and transparent. > [card] Scale with Confidence > > Unlock higher tiers when you're ready—by topping up credits or upgrading your subscription. ## Frequently Asked Questions > [accordion] What's the difference between Pay as you go and Subscription? > > **Pay as you go** uses credit balance: top up anytime and your tier unlocks based on how many credits you have. **Subscription** is a fixed monthly or annual plan (STARTER, PRO, or ENTERPRISE) with predictable recurring billing. > [accordion] How do Pay as you go tiers work? > > You start with \$3 free credits (Tier One). Your tier is based on your credit balance: Tier Two at \$15–\$34, Tier Three at \$35–\$149, and Tier Four at \$150 and above. Top up anytime to unlock higher limits and features. > [accordion] Can I change my plan anytime? > > Yes! You can upgrade or downgrade your subscription, top up Pay as you go credits, or switch from Subscription to Pay as you go and vice versa on the fly—without losing any data. Subscription changes take effect immediately, and we'll prorate any billing differences. > [accordion] What happens if I exceed my request limits? > > If you exceed your request limits, we'll notify you and offer options to upgrade your plan, top up credits to unlock a higher tier, or purchase additional capacity. > [accordion] Do you offer custom pricing for high-volume users? > > Yes! Contact our sales team for custom pricing if you need more than what our ENTERPRISE or Tier Four plans offer. > [accordion] Is there a free trial for paid plans? > > All new users start with \$3 free credits on Tier One, or one month free if they choose a Subscription. You can top up, upgrade, or switch plans when you're ready. *** ## Ready to Get Started? > [card] [Start Free](https://pawa-ai.com/auth) > > Create your free account, get \$3 credits, and start building with Pawa AI today. > [card] [Contact Sales](https://api.whatsapp.com/send/?phone=255688067709\&text\&type=phone_number\&app_absent=0) > > Need custom pricing or have questions? Our team is here to help. # What to build ? Source: https://docs.pawa-ai.com/learn-more/what-can-you-build Explore practical use cases you can build powered by Pawa AI with ease and low cost in Africa. Learn how our APIs can help you build intelligent applications, automate workflows, and enhance decision-making. ## Language-Powered Solutions * **Multilingual Customer Support:** Integrate Pawa AI APIs into your customer service platforms (chatbots, email systems) to automatically translate customer inquiries and responses in various African languages (Swahili, Hausa, Yoruba, Igbo, etc.). * **Content Localization:** Automatically translate marketing materials, product descriptions, website content, and app interfaces into multiple African languages. * **Sentiment Analysis in Local Languages:** Analyze customer feedback (reviews, social media comments) in African languages to understand sentiment towards your brand or products. * **Voice-Based Applications:** Power voice assistants or interactive voice response (IVR) systems that understand and respond in local languages. Think of automated phone support or voice-controlled applications tailored to African users. **How Pawa AI helps:** The **Completion API** and **Text Generation API** allow you to generate coherent, context-aware text with configurable parameters like temperature, length, and style. *** ## Document Processing & Information Extraction * **Automated Invoice Processing:** Extract key data from invoices written in various formats and languages commonly used in African business contexts (e.g., handwritten invoices). This streamlines accounts payable processes. * **Contract Analysis:** Analyze contracts written in local languages to identify key clauses, obligations, and risks. This can be used for legal review or compliance checks. * **Data Extraction from Government Documents:** Extract information from government forms, permits, or licenses written in local languages – useful for businesses dealing with regulatory compliance. * **Automated Data Entry:** Automatically populate databases with information extracted from scanned documents or PDFs – saving time and reducing errors. **How Pawa AI helps:** Leveraging Docipro’s capabilities through its APIs allows for efficient document processing and data extraction across diverse formats and languages. *** ## Intelligent Agents & Workflow Automation * **Task Automation Agents:** Build agents that can perform multi-step workflows including fetching data from various sources (including mobile money platforms), making decisions based on that data ,or interacting with external APIs.. * **Custom Tools Integration:** Connect agents to APIs like Pesa Pay (for mobile money transactions), web services or internal tools specific to your business needs.. * **Proactive AI Agents**: Develop agents that monitor events (e.g., transaction patterns) and take action autonomously (e.g., flagging suspicious activity). **How Pawa AI helps:** Agents use **Function Calling**, **SLMs/LLMs**, and contextual memory to orchestrate complex tasks efficiently using the available APIs.. *** ## Audio & Transcription Applications * **Transcribe Meetings & Calls**: Convert audio into text automatically using **Transcription API**. This is crucial for capturing important discussions in various African languages where written records may be limited.. * **Voice Assistants**: Build AI assistants capable of understanding and responding to voice input – enabling hands-free interaction for users.. * **Audio Summarization**: Summarize audio content into concise notes or key points – saving time when reviewing long recordings.. **How Pawa AI helps:** Audio models like **Voxtral Mini** and **Voxtral Small** allow high-accuracy transcription and voice-to-text processing even with varying accents common across different African regions.. *** ## Fintech & Payment Automation * **Automated Transactions**: Process payments or transfers via APIs (e.g., mobile money in Tanzania). This simplifies financial operations for businesses.. * **Invoice & Payment Summaries**: Generate and summarize billing information automatically – improving financial reporting accuracy.. * **Financial Analytics**: Provide insights or alerts on transaction patterns – helping businesses identify trends and manage risk.. **How Pawa AI helps:** Use **Agents**, combined with **custom APIs**, like Pesa Pay to integrate secure and automated payment solutions into your applications seamlessly.. *** ## Analytics & Observability * **Usage Monitoring**: Track how users interact with your applications or services - providing valuable feedback on user behavior.. * **Business Insights**: Generate analytics reports or dashboards using AI-powered summaries - enabling data-driven decision making.. * **Alerting & Monitoring**: Detect anomalies and get proactive insights for better decision-making - allowing you to address issues before they escalate.. **How Pawa AI helps:** Observability features combined with the AI models allow automated analysis reporting real time insights through the available APIs . *** ### 🔗 Summary - Use Cases & Associated APIs | Use Case | Relevant Pawa AI API(s) | Notes | | - | - | - | | Multilingual Chatbot | Chat request | Essential for handling diverse language inputs | | Invoice Data Extraction | documents parsing | Streamlines accounting processes | | Automated Mobile Money Payments | Tools calling + Custom Payment APIs (e.g., Pesa Pay) | Enables seamless financial transactions | | Voice Transcription of Customer Calls | text to speech, speech to text | Improves call center efficiency | | Sentiment Analysis of Social Media Posts | Chat request | Provides valuable market research insights | *** > With Pawa AI you can: Automate text document audio workflows, Build intelligent search retrieval systems, Create autonomous agents, Integrate fintech analytics business automation solutions, Integrate seamlessly into web mobile enterprise applications . Pawa AI APIs provide flexibility scalability advanced capabilities bring innovative ideas faster reliably # Agents Source: https://docs.pawa-ai.com/python-sdk/agents Create, manage, and chat with agents using the Pawa AI Python SDK. Agents are available under `client.agents`. Chat with an agent via `client.agents.chat.create(...)`, which supports non-streaming and streaming the same way as chat. See the [Agents API reference](/api-reference/endpoint/agents/introduction). ## Create an agent ```python theme={null} from pawa_ai import PawaAI client = PawaAI() agent = client.agents.create( name="TutorAI", description="TutorAI helps students with secondary school subjects.", instruction=( "Teach Form 1–4 subjects. Answer only academic questions " "related to the assigned curriculum." ), intents=["Be gentle", "Be detailed"], knowledgeBaseId=159, tools=[{"type": "pawa_tool", "pawa_tool": "web_search_tool"}], ) print(agent) ``` ## List and retrieve ```python theme={null} agents = client.agents.list() print(agents) agent = client.agents.retrieve(agent_id=42) print(agent) ``` ## Update and delete ```python theme={null} updated = client.agents.update( 42, name="TutorAI v2", description="Updated tutoring agent", instruction="Focus on math and science.", ) print(updated) deleted = client.agents.delete(42) print(deleted) ``` ## Agent chat (non-streaming) ```python theme={null} from pawa_ai import PawaAI client = PawaAI() response = client.agents.chat.create( model="pawa-v1-ember-20240924", message={ "role": "user", "content": [{"type": "text", "text": "Explain photosynthesis simply."}], }, agents=[42], stream=False, ) print(response) ``` ## Agent chat (streaming) ```python theme={null} from pawa_ai import PawaAI client = PawaAI() with client.agents.chat.create( model="pawa-v1-ember-20240924", message={ "role": "user", "content": [{"type": "text", "text": "Summarize Newton's three laws."}], }, agents=[42], stream=True, ) as stream: for delta in stream.text_deltas(): print(delta, end="", flush=True) print() print(stream.collect()) ``` ## Handoff / multi-agent Pass multiple agent IDs so a router can hand off to specialists: ```python theme={null} response = client.agents.chat.create( model="pawa-v1-blaze-20250318", message={ "role": "user", "content": [{"type": "text", "text": "Help me with algebra homework."}], }, agents=[10, 11, 12], stream=False, ) print(response) ``` # Async, retries & errors Source: https://docs.pawa-ai.com/python-sdk/async-retries-errors Async client, retry configuration, and error handling for the Pawa AI Python SDK. ## Async client ```python theme={null} import asyncio from pawa_ai import AsyncPawaAI async def main(): async with AsyncPawaAI() as client: response = await client.chat.create( model="pawa-v1-ember-20240924", messages=[ { "role": "user", "content": [{"type": "text", "text": "Habari yako?"}], } ], stream=False, ) print(response["data"]["request"][0]["message"]["content"]) stream = await client.chat.create( model="pawa-v1-ember-20240924", messages=[ { "role": "user", "content": [{"type": "text", "text": "Explain embeddings briefly."}], } ], stream=True, ) text = await stream.collect_text() print(text) asyncio.run(main()) ``` Every sync resource has an async counterpart on `AsyncPawaAI` (`client.models`, `client.voice`, `client.transcribe`, and so on). ## Retries Retries apply to rate limits (`429`), server errors (`500` / `502` / `503` / `504`), and connection failures. The SDK respects `Retry-After` when present. ```python theme={null} from pawa_ai import PawaAI, RetryConfig client = PawaAI( retry_config=RetryConfig( max_retries=3, initial_delay=0.5, max_delay=8.0, exponential_base=2.0, jitter=0.1, ) ) ``` You can also set `max_retries` on the client constructor for a simpler default. ## Error handling ```python theme={null} from pawa_ai import ( PawaAI, AuthenticationError, RateLimitError, BadRequestError, NotFoundError, APIConnectionError, ) client = PawaAI() try: client.chat.create( model="pawa-v1-ember-20240924", messages=[ {"role": "user", "content": [{"type": "text", "text": "Hello"}]} ], ) except AuthenticationError as e: print(f"Auth failed: {e.message}") except RateLimitError as e: print(f"Rate limited ({e.status_code}): {e.message}") except BadRequestError as e: print(f"Bad request: {e.message}") except NotFoundError as e: print(f"Not found: {e.message}") except APIConnectionError as e: print(f"Connection error: {e}") ``` ## Links * **PyPI:** [https://pypi.org/project/pawa-ai/#description](https://pypi.org/project/pawa-ai/#description) * **GitHub:** [https://github.com/Sartify/pawa-ai-python](https://github.com/Sartify/pawa-ai-python) # Chat Source: https://docs.pawa-ai.com/python-sdk/chat Chat completions with the Python SDK — basic, streaming, tools, structured output, vision, reasoning, and RAG. `client.chat.create(...)` maps to [`POST /chat/request`](/api-reference/endpoint/chat/request). Non-streaming calls return the API JSON as a `dict`. Streaming calls return a `ChatCompletionStream` context manager. ## Basic chat (non-streaming) ```python theme={null} from pawa_ai import PawaAI client = PawaAI() response = client.chat.create( model="pawa-v1-ember-20240924", messages=[ { "role": "system", "content": [ { "type": "text", "text": "You are a helpful assistant for developers in Africa.", } ], }, { "role": "user", "content": [ {"type": "text", "text": "Hello! How can I use AI in my app?"} ], }, ], temperature=0.2, top_p=0.95, max_tokens=1024, stream=False, ) print(response["success"]) print(response["data"]["request"][0]["message"]["content"]) print(response["data"].get("usage")) ``` `client.chat.completions(...)` is an alias for `create`. ## Streaming chat Set `stream=True` and iterate token deltas as they arrive: ```python theme={null} from pawa_ai import PawaAI client = PawaAI() with client.chat.create( model="pawa-v1-ember-20240924", messages=[ { "role": "user", "content": [{"type": "text", "text": "Explain RAG in simple terms"}], } ], stream=True, ) as stream: for delta in stream.text_deltas(): print(delta, end="", flush=True) completion = stream.collect() print(completion["data"]["request"][0]["message"]["content"]) ``` ## Vision (multimodal) ```python theme={null} from pawa_ai import PawaAI client = PawaAI() response = client.chat.create( model="pawa-v1-blaze-20250318", messages=[ { "role": "user", "content": [ {"type": "text", "text": "What is in this image?"}, { "type": "image_url", "image_url": {"url": "https://example.com/photo.jpg"}, }, ], } ], stream=False, ) print(response["data"]["request"][0]["message"]["content"]) ``` ## Tools calling ### Built-in tools ```python theme={null} from pawa_ai import PawaAI client = PawaAI() response = client.chat.create( model="pawa-v1-blaze-20250318", messages=[ { "role": "user", "content": [ { "type": "text", "text": "Find the latest news about Pawa AI and summarize it.", } ], } ], tools=[ {"type": "pawa_tool", "pawa_tool": "web_search_tool"}, ], stream=False, ) print(response["data"]["request"][0]["message"]["content"]) ``` ### Custom tools (non-streaming) ```python theme={null} from pawa_ai import PawaAI client = PawaAI() tools = [ { "type": "function", "function": { "name": "convert_usd_to_tsh", "description": "Converts an amount in USD to Tanzanian Shillings.", "strict": True, "parameters": { "type": "object", "properties": { "amount_usd": { "type": "number", "description": "Amount in USD", } }, "required": ["amount_usd"], "additionalProperties": False, }, }, } ] messages = [ { "role": "user", "content": [{"type": "text", "text": "Convert 45 USD to TSH"}], } ] response = client.chat.create( model="pawa-v1-blaze-20250318", messages=messages, tools=tools, stream=False, ) # Inspect tool_calls on the assistant message, run your function, # then append a tool role message and call create() again for the final answer. print(response) ``` > [!NOTE] > > When the model returns a tool call, the API does not stream the tool-call payload even if `stream=True`. Handle the tool result, then continue the conversation. ## Structured output Request JSON that matches a schema with `response_format`: ```python theme={null} from pawa_ai import PawaAI client = PawaAI() response = client.chat.create( model="pawa-v1-ember-20240924", messages=[ { "role": "system", "content": [ { "type": "text", "text": "Extract resume information into structured JSON.", } ], }, { "role": "user", "content": [ { "type": "text", "text": ( "Name: Jane Doe, Email: jane.doe@example.com, " "Phone: +255 688067709, Education: B.Sc. Computer Science, UDSM, 2020, " "Experience: Software Engineer at TechCorp (Jan 2021 – Dec 2023), " "Skills: Python, JavaScript, AWS, Docker" ), } ], }, ], response_format={ "type": "json_schema", "json_schema": { "name": "resume_schema", "strict": True, "schema": { "type": "object", "properties": { "full_name": {"type": "string"}, "email": {"type": "string"}, "phone": {"type": "string"}, "education": { "type": "array", "items": { "type": "object", "properties": { "institution": {"type": "string"}, "degree": {"type": "string"}, "graduation_year": {"type": "integer"}, }, "required": ["institution", "degree", "graduation_year"], }, }, "experience": { "type": "array", "items": { "type": "object", "properties": { "company": {"type": "string"}, "role": {"type": "string"}, "start_date": {"type": "string", "format": "date"}, "end_date": {"type": "string", "format": "date"}, "responsibilities": { "type": "array", "items": {"type": "string"}, }, }, "required": ["company", "role", "start_date", "end_date"], }, }, "skills": {"type": "array", "items": {"type": "string"}}, }, "required": [ "full_name", "email", "phone", "education", "experience", "skills", ], "additionalProperties": False, }, }, }, stream=False, ) import json content = response["data"]["request"][0]["message"]["content"] print(json.loads(content) if isinstance(content, str) else content) ``` ### Structured output with streaming ```python theme={null} from pawa_ai import PawaAI client = PawaAI() with client.chat.create( model="pawa-v1-ember-20240924", messages=[ { "role": "user", "content": [ { "type": "text", "text": "Return a JSON object with keys city and country for Dar es Salaam.", } ], } ], response_format={ "type": "json_schema", "json_schema": { "name": "place", "strict": True, "schema": { "type": "object", "properties": { "city": {"type": "string"}, "country": {"type": "string"}, }, "required": ["city", "country"], "additionalProperties": False, }, }, }, stream=True, ) as stream: for delta in stream.text_deltas(): print(delta, end="", flush=True) print() print(stream.collect()) ``` ## Reasoning ```python theme={null} from pawa_ai import PawaAI client = PawaAI() response = client.chat.create( model="pawa-v1-blaze-20250318", messages=[ { "role": "user", "content": [ { "type": "text", "text": "Plan a 3-step approach to digitize receipts for a small shop.", } ], } ], reasoning={"effort": "medium"}, stream=False, ) print(response["data"]["request"][0]["message"]["content"]) ``` ## RAG with a knowledge base ```python theme={null} from pawa_ai import PawaAI client = PawaAI() response = client.chat.create( model="pawa-v1-ember-20240924", messages=[ { "role": "user", "content": [ {"type": "text", "text": "What does our returns policy say about refunds?"} ], } ], rag={"knowledgeBaseId": 159, "topK": 5}, stream=False, ) print(response["data"]["request"][0]["message"]["content"]) ``` ## In-memory chat Pass prior turns with `memoryChat` so the model has conversation context: ```python theme={null} from pawa_ai import PawaAI client = PawaAI() response = client.chat.create( model="pawa-v1-ember-20240924", messages=[ { "role": "user", "content": [{"type": "text", "text": "Remind me what I asked earlier."}], } ], memoryChat=[ { "role": "user", "content": [{"type": "text", "text": "My shop is in Arusha."}], }, { "role": "assistant", "content": [{"type": "text", "text": "Got it — your shop is in Arusha."}], }, ], stream=False, ) print(response["data"]["request"][0]["message"]["content"]) ``` # Documents Source: https://docs.pawa-ai.com/python-sdk/documents Parse documents with the Pawa AI Python SDK. `client.documents.parse(...)` uploads files to [`POST /documents/parse`](/api-reference/endpoint/documents/parse) and returns extracted text and structure. ## Parse a document ```python theme={null} from pawa_ai import PawaAI client = PawaAI() response = client.documents.parse( documents=["invoice.pdf"], model="pawa-v1-parser-20250809", ) print(response) ``` ## Multiple files ```python theme={null} response = client.documents.parse( documents=["report.pdf", "notes.docx"], model="pawa-v1-parser-20250809", ) print(response) ``` You can also pass raw bytes or `(filename, bytes, content_type)` tuples when files are already in memory. # Introduction Source: https://docs.pawa-ai.com/python-sdk/introduction Official Python SDK for the Pawa AI API — install, authenticate, and call every endpoint from models to transcribe. The **Pawa AI Python SDK** (`pawa-ai`) is the official client for the Pawa AI API. It wraps chat, models, voice, embeddings, document parsing, agents, knowledge bases, and transcription behind a typed Python interface — with sync and async clients, streaming helpers, and automatic retries. Use it when you want to call the same surface documented in the [API reference](/api-reference/introduction) without hand-writing HTTP requests. ## Requirements * Python **3.9+** * A Pawa AI API key from the [Builders Dashboard](https://builder.pawa-ai.com/dashboard?page=keys) ## Installation ```bash theme={null} pip install pawa-ai ``` ## Authentication Set your API key as an environment variable (recommended): ```bash theme={null} export PAWA_AI_API_KEY="your_api_key_here" ``` Then create a client: ```python theme={null} from pawa_ai import PawaAI client = PawaAI() ``` Or pass the key explicitly: ```python theme={null} from pawa_ai import PawaAI client = PawaAI(api_key="your_api_key_here") ``` ## Quick example ```python theme={null} from pawa_ai import PawaAI client = PawaAI() response = client.chat.create( model="pawa-v1-ember-20240924", messages=[ { "role": "user", "content": [{"type": "text", "text": "Habari yako?"}], } ], stream=False, ) print(response["data"]["request"][0]["message"]["content"]) ``` ## API coverage | Resource | SDK path | Methods | | - | - | - | | Models | `client.models` | `list`, `retrieve` | | Chat | `client.chat` | `create`, `completions` | | Voice | `client.voice` | `text_to_speech.create`, `speech_to_text.create` | | Vectors | `client.vectors` | `create`, `embeddings` | | Documents | `client.documents` | `parse` | | Agents | `client.agents` | `create`, `update`, `delete`, `list`, `retrieve`, `chat.create` | | Storage | `client.storage.knowledge_base` | CRUD, `list_files`, `semantic_retrieval` | | Transcribe | `client.transcribe.workspaces` | CRUD + transcription management | Chat and agent chat support both **non-streaming** (`stream=False`) and **streaming** (`stream=True`) responses. ## Source & package * **PyPI:** [pypi.org/project/pawa-ai](https://pypi.org/project/pawa-ai/#description) * **GitHub:** [github.com/Sartify/pawa-ai-python](https://github.com/Sartify/pawa-ai-python) > [card] [PyPI package](https://pypi.org/project/pawa-ai/#description) > > Install with pip and read the package description. > [card] [Source on GitHub](https://github.com/Sartify/pawa-ai-python) > > Browse the SDK source, examples, and issue tracker. # Models Source: https://docs.pawa-ai.com/python-sdk/models List and retrieve Pawa AI models with the Python SDK. Use `client.models` to discover available models and fetch a single model by ID. See the [Models API reference](/api-reference/endpoint/models/introduction) for response fields. ## List models ```python theme={null} from pawa_ai import PawaAI client = PawaAI() models = client.models.list(limit=10) print(models.success) for model in models.models: print(f"{model.name} ({model.model_type})") ``` ### Filter and paginate ```python theme={null} models = client.models.list( search="ember", model_type="chat", page=1, limit=20, ) ``` ### Raw JSON response ```python theme={null} payload = client.models.list(limit=5, raw=True) print(payload) ``` ## Retrieve a model ```python theme={null} from pawa_ai import PawaAI client = PawaAI() model = client.models.retrieve(model_id=1) print(model.name) print(model.model_type) ``` ```python theme={null} payload = client.models.retrieve(1, raw=True) print(payload) ``` # Storage Source: https://docs.pawa-ai.com/python-sdk/storage Manage knowledge bases and run semantic retrieval with the Python SDK. Knowledge base APIs live under `client.storage.knowledge_base`. See the [Storage API reference](/api-reference/endpoint/storage/introduction). ## Create a knowledge base ```python theme={null} from pawa_ai import PawaAI client = PawaAI() kb = client.storage.knowledge_base.create( name="Pawa Knowledge Base", description="Product docs and FAQs for customer support agents.", ) print(kb) ``` ## List, retrieve, update, delete ```python theme={null} bases = client.storage.knowledge_base.list(page=1, limit=20, search="support") print(bases) kb = client.storage.knowledge_base.retrieve(knowledge_base_id=159) print(kb) updated = client.storage.knowledge_base.update( 159, name="Support KB", description="Updated description for the support knowledge base.", ) print(updated) deleted = client.storage.knowledge_base.delete(159) print(deleted) ``` ## List files in a knowledge base ```python theme={null} files = client.storage.knowledge_base.list_files(knowledge_base_id=159) print(files) ``` ## Semantic retrieval ```python theme={null} from pawa_ai import PawaAI client = PawaAI() results = client.storage.knowledge_base.semantic_retrieval( knowledgeBaseId=159, query="What is the refund window?", topK=5, ) print(results) ``` Use retrieved chunks in chat via the `rag` parameter — see [Chat](/python-sdk/chat#rag-with-a-knowledge-base). # Transcribe Source: https://docs.pawa-ai.com/python-sdk/transcribe Manage transcription workspaces and uploads with the Pawa AI Python SDK. Long-form transcription workspaces are under `client.transcribe.workspaces`. See the [Transcribe API reference](/api-reference/endpoint/transcribe/introduction). For short speech-to-text conversion, use [Voice → Speech to text](/python-sdk/voice#speech-to-text). ## Create a workspace ```python theme={null} from pawa_ai import PawaAI client = PawaAI() workspace = client.transcribe.workspaces.create(name="My Workspace") print(workspace) ``` ## List and retrieve workspaces ```python theme={null} workspaces = client.transcribe.workspaces.list() print(workspaces) workspace = client.transcribe.workspaces.retrieve(workspace_id=5) print(workspace) ``` ## Update and delete a workspace ```python theme={null} updated = client.transcribe.workspaces.update(5, name="Podcasts") print(updated) deleted = client.transcribe.workspaces.delete(5) print(deleted) ``` ## Upload transcriptions ```python theme={null} from pawa_ai import PawaAI client = PawaAI() result = client.transcribe.workspaces.upload_transcriptions( workspace_id=5, files=["episode-01.mp3", "episode-02.mp3"], ) print(result) ``` ## List transcriptions ```python theme={null} transcriptions = client.transcribe.workspaces.list_transcriptions( workspace_id=5, page=1, limit=20, ) print(transcriptions) ``` ## Update a transcription ```python theme={null} updated = client.transcribe.workspaces.update_transcription( workspace_id=5, transcription_id=12, # pass fields supported by the Transcribe update API ) print(updated) ``` ## Delete a transcription ```python theme={null} deleted = client.transcribe.workspaces.delete_transcription( workspace_id=5, transcription_id=12, ) print(deleted) ``` # Vectors Source: https://docs.pawa-ai.com/python-sdk/vectors Create embeddings with the Pawa AI Python SDK. `client.vectors.create(...)` maps to [`POST /vectors/embedding`](/api-reference/endpoint/vectors/embeddings). ## Create embeddings ```python theme={null} from pawa_ai import PawaAI client = PawaAI() response = client.vectors.create( model="pawa-embeddings-v1-20241001", sentences=["Embed this sentence.", "And this one too."], lang="multi", ) print(response.success) print(len(response.embeddings)) print(len(response.embeddings[0])) # vector dimensions ``` You can also pass `input=` instead of `sentences=`: ```python theme={null} response = client.vectors.create( model="pawa-embeddings-v1-20241001", input=["Habari", "Karibu"], lang="sw", ) ``` ### Raw JSON ```python theme={null} payload = client.vectors.create( sentences=["hello"], raw=True, ) print(payload) ``` `client.vectors.embeddings(...)` is an alias for `create`. # Voice Source: https://docs.pawa-ai.com/python-sdk/voice Text-to-speech and speech-to-text with the Pawa AI Python SDK. Voice APIs live under `client.voice`. See the [Voice API reference](/api-reference/endpoint/voice/introduction). ## Text to speech Returns raw audio bytes (typically MPEG): ```python theme={null} from pawa_ai import PawaAI client = PawaAI() audio = client.voice.text_to_speech.create( model="pawa-tts-v1-20250704", text="Hello, this is Pawa AI speaking!", voice="liora", ) with open("output.mp3", "wb") as f: f.write(audio) ``` Supported voices include `ame`, `liora`, and `ayana`. ## Speech to text ```python theme={null} from pawa_ai import PawaAI client = PawaAI() response = client.voice.speech_to_text.create( files=["audio_file.wav"], model="pawa-stt-v1-20240701", language="sw", is_speaker_diarization=False, ) print(response) ``` Optional parameters: ```python theme={null} response = client.voice.speech_to_text.create( files=["meeting.wav"], model="pawa-stt-v1-20240701", language="en", is_speaker_diarization=True, prompt="Transcribe a product meeting.", temperature=0.0, ) ``` `client.voice.speech_to_text.transcribe(...)` is an alias for `create`. # Blueprints Codes Source: https://docs.pawa-ai.com/resources/blueprints-codes Explore Pawa AI blueprint code examples on GitHub. # Community Source: https://docs.pawa-ai.com/resources/community Join the Pawa AI community on Hugging Face. # Feedback Source: https://docs.pawa-ai.com/resources/feedback Share feedback with the Pawa AI team on WhatsApp. # Privacy Policy Source: https://docs.pawa-ai.com/resources/privacy-policy Read the Pawa AI privacy policy. # Terms of Service Source: https://docs.pawa-ai.com/resources/terms-of-service Read the Pawa AI terms and conditions.