langsmith
Version:
Client library to connect to the LangSmith Observability and Evaluation Platform.
71 lines (70 loc) • 3.03 kB
JavaScript
;
// @ts-nocheck
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
Object.defineProperty(exports, "__esModule", { value: true });
exports.OnlineEvaluators = void 0;
const resource_js_1 = require("../core/resource.cjs");
const pagination_js_1 = require("../core/pagination.cjs");
const headers_js_1 = require("../internal/headers.cjs");
const path_js_1 = require("../internal/utils/path.cjs");
class OnlineEvaluators extends resource_js_1.APIResource {
/**
* Create a new LLM or code evaluator for the current workspace.
*/
create(body, options) {
return this._client.post('/v1/platform/evaluators', { body, ...options });
}
/**
* Retrieve a single evaluator by its ID.
*/
retrieve(evaluatorID, options) {
return this._client.get((0, path_js_1.path) `/v1/platform/evaluators/${evaluatorID}`, options);
}
/**
* Update an existing evaluator's name, LLM configuration, or code configuration.
*/
update(evaluatorID, body, options) {
return this._client.patch((0, path_js_1.path) `/v1/platform/evaluators/${evaluatorID}`, { body, ...options });
}
/**
* List evaluators for the current workspace, with optional filtering by type,
* name, tag, feedback key, or resource ID.
*/
list(query = {}, options) {
return this._client.getAPIList('/v1/platform/evaluators', (pagination_js_1.OffsetPaginationOnlineEvaluators), { query, ...options });
}
/**
* Delete an evaluator. When delete_run_rules is true, all run rules referencing
* this evaluator are deleted first (same tenant). Associated llm_evaluators and
* code_evaluators rows are removed by foreign-key cascade when the evaluator row
* is deleted.
*/
delete(evaluatorID, params = {}, options) {
const { delete_run_rules } = params ?? {};
return this._client.delete((0, path_js_1.path) `/v1/platform/evaluators/${evaluatorID}`, {
query: { delete_run_rules },
...options,
headers: (0, headers_js_1.buildHeaders)([{ Accept: '*/*' }, options?.headers]),
});
}
/**
* Delete multiple evaluators by their IDs. Returns per-item success/failure.
*/
bulkDelete(params, options) {
const { evaluator_ids, delete_run_rules } = params;
return this._client.delete('/v1/platform/evaluators', {
query: { evaluator_ids, delete_run_rules },
...options,
});
}
/**
* Returns per-day LLM evaluator spend for the requested 7-day period, grouped by
* evaluator, resource, or run rule. Exactly one of group_by, evaluator_id,
* session_id, or dataset_id is required. resource_id, type, and feedback_key may
* be supplied with group_by to narrow listing aggregations.
*/
spend(query, options) {
return this._client.get('/v1/platform/evaluators/spend', { query, ...options });
}
}
exports.OnlineEvaluators = OnlineEvaluators;