UI
Chat
Learn how to use the chat API
The chat component enables dynamic, conversational interactions with OpenAI. This endpoint allows you to send messages and receive AI-generated responses in a natural dialogue format.
Parameters
source
str: The source of the conversation. This parameter is optional.table
Optional[str]: The name of the table to query. Optional for PostgreSQL and ClickHouse sources.
Returns
Returns a Dictionary containing:
type
: Always “chat”id
: Unique component identifierstate
: Dictionary containing:messages
: List of conversation messages
config
: Dictionary containing:source
: The source of the conversation (optional)data
: Pandas DataFrame converted to records format (optional)
Backend Implementation Details
Implemented in services/openai.js
Authentication
- Secure API key handling via environment variables (
VITE_OPENAI_API_KEY
) - Error handling for authentication issues
Message Processing
- Manages conversation history and context
- Optimizes message format for API
Error Handling
- Graceful fallbacks for API disruptions
- User-friendly error messages
API Integration
- OpenAI chat completions integration
- GPT-3.5-turbo implementation
- Conversation threading support
Basic Usage
Here’s a basic example of using the chat component:
CSV
PostgreSQL Source
For PostgreSQL sources, table_name
is required:
ClickHouse Source
Similarly for ClickHouse sources, table_name
is required:
Key Features
- Natural Conversation: Engage in fluid, context-aware dialogues with Claude
- Data Integration: Seamlessly incorporate your csv data sources into conversations
- State Management: Automatic handling of conversation history and context
Was this page helpful?