Streams an answer for a document chat: the model uses files already linked to chat_id in Genow (and conversation history for that chat). Responses are Server-Sent Events (text/event-stream).
Authentication: send a valid Bearer JWT (same as other Genow APIs).
Event format: each SSE message is one line starting with data: followed by JSON: {"type": "<TokenType>", "data": ...}. Parse lines that begin with data: ; ignore heartbeats or empty lines as needed.
Token types (type field): the same vocabulary is shared across Genow streaming chat endpoints. For this endpoint (POST /api/chat/ask) you should rely on:
ANSWER — data is a string fragment of the model reply. Many events are emitted; concatenate data in order to rebuild the full answer.FINISHED — stream is complete. data is null. No further answer tokens follow.Other token types appear on knowledge-asset / search streaming routes, not on document chat ask. Clients should still handle unknown type values defensively:
SPLIT_SUBTASKS — data is typically a list of strings (sub-questions or pipeline steps) when the router splits work.RERANKED_DOCUMENTS — data is typically structured retrieval metadata (e.g. list of document-like objects) after reranking.REASONING — data may contain reasoning or intermediate model output when the deployment exposes it.FULL_ANSWER — data may carry a full answer payload in one shot on some pipelines (contrast with streamed ANSWER chunks).images — data relates to image results when the pipeline returns them (shape depends on caller).Example SSE fragment (document chat; illustrative):
data: {"type": "ANSWER", "data": "The "}
data: {"type": "ANSWER", "data": "key date is "}
data: {"type": "ANSWER", "data": "2030-01-01."}
data: {"type": "FINISHED", "data": null}
Examples
curl (disable buffering with -N). The llm value must match a chat_model_name from your deployment (below uses Gemini Pro as gemini-2.5-pro, a common LiteLLM id):
curl -N -X POST 'https://<your-genow-host>/api/chat/ask' \
-H 'Authorization: Bearer <jwt>' \
-H 'Content-Type: application/json' \
-d '{
"query": "What are the key dates in these documents?",
"llm": "gemini-2.5-pro",
"chat_id": "f47ac10b-58cc-4372-a567-0e02b2c3d479",
"entry_id": "6ba7b810-9dad-11d1-80b4-00c04fd430c8"
}'
Use the models endpoint to list valid llm values for your environment. Request body examples are also attached to the DocumentChatRequest schema in the OpenAPI document.
Documentation Index
Fetch the complete documentation index at: https://docs.genow.ai/llms.txt
Use this file to discover all available pages before exploring further.
Bearer token authentication. Format: 'Bearer '
The user's message to the assistant. Server-side normalization may adjust curly braces in the text. For document chat, images already linked to the chat are appended to the prompt automatically.
Chat model identifier (matched case-insensitively; stored lowercase). Must be enabled for your deployment—use the Genow models API to list valid chat_model_name values (e.g. Gemini Pro is often exposed as gemini-2.5-pro via LiteLLM; exact ids depend on your tenant configuration).
Identifier of the conversation. The server creates the chat on first use if it does not exist yet. Document context is whatever is attached to this chat in Genow (uploaded files).
Client-generated unique id for this question/answer turn. It is persisted with the stored chat entry and should be unique within the chat.
Optional locale (ISO 639-1 code) for system prompt and templating, e.g. en or de. Omit to use server defaults.
bg, cs, da, de, el, en, es, et, fi, fr, hr, hu, is, it, ja, ko, lt, lv, nb, nl, pl, pt, ro, ru, sk, sl, sr, sv, tr, zh Optional hint that this is the first user message in a new chat (used by Genow clients for titling and analytics). Document chat retrieval does not depend on this flag.
Optional IANA timezone name (e.g. Europe/Berlin, America/New_York) used to inject the current local date/time into the system prompt.
Successful Response