Skip to main content

Overview

The chat() method provides the simplest way to interact with an LLM. It takes a prompt and returns just the response text, making it perfect for quick integrations.

Basic Usage

API Reference

Parameters

Returns

Throws

Examples

Simple Q&A

React Component

ChatComponent.tsx

With Error Handling

Chat vs Generate

Use chat() for quick prototyping and simple interactions. Switch to generate() when you need performance metrics, custom options, or system prompts.

Generate

Full generation with options and metrics

Streaming

Real-time token streaming