Skip to main content
The Answer API searches relevant sources and synthesizes a cited, factual answer in one call. It supports streaming and non-streaming modes (non-streaming by default).

Wire up Valyu Answer (search-grounded answers) with the TypeScript SDK.

Open in Cursor

Basic usage

Common patterns

Structured output

Pass a JSON schema to structuredOutput and response.contents comes back as a structured object instead of a string. Detect it with typeof response.contents === "object":

Streaming

Set streaming: true to receive the answer progressively as an async generator of typed chunks:
For open-ended, multi-step work (reports, diligence, deliverables), reach for DeepResearch instead of Answer.

Reference

query (string, required) - the question to answer.