Knowledge
Stream an answer
Ask an engine a question and receive the answer as server-sent events while it's written.
/v1/engine/query/streamTakes the same body as Query an engine and returns the answer as it's written, ending with the complete, checked answer. lynk.query with stream calls it for you.
Body
engine_idstring<uuid>requiredThe engine to ask.
querystringrequiredThe question, in plain words.
top_kintegerdefault: 8How many chunks to search for, from 1 to 50.
model_idstring | nullA generation model your plan includes.
A stream always uses the engine's Answer Mode from its settings. Any query_mode you send is ignored here.
Events
tokeneventrequireddelta: the next piece of the answer.
finaleventrequiredanswer, citations, and confidence: the complete, checked answer. Sent once.
doneeventrequiredok: the stream is finished.
erroreventdetail: the answer couldn't be finished. No final follows.
Some answers arrive whole in final with no token events, such as a Precision Mode answer. Always read final for the complete answer.
Status codes
| Status | Meaning |
|---|---|
200 | The stream started. Errors after this point arrive as an error event. |
400 | The query is empty. |
401 | The key is missing, malformed, or revoked. |
402 | Your plan's monthly allowance is used up. |
403 | The key's capability or scope doesn't allow reading this engine. |
404 | The engine doesn't exist in the key's workspace. |
429 | A rate limit was hit. |