Overview
The Chat API is a RESTful API for programmatic access to Fess’s AI mode functionality. You can obtain AI-assisted answers based on search results.
This API provides two endpoints:
Non-Streaming API: Retrieve complete answers at once
Streaming API: Retrieve answers in real-time using Server-Sent Events (SSE) format
Prerequisites
To use the Chat API, the following configuration is required:
AI mode functionality must be enabled (
rag.chat.enabled=true)An LLM provider must be configured
For detailed configuration, see AI Mode Configuration.
Non-Streaming API
Endpoint
Request Parameters
Response
On Success (HTTP 200)
On Error
HTTP Status Codes
| Code | Description |
|---|---|
| 200 | Request successful |
| 400 | Invalid request parameter (e.g., message is empty) |
| 404 | Endpoint not found |
| 405 | HTTP method not allowed (only POST is allowed) |
| 500 | Internal server error |
Usage Examples
cURL
JavaScript
Python
Streaming API
Endpoint
Request Parameters
Response Format
The Streaming API returns responses in text/event-stream format (Server-Sent Events).
Each event follows this format:
SSE Events
session
Notifies session information. Sent at the start of the stream.
phase
Notifies processing phase start/completion.
Phase types:
intent_analysis- Intent analysissearch- Search executionevaluation- Result evaluationgeneration- Response generation
chunk
Notifies generated text fragments.
sources
Notifies reference document information.
done
Notifies processing completion.
error
Notifies errors.
Usage Examples
cURL
JavaScript (EventSource)
Python
Error Handling
Implement appropriate error handling when using the API.
Rate Limiting
Rate limits apply to the Chat API.
Default settings:
10 requests per minute
When rate limits are exceeded, HTTP 429 error is returned.
For rate limit configuration, see AI Mode Configuration.
Security
Security considerations when using the Chat API:
Authentication: The current version does not require API authentication, but consider appropriate access control for production environments
Rate Limiting: Enable rate limiting to prevent DoS attacks
Input Validation: Perform input validation on the client side as well
CORS: Review CORS settings as needed
References
AI Mode Configuration - AI Mode Configuration
LLM Integration Overview - LLM Integration Overview
AI Search Mode - End User Chat Search Guide
API Overview - API Overview