import { APIResource } from "../../core/resource.mjs"; import * as Shared from "../shared.mjs"; import * as ThreadsAPI from "./threads.mjs"; import { APIPromise } from "../../core/api-promise.mjs"; import { Stream } from "../../core/streaming.mjs"; import { RequestOptions } from "../../internal/request-options.mjs"; export declare class Streaming extends APIResource { /** * GET with body payload — no resources created. Returns the threads in a tracing * project matching the query passed as the request payload. Results are filtered * by the given time range and optional filters, with cursor-based pagination. * * `ai_search` cannot be combined with `sem_filter`. With full AI search enabled, * `ai_search` translates natural language into query filters and time bounds and * cannot be combined with explicit filter expressions. Otherwise, `ai_search` * retains legacy semantic-only behavior. Use `sem_filter` for semantic-only * matching combined with structured filters. AI search requires organization * consent. When semantic matching is needed, `Accept: text/event-stream` is * required; requests without it return 406. AI search is unavailable on * deployments that route queries to the v1 backend and returns 501 there. * * Self-hosted deployments require LangSmith `v0.16` or later. * * @example * ```ts * const response = await client.threads.streaming.query(); * ``` */ query(params: StreamingQueryParams, options?: RequestOptions): APIPromise>; /** * Yields the items of `query` one at a time across pages, following the next page cursor. * * @example * ```ts * // Automatically fetches more pages as needed. * for await (const thread of client.threads.streaming.queryItems( * {}, * )) { * // ... * } * ``` */ queryItems(params: StreamingQueryParams, options?: RequestOptions): AsyncIterable; } export interface StreamingQueryResponse { /** * `items` is the page of thread summaries, sorted by the thread's most recent * activity. */ items?: Array; /** * `next_cursor` is the opaque cursor to pass as `cursor` on the next request. Null * on the final page. */ next_cursor?: string; } export interface StreamingQueryParams { /** * Body param: `ai_search` translates natural language into structured filters, * semantic criteria and time bounds. Cannot be combined with sem_filter. With full * AI search enabled, also cannot be combined with explicit filter expressions; * otherwise retains legacy semantic-only behavior. Must contain nonempty text of * at most 2000 UTF-8 bytes. */ ai_search?: string; /** * Body param: `cursor` is the opaque string from a previous response's * `next_cursor`. Omit on the first request; pass the returned cursor to fetch the * next page. */ cursor?: string; /** * Body param: `filter` narrows which threads are returned, using a LangSmith * filter expression evaluated against each thread's root run. For example: * has(tags, "production") or eq(status, "error"). See * https://docs.langchain.com/langsmith/trace-query-syntax#filter-query-language * for syntax. */ filter?: string; /** * Body param: `max_start_time` is the exclusive upper bound on thread activity * (RFC3339 date-time). Defaults to now (UTC) when omitted. */ max_start_time?: string; /** * Body param: `min_start_time` is the inclusive lower bound on thread activity * (RFC3339 date-time). Defaults to 1 day before now (UTC) when omitted. */ min_start_time?: string; /** * Body param: `page_size` is the maximum number of threads to return in this * response. Defaults to 20 when omitted; must be between 1 and 100 inclusive when * set. The response may contain fewer threads than `page_size` even when * `next_cursor` is non-null. */ page_size?: number; /** * Body param: `project_id` is the tracing project UUID. */ project_id?: string; /** * Body param: SemFilter evaluates a plain-language criterion against trajectory * messages, AND-ed with structured filters. */ sem_filter?: string; /** * Body param: `thread_filter` narrows results using a LangSmith filter expression * evaluated against each complete thread summary. Self-hosted deployments require * LangSmith v0.17 or later; unsupported deployments return 501. See * https://docs.langchain.com/langsmith/trace-query-syntax#filter-query-language * for syntax. */ thread_filter?: string; /** * Body param: `trace_filter` narrows results to threads containing at least one * trace whose root run matches this LangSmith filter expression. Trace-level * aggregate fields are evaluated using the complete trace summary. Self-hosted * deployments require LangSmith v0.17 or later; unsupported deployments * return 501. See * https://docs.langchain.com/langsmith/trace-query-syntax#filter-query-language * for syntax. */ trace_filter?: string; /** * Body param: `tree_filter` narrows results to threads containing at least one * trace with a matching run anywhere in its run tree. Self-hosted deployments * require LangSmith v0.17 or later; unsupported deployments return 501. See * https://docs.langchain.com/langsmith/trace-query-syntax#filter-query-language * for syntax. */ tree_filter?: string; /** * Header param: application/json, or text/event-stream (required for semantic * matching) */ Accept?: string; } export declare namespace Streaming { export { type StreamingQueryResponse as StreamingQueryResponse, type StreamingQueryParams as StreamingQueryParams, }; }