Skip to main content
Sonamu is built on the Vercel AI SDK and provides various AI capabilities. You can easily implement text generation, streaming, tool calling, speech recognition, and more.

Vercel AI SDK

This is the AI framework that Sonamu uses. Key Features:
  • Text Generation
  • Streaming Responses
  • Tool Calling
  • Structured Output
  • Transcription

Text Generation

generateText()

Generates plain text.

Message-Based Conversation

Streaming Responses

streamText()

Streams text in real-time.

Integration with SSE

Tool Calling

Single Tool

Multiple Tools

Structured Output

generateObject()

Generates structured data in JSON format.

Practical Example

Rtzr Provider (Speech Recognition)

Sonamu provides built-in support for Rtzr (a Korean speech recognition service).

Configuration

Basic Usage

File Upload + Speech Recognition

Rtzr Options

Multimodal (Image Processing)

GPT-4o can accept images as input.

Image Upload + Analysis

Error Handling

Cost Tracking

Practical Integration Example

AI Chat API

Precautions

Important considerations when using the AI SDK:
  1. API Key Security: Use environment variables
  2. Error Handling: Always use try-catch
  3. Token Limits: Set maxTokens
  4. Streaming Cleanup: Terminate stream even on errors
  5. Rtzr File Size: Large files require chunking
  6. Image Size: Check GPT-4o image limits

Vercel AI SDK Documentation

For more features, refer to the official documentation:

Next Steps

Agent Configuration

Configure agent basics

Creating Agents

Build agents with BaseAgentClass