Streaming

Show results as they are verified instead of waiting for the slowest article.

Set stream: true on POST /v1/search or POST /v1/search/site and the response becomes a stream of Server-Sent Events. The first results arrive about a second in, in every mode.

With the SDKs

const stream = ts.searchStream('el dólar', { mode: 'deep' });

for await (const event of stream) {
  if (event.type === 'step') console.log('·', event.step.text);
  if (event.type === 'partial') render(event.response.results);
  if (event.type === 'result') render(event.response.results, { final: true });
}

Only need the end? finalResponse() in TypeScript and final_response() in Python consume the stream and return the result.

Events

EventdataWhen
step{ id, text, status, detail }A step starts or finishes: judging headlines, reading articles, classifying tone…
partialA search responseResults judged so far. Each one is confirmed in place as its article is read.
resultA search responseThe final result. The stream ends after it.
errorProblem detailsSomething failed. The stream ends after it. The SDKs throw it as an error.

Results in a partial keep their position while articles are read, so you can render them straight away without the list jumping. The final order comes with result.

The raw stream

event: step
data: {"id":"juicio-indice","text":"The model reads 160 headlines from the index","status":"running","detail":null}

event: partial
data: {"id":"req_…","object":"search","results":[…]}

event: result
data: {"id":"req_…","object":"search","results":[…]}

Step text is meant to be shown to people and can change; use id and status in code. It comes in English; send Accept-Language: es to get it in Spanish.

Charts

POST /v1/charts streams too, with stream: true: step while it works, result with the chart and improved if the exact data arrives later. See Stream the progress.

On this page