DocRouter Knowledge Base icon

DocRouter Knowledge Base

Manage knowledge bases and run search/chat in DocRouter.ai

Chat

AI-generated

Summary

Send a chat interaction to a specified knowledge base using a large language model, optionally filtering context by metadata and controlling response generation parameters.

Inputs

  • Knowledge Base ID (required) — The unique identifier of the knowledge base to chat with.
  • Model (required) — The large language model (LLM) to use for the chat (e.g., gpt-4o-mini).
  • Messages (required) — An array of message objects representing the chat history, each with a role (user|assistant|system) and content string.
  • Temperature — Sampling temperature controlling response randomness, from 0 to 2, default is 0.7.
  • Max Tokens — Maximum number of tokens to generate in the chat response.
  • Stream — Boolean indicating whether to stream the response as it is generated (default true).
  • Chat Metadata Filter — Optional JSON object specifying metadata filters to apply to the chat context.

Output shape

a single JSON object representing the chat response, which may include the generated text plus any tool calls or results if streaming is enabled

The response reflects either a streamed or complete chat output from the specified knowledge base and LLM model. Streaming responses are parsed to accumulate chunks, tool calls, and results. If streaming is disabled, the response is returned as-is from the API.

Examples

Example 1: Chatting with knowledge base 'kb_123' using 'gpt-4o-mini' model with user message

Set Knowledge Base ID to 'kb_123', Model to 'gpt-4o-mini', provide Messages with a user role message ['Hello'], optionally adjust Temperature and Max Tokens, and enable Stream for progressive output.

Links

Discussion