VrinClient exposes three query methods, each tuned for a different integration pattern:
| Method | Returns | Use when |
|---|---|---|
query() | QueryResult (resolves once complete) | You just want the final answer. |
queryStream() | AsyncGenerator<string> (content deltas) | You want token-by-token streaming. |
queryEvents() | AsyncGenerator<StreamEvent> (full SSE frames) | You want progress, sources, and metadata, not just text. |
client.query(options)
QueryOptions fields
| Field | Type | Default | Description |
|---|---|---|---|
query | string | required | The natural-language question. |
mode | ResponseMode | "chat" | Output shape. See response modes. |
depth | QueryDepth | backend-chosen | "basic", "thinking", or "research". Only applies in context mode. |
model | string | backend-chosen | LLM override, e.g. "gpt-5.2", "claude-4-haiku". Must be in your plan’s allowed models. |
sessionId | string | — | Continue a multi-turn conversation. |
maintainContext | boolean | false | If true, a new session_id is created and returned. |
includeSummary | boolean | true | Set false to skip LLM generation and return raw facts only. |
webSearchEnabled | boolean | false | Augment retrieval with live web search (brainstorm mode). |
conversationUploadIds | string[] | — | Scope retrieval to specific uploads. |
client.queryStream(options)
Yields content deltas as strings. Use for chat UIs.
client.queryEvents(options)
Yields raw SSE events. Agents that render progress, show sources, or trace reasoning should use this.
Event types
type | Payload fields |
|---|---|
progress | stage, label, step, total_steps, elapsed_ms |
metadata | session_id, total_facts, total_chunks, entities, model |
content | delta (partial token text) |
reasoning | chains or steps (expert mode) |
sources | sources: [{ title, chunk_id, score }] |
done | — |
error | message |
Response modes
See the agent-facing mode table for guidance on which to pick. Short version:chat— concise prose answer. Default for chat UIs.context— structured facts for an agent to synthesize. Default for agent tools.expert— includes reasoning chain. Slower, more expensive.brainstorm— combines Vrin + web search. Use withwebSearchEnabled: true.raw_facts— no LLM generation; just the graph facts.