
Your first question
Reading the response
The response has two fields:answer: the LLM-generated answer, grounded in the retrieved passages.results: the ranked chunks used as context, in the same shape as a Search result (chunk_id,content,score,scores,source,workspace). Use these to show citations or let users open the source document.
Scoping to a subset of documents
Ask uses the same scoping rules as Search. Passworkspace_id and/or tag_id to narrow the corpus, or file_id to target specific files. file_id is mutually exclusive with workspace_id and tag_id.
max_results (default 10, range 1 to 50) controls how many passages are retrieved and fed to the model as context. More context can improve answer quality on broad questions, at the cost of latency.
Choosing a model
Two models are supported. Any other value is rejected with a422.
Getting the answer as JSON
When the answer feeds a downstream system rather than a human reader, passresponse_format with a JSON Schema. The model is then constrained to produce valid JSON matching it, so you can parse the result instead of writing a text scraper.
The schema must be an object schema: type set to "object", plus a properties map. Anything else is rejected with a 422. In the SDK the parameter is schema, and it accepts a pydantic model as well as a raw schema dict.
answer still comes back as a string, but that string is now JSON conforming to your schema. Parse it to get the object:
token events, then parse the assembled string once the done event arrives.
Streaming the answer
For chat-style UIs where you want to show the answer as it’s written, setstream: true. The response is a stream of Server-Sent Events instead of a single JSON body:
ask_streaming.py
done event.
The Python SDK does not expose streaming yet, so this one is plain HTTP only.