Examples

A comprehensive list of runnable examples available in the examples/ directory of the repository.

OpenAI Examples

Example Description
examples/openai/chat/basic.mjs Basic chat with streaming
examples/openai/chat/events.mjs Lifecycle hooks (onNewMessage, etc)
examples/openai/chat/tools.mjs Automatic tool execution
examples/openai/chat/structured.mjs Zod schema validation
examples/openai/multimodal/vision.mjs Image analysis via URL
examples/openai/multimodal/files.mjs Analyzing local files
examples/openai/images/generate.mjs DALL-E 3 Generation
examples/openai/safety/moderation.mjs Custom safety thresholds

Gemini Examples

Example Description
examples/gemini/chat/basic.mjs Streaming chat with Gemini 1.5
examples/gemini/chat/json_mode.mjs Native JSON mode
examples/gemini/multimodal/video.mjs Analyzing video files
examples/gemini/multimodal/audio.mjs Native audio understanding
examples/gemini/multimodal/files.mjs Multi-file context

Anthropic Examples

Example Description
examples/anthropic/chat/basic.mjs Claude 3.5 Sonnet Chat
examples/anthropic/chat/tool_use.mjs Tool calling with Claude
examples/anthropic/multimodal/pdf.mjs Native PDF analysis
examples/anthropic/multimodal/vision.mjs Image understanding