langsmith
Version:
Client library to connect to the LangSmith Observability and Evaluation Platform.
66 lines (65 loc) • 2.37 kB
JavaScript
;
// @ts-nocheck
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
Object.defineProperty(exports, "__esModule", { value: true });
exports.Threads = void 0;
const resource_js_1 = require("../core/resource.cjs");
const pagination_js_1 = require("../core/pagination.cjs");
const path_js_1 = require("../internal/utils/path.cjs");
class Threads extends resource_js_1.APIResource {
/**
* **Alpha:** The request and response contract may change; Retrieve all traces
* belonging to a specific thread within a project.
*
* @example
* ```ts
* // Automatically fetches more pages as needed.
* for await (const threadTraceListItem of client.threads.listTraces(
* 'thread_id',
* { project_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e' },
* )) {
* // ...
* }
* ```
*/
listTraces(threadID, query, options) {
return this._client.getAPIList((0, path_js_1.path) `/v2/threads/${threadID}/traces`, (pagination_js_1.ItemsCursorGetPagination), { query, ...options });
}
/**
* **Alpha:** The request and response contract may change; Query threads within a
* project (session), with cursor-based pagination. Returns threads matching the
* given time range and optional filter.
*
* @example
* ```ts
* // Automatically fetches more pages as needed.
* for await (const threadListItem of client.threads.query()) {
* // ...
* }
* ```
*/
query(body, options) {
return this._client.getAPIList('/v2/threads/query', (pagination_js_1.ItemsCursorPostPagination), {
body,
method: 'post',
...options,
});
}
/**
* **Alpha:** The request and response contract may change; Compute aggregate stats
* for a single thread (turn count, latency percentiles, token/cost sums, and
* detail breakdowns) within a project.
*
* @example
* ```ts
* const response = await client.threads.stats('thread_id', {
* selects: ['TURNS'],
* session_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
* });
* ```
*/
stats(threadID, query, options) {
return this._client.get((0, path_js_1.path) `/v2/threads/${threadID}/stats`, { query, ...options });
}
}
exports.Threads = Threads;