langsmith
Version:
Client library to connect to the LangSmith Observability and Evaluation Platform.
70 lines (69 loc) • 2.43 kB
JavaScript
// @ts-nocheck
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
import { APIResource } from '../core/resource.js';
import { ItemsCursorPostPagination, } from '../core/pagination.js';
import { buildHeaders } from '../internal/headers.js';
import { path } from '../internal/utils/path.js';
export class Runs extends APIResource {
constructor() {
super(...arguments);
Object.defineProperty(this, "retrieve", {
enumerable: true,
configurable: true,
writable: true,
value: this.retrieveV2
});
Object.defineProperty(this, "query", {
enumerable: true,
configurable: true,
writable: true,
value: this.queryV2
});
}
/**
* **Alpha:** The request and response contract may change; Returns a paginated
* list of runs for the given projects within min/max start_time. Supports filters,
* cursor pagination, and `selects` to select fields to return.
*
* @example
* ```ts
* // Automatically fetches more pages as needed.
* for await (const run of client.runs.queryV2()) {
* // ...
* }
* ```
*/
queryV2(params, options) {
const { Accept, ...body } = params;
return this._client.getAPIList('/v2/runs/query', (ItemsCursorPostPagination), {
body,
method: 'post',
...options,
headers: buildHeaders([{ ...(Accept != null ? { Accept: Accept } : undefined) }, options?.headers]),
});
}
/**
* **Alpha:** The request and response contract may change; Returns one run by ID
* for the given session and start_time. Use the `selects` query parameter
* (repeatable) to select fields to return.
*
* @example
* ```ts
* const run = await client.runs.retrieveV2(
* '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
* {
* project_id: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
* start_time: '2019-12-27T18:11:19.117Z',
* },
* );
* ```
*/
retrieveV2(runID, params, options) {
const { Accept, ...query } = params;
return this._client.get(path `/v2/runs/${runID}`, {
query,
...options,
headers: buildHeaders([{ ...(Accept != null ? { Accept: Accept } : undefined) }, options?.headers]),
});
}
}