// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import type { RequestInit, RequestInfo, BodyInit } from './internal/builtin-types'; import type { HTTPMethod, PromiseOrValue, MergedRequestInit, FinalizedRequestInit } from './internal/types'; import { uuid4 } from './internal/utils/uuid'; import { validatePositiveInteger, isAbsoluteURL, safeJSON } from './internal/utils/values'; import { sleep } from './internal/utils/sleep'; export type { Logger, LogLevel } from './internal/utils/log'; import { castToError, isAbortError } from './internal/errors'; import type { APIResponseProps } from './internal/parse'; import { getPlatformHeaders } from './internal/detect-platform'; import * as Shims from './internal/shims'; import * as Opts from './internal/request-options'; import { stringifyQuery } from './internal/utils/query'; import { VERSION } from './version'; import * as Errors from './core/error'; import * as Pagination from './core/pagination'; import { APIListPageResponse, AbstractPage, type CursorPageByNameParams, CursorPageByNameResponse, type CursorPageParams, CursorPageResponse, type CursorPageVectorsParams, CursorPageVectorsResponse, } from './core/pagination'; import * as Uploads from './core/uploads'; import * as API from './resources/index'; import { APIPromise } from './core/api-promise'; import { AgentConfigCreateParams, AgentConfigCreateResponse, AgentConfigDeleteResponse, AgentConfigListMcpToolsResponse, AgentConfigListParams, AgentConfigListResponse, AgentConfigListResponsesCursorPage, AgentConfigRetrieveResponse, AgentConfigUpdateParams, AgentConfigUpdateResponse, AgentConfigs, RepoSpec, } from './resources/agent-configs'; import { AnnotationTask, AnnotationTaskBatchUpdateParams, AnnotationTaskBatchUpdateResponse, AnnotationTasks, } from './resources/annotation-tasks'; import { AgentexCloudBuild, AgentexCloudBuildsCursorPage, Build, BuildCreateParams, BuildListParams, BuildListUndeployedResponse, StreamChunk, } from './resources/build'; import { Completion, CompletionCreateParams, CompletionCreateParamsNonStreaming, CompletionCreateParamsStreaming, CompletionUsage, Completions, } from './resources/completions'; import { Credential, CredentialCreateParams, CredentialDeleteResponse, CredentialListParams, CredentialSecret, CredentialUpdateParams, Credentials, CredentialsCursorPage, } from './resources/credentials'; import { DatasetItem, DatasetItemArchiveResponse, DatasetItemBatchCreateParams, DatasetItemBatchCreateResponse, DatasetItemListParams, DatasetItemRetrieveParams, DatasetItemUpdateParams, DatasetItems, DatasetItemsCursorPage, } from './resources/dataset-items'; import { Dataset, DatasetArchiveResponse, DatasetCreateParams, DatasetListParams, DatasetRetrieveParams, DatasetUpdateParams, Datasets, DatasetsCursorPage, } from './resources/datasets'; import { AgentexCloudDeploy, AgentexCloudDeployEvent, AgentexCloudDeploysCursorPage, Deploy, DeployCreateParams, DeployListParams, DeployLogsParams, DeployLogsResponse, } from './resources/deploy'; import { EvaluationGroup, EvaluationGroupCreateParams, EvaluationGroupListParams, EvaluationGroupMember, EvaluationGroupReplaceParams, EvaluationGroupRetrieveParams, EvaluationGroupRetrieveSchemaParams, EvaluationGroupRetrieveSchemaResponse, EvaluationGroupRowIdentifier, EvaluationGroupUpdateParams, EvaluationGroupViews, EvaluationGroups, EvaluationGroupsCursorPage, } from './resources/evaluation-groups'; import { Component, Container, EvaluationItem, EvaluationItemExport, EvaluationItemExportParams, EvaluationItemListParams, EvaluationItemRetrieveParams, EvaluationItems, EvaluationItemsCursorPage, ExportFormat, ExportMethod, TaskError, } from './resources/evaluation-items'; import { Inference, InferenceCreateParams, InferenceCreateResponse, InferenceResponse, InferenceResponseChunk, LaunchInferenceConfiguration, } from './resources/inference'; import { InferenceModel, InferenceModelAvailability, InferenceModelType, InferenceModelsCursorPage, LaunchVendorConfiguration, LlmEngineVendorConfiguration, ModelCreateParams, ModelDeleteResponse, ModelListParams, ModelUpdateParams, Models, } from './resources/models'; import { CategoricalQuestion, CategoricalQuestionConfiguration, FormQuestion, FormQuestionConfiguration, FreeTextQuestion, FreeTextQuestionConfiguration, NumberQuestion, NumberQuestionConfiguration, Question, QuestionCreateParams, QuestionListParams, QuestionUpdateParams, Questions, QuestionsCursorPage, RatingQuestion, RatingQuestionConfiguration, TimestampQuestion, TimestampQuestionConfiguration, } from './resources/questions'; import { ApplyPatchCall, ApplyPatchCallOutput, ApplyPatchTool, ComputerTool, ContainerNetworkPolicyAllowlist, ContainerNetworkPolicyDisabled, ContainerReference, ContainerReferenceParam, Conversation, CustomTool, EasyInputMessage, FileSearchTool, FunctionShellTool, FunctionTool, IncompleteDetails, LocalEnvironment, LocalEnvironmentParam, McpApprovalRequest, OpenAIResponse, OpenAIResponseCodeInterpreterToolCall, OpenAIResponseComputerToolCall, OpenAIResponseCustomToolCall, OpenAIResponseCustomToolCallOutput, OpenAIResponseError, OpenAIResponseFileSearchToolCall, OpenAIResponseFunctionToolCall, OpenAIResponseFunctionWebSearch, OpenAIResponseInputFile, OpenAIResponseInputFileParam, OpenAIResponseInputImage, OpenAIResponseInputImageParam, OpenAIResponseInputText, OpenAIResponseInputTextParam, OpenAIResponseOutputMessage, OpenAIResponseOutputRefusal, OpenAIResponseOutputText, OpenAIResponsePrompt, OpenAIResponseReasoningItem, OpenAIResponseTextConfig, OpenAIResponseUsage, OpenAITypesResponsesResponseInputItemComputerCallOutput, OpenAITypesResponsesResponseInputItemFunctionCallOutput, OpenAITypesResponsesResponseInputItemImageGenerationCall, OpenAITypesResponsesResponseInputItemItemReference, OpenAITypesResponsesResponseInputItemLocalShellCall, OpenAITypesResponsesResponseInputItemLocalShellCallOutput, OpenAITypesResponsesResponseInputItemMcpApprovalResponse, OpenAITypesResponsesResponseInputItemMcpCall, OpenAITypesResponsesResponseInputItemMcpListTools, OpenAITypesResponsesResponseInputItemMessage, OpenAITypesResponsesResponseOutputItemImageGenerationCall, OpenAITypesResponsesResponseOutputItemLocalShellCall, OpenAITypesResponsesResponseOutputItemMcpCall, OpenAITypesResponsesResponseOutputItemMcpListTools, PartReasoningText, Reasoning, ResponseApplyPatchToolCall, ResponseApplyPatchToolCallOutput, ResponseCompactionItem, ResponseCompactionItemParam, ResponseComputerToolCallOutputScreenshot, ResponseCreateParams, ResponseCreateResponse, ResponseFunctionShellToolCall, ResponseFunctionShellToolCallOutput, Responses, ShellCall, ShellCallOutput, ToolChoiceAllowed, ToolChoiceApplyPatch, ToolChoiceCustom, ToolChoiceFunction, ToolChoiceMcp, ToolChoiceShell, ToolChoiceTypes, WebSearchPreviewTool, WebSearchTool, } from './resources/responses'; import { CloudSecret, CloudSecretsCursorPage, SecretCreateParams, SecretListParams, SecretUpdateParams, Secrets, } from './resources/secrets'; import { ApprovalStatus, AssessmentType, SpanAssessment, SpanAssessmentCreateParams, SpanAssessmentDeleteResponse, SpanAssessmentListParams, SpanAssessmentRetrieveParams, SpanAssessmentUpdateParams, SpanAssessments, SpanAssessmentsAPIListPage, } from './resources/span-assessments'; import { APIListSpan, Span, SpanBatchCreate, SpanBatchParams, SpanCreate, SpanCreateParams, SpanSearchParams, SpanStatus, SpanType, SpanUpdateParams, SpanUpsertBatchParams, Spans, SpansCursorPage, } from './resources/spans'; import { Chat } from './resources/chat/chat'; import { EvaluationDashboard, EvaluationDashboardCreateParams, EvaluationDashboardListParams, EvaluationDashboardRetrieveParams, EvaluationDashboardUpdateParams, EvaluationDashboards, EvaluationDashboardsCursorPage, } from './resources/evaluation-dashboards/evaluation-dashboards'; import { AndEvaluationRunCondition, AutoEvaluationAgentTaskRequestWithItemLocator, EqEvaluationRunCondition, Evaluation, EvaluationCreateParams, EvaluationFilterParams, EvaluationListParams, EvaluationRetrieveParams, EvaluationRetrieveSchemaParams, EvaluationRetrieveTaxonomyResponse, EvaluationSchemaResponse, EvaluationTask, EvaluationTasksProgressSchema, EvaluationUpdateParams, EvaluationViews, Evaluations, EvaluationsCursorPage, GtEvaluationRunCondition, GteEvaluationRunCondition, InEvaluationRunCondition, IsNotNullEvaluationRunCondition, IsNullEvaluationRunCondition, ItemLocator, ItemLocatorTemplate, LtEvaluationRunCondition, LteEvaluationRunCondition, NeEvaluationRunCondition, NotEvaluationRunCondition, NotInEvaluationRunCondition, OrEvaluationRunCondition, PaginatedListEvaluation, } from './resources/evaluations/evaluations'; import { FileCreateParams, FileDeleteParams, FileDeleteResponse, FileImportFromCloudParams, FileImportFromCloudResponse, FileListParams, FileRetrieveParams, FileUpdateParams, Files, SGPFile, SGPFilesCursorPage, } from './resources/files/files'; import { RestoreRequest, RubricArchiveResponse, RubricCreateParams, RubricListParams, RubricResponse, RubricResponsesCursorPage, RubricUpdateParams, Rubrics, } from './resources/rubrics/rubrics'; import { EmbeddingConfig, EmbeddingConfigBase, EmbeddingConfigModelsAPI, EmbeddingModelName, TextContent, VectorStore, VectorStoreConfigureParams, VectorStoreCountParams, VectorStoreCountResponse, VectorStoreCreateParams, VectorStoreDeleteParams, VectorStoreDeleteResponse, VectorStoreDropResponse, VectorStoreListParams, VectorStoreQueryParams, VectorStoreQueryResponse, VectorStoreUpsertParams, VectorStoreUpsertResponse, VectorStores, VectorStoresCursorPageByName, } from './resources/vector-stores/vector-stores'; import { type Fetch } from './internal/builtin-types'; import { HeadersLike, NullableHeaders, buildHeaders } from './internal/headers'; import { FinalRequestOptions, RequestOptions } from './internal/request-options'; import { readEnv } from './internal/utils/env'; import { type LogLevel, type Logger, formatRequestDetails, loggerFor, parseLogLevel, } from './internal/utils/log'; import { isEmptyObj } from './internal/utils/values'; const environments = { production: 'https://api.egp.scale.com', 'production-multitenant': 'https://api.sgp.scale.com', staging: 'https://api.staging-sgp.scale.com', development: 'https://api.dev-sgp.scale.com', local: 'http://127.0.0.1:5003/public', }; type Environment = keyof typeof environments; export interface ClientOptions { /** * Defaults to process.env['SGP_API_KEY']. */ apiKey?: string | undefined; /** * Defaults to process.env['SGP_ACCOUNT_ID']. */ accountID?: string | undefined; /** * Specifies the environment to use for the API. * * Each environment maps to a different base URL: * - `production` corresponds to `https://api.egp.scale.com` * - `production-multitenant` corresponds to `https://api.sgp.scale.com` * - `staging` corresponds to `https://api.staging-sgp.scale.com` * - `development` corresponds to `https://api.dev-sgp.scale.com` * - `local` corresponds to `http://127.0.0.1:5003/public` */ environment?: Environment | undefined; /** * Override the default base URL for the API, e.g., "https://api.example.com/v2/" * * Defaults to process.env['SGP_CLIENT_BASE_URL']. */ baseURL?: string | null | undefined; /** * The maximum amount of time (in milliseconds) that the client should wait for a response * from the server before timing out a single request. * * Note that request timeouts are retried by default, so in a worst-case scenario you may wait * much longer than this timeout before the promise succeeds or fails. * * @unit milliseconds */ timeout?: number | undefined; /** * Additional `RequestInit` options to be passed to `fetch` calls. * Properties will be overridden by per-request `fetchOptions`. */ fetchOptions?: MergedRequestInit | undefined; /** * Specify a custom `fetch` function implementation. * * If not provided, we expect that `fetch` is defined globally. */ fetch?: Fetch | undefined; /** * The maximum number of times that the client will retry a request in case of a * temporary failure, like a network error or a 5XX error from the server. * * @default 2 */ maxRetries?: number | undefined; /** * Default headers to include with every request to the API. * * These can be removed in individual requests by explicitly setting the * header to `null` in request options. */ defaultHeaders?: HeadersLike | undefined; /** * Default query parameters to include with every request to the API. * * These can be removed in individual requests by explicitly setting the * param to `undefined` in request options. */ defaultQuery?: Record | undefined; /** * Set the log level. * * Defaults to process.env['SGP_CLIENT_LOG'] or 'warn' if it isn't set. */ logLevel?: LogLevel | undefined; /** * Set the logger. * * Defaults to globalThis.console. */ logger?: Logger | undefined; } /** * API Client for interfacing with the Scale GP API. */ export class SGPClient { apiKey: string; accountID: string; baseURL: string; maxRetries: number; timeout: number; logger: Logger; logLevel: LogLevel | undefined; fetchOptions: MergedRequestInit | undefined; private fetch: Fetch; #encoder: Opts.RequestEncoder; protected idempotencyHeader?: string; private _options: ClientOptions; /** * API Client for interfacing with the Scale GP API. * * @param {string | undefined} [opts.apiKey=process.env['SGP_API_KEY'] ?? undefined] * @param {string | undefined} [opts.accountID=process.env['SGP_ACCOUNT_ID'] ?? undefined] * @param {Environment} [opts.environment=production] - Specifies the environment URL to use for the API. * @param {string} [opts.baseURL=process.env['SGP_CLIENT_BASE_URL'] ?? https://api.egp.scale.com] - Override the default base URL for the API. * @param {number} [opts.timeout=1 minute] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out. * @param {MergedRequestInit} [opts.fetchOptions] - Additional `RequestInit` options to be passed to `fetch` calls. * @param {Fetch} [opts.fetch] - Specify a custom `fetch` function implementation. * @param {number} [opts.maxRetries=2] - The maximum number of times the client will retry a request. * @param {HeadersLike} opts.defaultHeaders - Default headers to include with every request to the API. * @param {Record} opts.defaultQuery - Default query parameters to include with every request to the API. */ constructor({ baseURL = readEnv('SGP_CLIENT_BASE_URL'), apiKey = readEnv('SGP_API_KEY'), accountID = readEnv('SGP_ACCOUNT_ID'), ...opts }: ClientOptions = {}) { if (apiKey === undefined) { throw new Errors.SGPClientError( "The SGP_API_KEY environment variable is missing or empty; either provide it, or instantiate the SGPClient client with an apiKey option, like new SGPClient({ apiKey: 'My API Key' }).", ); } if (accountID === undefined) { throw new Errors.SGPClientError( "The SGP_ACCOUNT_ID environment variable is missing or empty; either provide it, or instantiate the SGPClient client with an accountID option, like new SGPClient({ accountID: 'My Account ID' }).", ); } const options: ClientOptions = { apiKey, accountID, ...opts, baseURL, environment: opts.environment ?? 'production', }; if (baseURL && opts.environment) { throw new Errors.SGPClientError( 'Ambiguous URL; The `baseURL` option (or SGP_CLIENT_BASE_URL env var) and the `environment` option are given. If you want to use the environment you must pass baseURL: null', ); } this.baseURL = options.baseURL || environments[options.environment || 'production']; this.timeout = options.timeout ?? SGPClient.DEFAULT_TIMEOUT /* 1 minute */; this.logger = options.logger ?? console; const defaultLogLevel = 'warn'; // Set default logLevel early so that we can log a warning in parseLogLevel. this.logLevel = defaultLogLevel; this.logLevel = parseLogLevel(options.logLevel, 'ClientOptions.logLevel', this) ?? parseLogLevel(readEnv('SGP_CLIENT_LOG'), "process.env['SGP_CLIENT_LOG']", this) ?? defaultLogLevel; this.fetchOptions = options.fetchOptions; this.maxRetries = options.maxRetries ?? 2; this.fetch = options.fetch ?? Shims.getDefaultFetch(); this.#encoder = Opts.FallbackEncoder; const customHeadersEnv = readEnv('SGP_CLIENT_CUSTOM_HEADERS'); if (customHeadersEnv) { const parsed: Record = {}; for (const line of customHeadersEnv.split('\n')) { const colon = line.indexOf(':'); if (colon >= 0) { parsed[line.substring(0, colon).trim()] = line.substring(colon + 1).trim(); } } options.defaultHeaders = { ...parsed, ...options.defaultHeaders }; } this._options = options; this.apiKey = apiKey; this.accountID = accountID; } /** * Create a new client instance re-using the same options given to the current client with optional overriding. */ withOptions(options: Partial): this { const client = new (this.constructor as any as new (props: ClientOptions) => typeof this)({ ...this._options, environment: options.environment ? options.environment : undefined, baseURL: options.environment ? undefined : this.baseURL, maxRetries: this.maxRetries, timeout: this.timeout, logger: this.logger, logLevel: this.logLevel, fetch: this.fetch, fetchOptions: this.fetchOptions, apiKey: this.apiKey, accountID: this.accountID, ...options, }); return client; } /** * Check whether the base URL is set to its default. */ #baseURLOverridden(): boolean { return this.baseURL !== environments[this._options.environment || 'production']; } protected defaultQuery(): Record | undefined { return this._options.defaultQuery; } protected validateHeaders({ values, nulls }: NullableHeaders) { return; } protected async authHeaders(opts: FinalRequestOptions): Promise { return buildHeaders([{ 'x-api-key': this.apiKey }]); } protected stringifyQuery(query: object | Record): string { return stringifyQuery(query); } private getUserAgent(): string { return `${this.constructor.name}/JS ${VERSION}`; } protected defaultIdempotencyKey(): string { return `stainless-node-retry-${uuid4()}`; } protected makeStatusError( status: number, error: Object, message: string | undefined, headers: Headers, ): Errors.APIError { return Errors.APIError.generate(status, error, message, headers); } buildURL( path: string, query: Record | null | undefined, defaultBaseURL?: string | undefined, ): string { const baseURL = (!this.#baseURLOverridden() && defaultBaseURL) || this.baseURL; const url = isAbsoluteURL(path) ? new URL(path) : new URL(baseURL + (baseURL.endsWith('/') && path.startsWith('/') ? path.slice(1) : path)); const defaultQuery = this.defaultQuery(); const pathQuery = Object.fromEntries(url.searchParams); if (!isEmptyObj(defaultQuery) || !isEmptyObj(pathQuery)) { query = { ...pathQuery, ...defaultQuery, ...query }; } if (typeof query === 'object' && query && !Array.isArray(query)) { url.search = this.stringifyQuery(query); } return url.toString(); } /** * Used as a callback for mutating the given `FinalRequestOptions` object. */ protected async prepareOptions(options: FinalRequestOptions): Promise {} /** * Used as a callback for mutating the given `RequestInit` object. * * This is useful for cases where you want to add certain headers based off of * the request properties, e.g. `method` or `url`. */ protected async prepareRequest( request: RequestInit, { url, options }: { url: string; options: FinalRequestOptions }, ): Promise {} get(path: string, opts?: PromiseOrValue): APIPromise { return this.methodRequest('get', path, opts); } post(path: string, opts?: PromiseOrValue): APIPromise { return this.methodRequest('post', path, opts); } patch(path: string, opts?: PromiseOrValue): APIPromise { return this.methodRequest('patch', path, opts); } put(path: string, opts?: PromiseOrValue): APIPromise { return this.methodRequest('put', path, opts); } delete(path: string, opts?: PromiseOrValue): APIPromise { return this.methodRequest('delete', path, opts); } private methodRequest( method: HTTPMethod, path: string, opts?: PromiseOrValue, ): APIPromise { return this.request( Promise.resolve(opts).then((opts) => { return { method, path, ...opts }; }), ); } request( options: PromiseOrValue, remainingRetries: number | null = null, ): APIPromise { return new APIPromise(this, this.makeRequest(options, remainingRetries, undefined)); } private async makeRequest( optionsInput: PromiseOrValue, retriesRemaining: number | null, retryOfRequestLogID: string | undefined, ): Promise { const options = await optionsInput; const maxRetries = options.maxRetries ?? this.maxRetries; if (retriesRemaining == null) { retriesRemaining = maxRetries; } await this.prepareOptions(options); const { req, url, timeout } = await this.buildRequest(options, { retryCount: maxRetries - retriesRemaining, }); await this.prepareRequest(req, { url, options }); /** Not an API request ID, just for correlating local log entries. */ const requestLogID = 'log_' + ((Math.random() * (1 << 24)) | 0).toString(16).padStart(6, '0'); const retryLogStr = retryOfRequestLogID === undefined ? '' : `, retryOf: ${retryOfRequestLogID}`; const startTime = Date.now(); loggerFor(this).debug( `[${requestLogID}] sending request`, formatRequestDetails({ retryOfRequestLogID, method: options.method, url, options, headers: req.headers, }), ); if (options.signal?.aborted) { throw new Errors.APIUserAbortError(); } const controller = new AbortController(); const response = await this.fetchWithTimeout(url, req, timeout, controller).catch(castToError); const headersTime = Date.now(); if (response instanceof globalThis.Error) { const retryMessage = `retrying, ${retriesRemaining} attempts remaining`; if (options.signal?.aborted) { throw new Errors.APIUserAbortError(); } // detect native connection timeout errors // deno throws "TypeError: error sending request for url (https://example/): client error (Connect): tcp connect error: Operation timed out (os error 60): Operation timed out (os error 60)" // undici throws "TypeError: fetch failed" with cause "ConnectTimeoutError: Connect Timeout Error (attempted address: example:443, timeout: 1ms)" // others do not provide enough information to distinguish timeouts from other connection errors const isTimeout = isAbortError(response) || /timed? ?out/i.test(String(response) + ('cause' in response ? String(response.cause) : '')); if (retriesRemaining) { loggerFor(this).info( `[${requestLogID}] connection ${isTimeout ? 'timed out' : 'failed'} - ${retryMessage}`, ); loggerFor(this).debug( `[${requestLogID}] connection ${isTimeout ? 'timed out' : 'failed'} (${retryMessage})`, formatRequestDetails({ retryOfRequestLogID, url, durationMs: headersTime - startTime, message: response.message, }), ); return this.retryRequest(options, retriesRemaining, retryOfRequestLogID ?? requestLogID); } loggerFor(this).info( `[${requestLogID}] connection ${isTimeout ? 'timed out' : 'failed'} - error; no more retries left`, ); loggerFor(this).debug( `[${requestLogID}] connection ${isTimeout ? 'timed out' : 'failed'} (error; no more retries left)`, formatRequestDetails({ retryOfRequestLogID, url, durationMs: headersTime - startTime, message: response.message, }), ); if (isTimeout) { throw new Errors.APIConnectionTimeoutError(); } throw new Errors.APIConnectionError({ cause: response }); } const responseInfo = `[${requestLogID}${retryLogStr}] ${req.method} ${url} ${ response.ok ? 'succeeded' : 'failed' } with status ${response.status} in ${headersTime - startTime}ms`; if (!response.ok) { const shouldRetry = await this.shouldRetry(response); if (retriesRemaining && shouldRetry) { const retryMessage = `retrying, ${retriesRemaining} attempts remaining`; // We don't need the body of this response. await Shims.CancelReadableStream(response.body); loggerFor(this).info(`${responseInfo} - ${retryMessage}`); loggerFor(this).debug( `[${requestLogID}] response error (${retryMessage})`, formatRequestDetails({ retryOfRequestLogID, url: response.url, status: response.status, headers: response.headers, durationMs: headersTime - startTime, }), ); return this.retryRequest( options, retriesRemaining, retryOfRequestLogID ?? requestLogID, response.headers, ); } const retryMessage = shouldRetry ? `error; no more retries left` : `error; not retryable`; loggerFor(this).info(`${responseInfo} - ${retryMessage}`); const errText = await response.text().catch((err: any) => castToError(err).message); const errJSON = safeJSON(errText) as any; const errMessage = errJSON ? undefined : errText; loggerFor(this).debug( `[${requestLogID}] response error (${retryMessage})`, formatRequestDetails({ retryOfRequestLogID, url: response.url, status: response.status, headers: response.headers, message: errMessage, durationMs: Date.now() - startTime, }), ); const err = this.makeStatusError(response.status, errJSON, errMessage, response.headers); throw err; } loggerFor(this).info(responseInfo); loggerFor(this).debug( `[${requestLogID}] response start`, formatRequestDetails({ retryOfRequestLogID, url: response.url, status: response.status, headers: response.headers, durationMs: headersTime - startTime, }), ); return { response, options, controller, requestLogID, retryOfRequestLogID, startTime }; } getAPIList = Pagination.AbstractPage>( path: string, Page: new (...args: any[]) => PageClass, opts?: PromiseOrValue, ): Pagination.PagePromise { return this.requestAPIList( Page, opts && 'then' in opts ? opts.then((opts) => ({ method: 'get', path, ...opts })) : { method: 'get', path, ...opts }, ); } requestAPIList< Item = unknown, PageClass extends Pagination.AbstractPage = Pagination.AbstractPage, >( Page: new (...args: ConstructorParameters) => PageClass, options: PromiseOrValue, ): Pagination.PagePromise { const request = this.makeRequest(options, null, undefined); return new Pagination.PagePromise(this as any as SGPClient, request, Page); } async fetchWithTimeout( url: RequestInfo, init: RequestInit | undefined, ms: number, controller: AbortController, ): Promise { const { signal, method, ...options } = init || {}; const abort = this._makeAbort(controller); if (signal) signal.addEventListener('abort', abort, { once: true }); const timeout = setTimeout(abort, ms); const isReadableBody = ((globalThis as any).ReadableStream && options.body instanceof (globalThis as any).ReadableStream) || (typeof options.body === 'object' && options.body !== null && Symbol.asyncIterator in options.body); const fetchOptions: RequestInit = { signal: controller.signal as any, ...(isReadableBody ? { duplex: 'half' } : {}), method: 'GET', ...options, }; if (method) { // Custom methods like 'patch' need to be uppercased // See https://github.com/nodejs/undici/issues/2294 fetchOptions.method = method.toUpperCase(); } try { // use undefined this binding; fetch errors if bound to something else in browser/cloudflare return await this.fetch.call(undefined, url, fetchOptions); } finally { clearTimeout(timeout); } } private async shouldRetry(response: Response): Promise { // Note this is not a standard header. const shouldRetryHeader = response.headers.get('x-should-retry'); // If the server explicitly says whether or not to retry, obey. if (shouldRetryHeader === 'true') return true; if (shouldRetryHeader === 'false') return false; // Retry on request timeouts. if (response.status === 408) return true; // Retry on lock timeouts. if (response.status === 409) return true; // Retry on rate limits. if (response.status === 429) return true; // Retry internal errors. if (response.status >= 500) return true; return false; } private async retryRequest( options: FinalRequestOptions, retriesRemaining: number, requestLogID: string, responseHeaders?: Headers | undefined, ): Promise { let timeoutMillis: number | undefined; // Note the `retry-after-ms` header may not be standard, but is a good idea and we'd like proactive support for it. const retryAfterMillisHeader = responseHeaders?.get('retry-after-ms'); if (retryAfterMillisHeader) { const timeoutMs = parseFloat(retryAfterMillisHeader); if (!Number.isNaN(timeoutMs)) { timeoutMillis = timeoutMs; } } // About the Retry-After header: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Retry-After const retryAfterHeader = responseHeaders?.get('retry-after'); if (retryAfterHeader && !timeoutMillis) { const timeoutSeconds = parseFloat(retryAfterHeader); if (!Number.isNaN(timeoutSeconds)) { timeoutMillis = timeoutSeconds * 1000; } else { timeoutMillis = Date.parse(retryAfterHeader) - Date.now(); } } // If the API asks us to wait a certain amount of time, just do what it // says, but otherwise calculate a default if (timeoutMillis === undefined) { const maxRetries = options.maxRetries ?? this.maxRetries; timeoutMillis = this.calculateDefaultRetryTimeoutMillis(retriesRemaining, maxRetries); } await sleep(timeoutMillis); return this.makeRequest(options, retriesRemaining - 1, requestLogID); } private calculateDefaultRetryTimeoutMillis(retriesRemaining: number, maxRetries: number): number { const initialRetryDelay = 0.5; const maxRetryDelay = 8.0; const numRetries = maxRetries - retriesRemaining; // Apply exponential backoff, but not more than the max. const sleepSeconds = Math.min(initialRetryDelay * Math.pow(2, numRetries), maxRetryDelay); // Apply some jitter, take up to at most 25 percent of the retry time. const jitter = 1 - Math.random() * 0.25; return sleepSeconds * jitter * 1000; } async buildRequest( inputOptions: FinalRequestOptions, { retryCount = 0 }: { retryCount?: number } = {}, ): Promise<{ req: FinalizedRequestInit; url: string; timeout: number }> { const options = { ...inputOptions }; const { method, path, query, defaultBaseURL } = options; const url = this.buildURL(path!, query as Record, defaultBaseURL); if ('timeout' in options) validatePositiveInteger('timeout', options.timeout); options.timeout = options.timeout ?? this.timeout; const { bodyHeaders, body } = this.buildBody({ options }); const reqHeaders = await this.buildHeaders({ options: inputOptions, method, bodyHeaders, retryCount }); const req: FinalizedRequestInit = { method, headers: reqHeaders, ...(options.signal && { signal: options.signal }), ...((globalThis as any).ReadableStream && body instanceof (globalThis as any).ReadableStream && { duplex: 'half' }), ...(body && { body }), ...((this.fetchOptions as any) ?? {}), ...((options.fetchOptions as any) ?? {}), }; return { req, url, timeout: options.timeout }; } private async buildHeaders({ options, method, bodyHeaders, retryCount, }: { options: FinalRequestOptions; method: HTTPMethod; bodyHeaders: HeadersLike; retryCount: number; }): Promise { let idempotencyHeaders: HeadersLike = {}; if (this.idempotencyHeader && method !== 'get') { if (!options.idempotencyKey) options.idempotencyKey = this.defaultIdempotencyKey(); idempotencyHeaders[this.idempotencyHeader] = options.idempotencyKey; } const headers = buildHeaders([ idempotencyHeaders, { Accept: 'application/json', 'User-Agent': this.getUserAgent(), 'X-Stainless-Retry-Count': String(retryCount), ...(options.timeout ? { 'X-Stainless-Timeout': String(Math.trunc(options.timeout / 1000)) } : {}), ...getPlatformHeaders(), 'x-selected-account-id': this.accountID, }, await this.authHeaders(options), this._options.defaultHeaders, bodyHeaders, options.headers, ]); this.validateHeaders(headers); return headers.values; } private _makeAbort(controller: AbortController) { // note: we can't just inline this method inside `fetchWithTimeout()` because then the closure // would capture all request options, and cause a memory leak. return () => controller.abort(); } private buildBody({ options }: { options: FinalRequestOptions }): { bodyHeaders: HeadersLike; body: BodyInit | undefined; } { const { body, headers: rawHeaders } = options; if (!body) { // A resource method always passes a `body` key when its operation defines a // request body, even if the caller omitted an optional body param. Keep the // content-type for those, and only elide it for operations with no body at // all (e.g. GET/DELETE). if (body == null && 'body' in options) { return this.#encoder({ body, headers: buildHeaders([rawHeaders]) }); } return { bodyHeaders: undefined, body: undefined }; } const headers = buildHeaders([rawHeaders]); if ( // Pass raw type verbatim ArrayBuffer.isView(body) || body instanceof ArrayBuffer || body instanceof DataView || (typeof body === 'string' && // Preserve legacy string encoding behavior for now headers.values.has('content-type')) || // `Blob` is superset of `File` ((globalThis as any).Blob && body instanceof (globalThis as any).Blob) || // `FormData` -> `multipart/form-data` body instanceof FormData || // `URLSearchParams` -> `application/x-www-form-urlencoded` body instanceof URLSearchParams || // Send chunked stream (each chunk has own `length`) ((globalThis as any).ReadableStream && body instanceof (globalThis as any).ReadableStream) ) { return { bodyHeaders: undefined, body: body as BodyInit }; } else if ( typeof body === 'object' && (Symbol.asyncIterator in body || (Symbol.iterator in body && 'next' in body && typeof body.next === 'function')) ) { return { bodyHeaders: undefined, body: Shims.ReadableStreamFrom(body as AsyncIterable) }; } else if ( typeof body === 'object' && headers.values.get('content-type') === 'application/x-www-form-urlencoded' ) { return { bodyHeaders: { 'content-type': 'application/x-www-form-urlencoded' }, body: this.stringifyQuery(body), }; } else { return this.#encoder({ body, headers }); } } static SGPClient = this; static DEFAULT_TIMEOUT = 60000; // 1 minute static SGPClientError = Errors.SGPClientError; static APIError = Errors.APIError; static APIConnectionError = Errors.APIConnectionError; static APIConnectionTimeoutError = Errors.APIConnectionTimeoutError; static APIUserAbortError = Errors.APIUserAbortError; static NotFoundError = Errors.NotFoundError; static ConflictError = Errors.ConflictError; static RateLimitError = Errors.RateLimitError; static BadRequestError = Errors.BadRequestError; static AuthenticationError = Errors.AuthenticationError; static InternalServerError = Errors.InternalServerError; static PermissionDeniedError = Errors.PermissionDeniedError; static UnprocessableEntityError = Errors.UnprocessableEntityError; static toFile = Uploads.toFile; responses: API.Responses = new API.Responses(this); completions: API.Completions = new API.Completions(this); chat: API.Chat = new API.Chat(this); inference: API.Inference = new API.Inference(this); questions: API.Questions = new API.Questions(this); files: API.Files = new API.Files(this); models: API.Models = new API.Models(this); datasets: API.Datasets = new API.Datasets(this); datasetItems: API.DatasetItems = new API.DatasetItems(this); evaluations: API.Evaluations = new API.Evaluations(this); evaluationItems: API.EvaluationItems = new API.EvaluationItems(this); rubrics: API.Rubrics = new API.Rubrics(this); evaluationGroups: API.EvaluationGroups = new API.EvaluationGroups(this); evaluationDashboards: API.EvaluationDashboards = new API.EvaluationDashboards(this); annotationTasks: API.AnnotationTasks = new API.AnnotationTasks(this); spans: API.Spans = new API.Spans(this); spanAssessments: API.SpanAssessments = new API.SpanAssessments(this); credentials: API.Credentials = new API.Credentials(this); build: API.Build = new API.Build(this); deploy: API.Deploy = new API.Deploy(this); secrets: API.Secrets = new API.Secrets(this); vectorStores: API.VectorStores = new API.VectorStores(this); agentConfigs: API.AgentConfigs = new API.AgentConfigs(this); } SGPClient.Responses = Responses; SGPClient.Completions = Completions; SGPClient.Chat = Chat; SGPClient.Inference = Inference; SGPClient.Questions = Questions; SGPClient.Files = Files; SGPClient.Models = Models; SGPClient.Datasets = Datasets; SGPClient.DatasetItems = DatasetItems; SGPClient.Evaluations = Evaluations; SGPClient.EvaluationItems = EvaluationItems; SGPClient.Rubrics = Rubrics; SGPClient.EvaluationGroups = EvaluationGroups; SGPClient.EvaluationDashboards = EvaluationDashboards; SGPClient.AnnotationTasks = AnnotationTasks; SGPClient.Spans = Spans; SGPClient.SpanAssessments = SpanAssessments; SGPClient.Credentials = Credentials; SGPClient.Build = Build; SGPClient.Deploy = Deploy; SGPClient.Secrets = Secrets; SGPClient.VectorStores = VectorStores; SGPClient.AgentConfigs = AgentConfigs; export declare namespace SGPClient { export type RequestOptions = Opts.RequestOptions; export import CursorPage = Pagination.CursorPage; export { type CursorPageParams as CursorPageParams, type CursorPageResponse as CursorPageResponse }; export import CursorPageVectors = Pagination.CursorPageVectors; export { type CursorPageVectorsParams as CursorPageVectorsParams, type CursorPageVectorsResponse as CursorPageVectorsResponse, }; export import CursorPageByName = Pagination.CursorPageByName; export { type CursorPageByNameParams as CursorPageByNameParams, type CursorPageByNameResponse as CursorPageByNameResponse, }; export import APIListPage = Pagination.APIListPage; export { type APIListPageResponse as APIListPageResponse }; export { Responses as Responses, type ApplyPatchCall as ApplyPatchCall, type ApplyPatchCallOutput as ApplyPatchCallOutput, type ApplyPatchTool as ApplyPatchTool, type ComputerTool as ComputerTool, type ContainerNetworkPolicyAllowlist as ContainerNetworkPolicyAllowlist, type ContainerNetworkPolicyDisabled as ContainerNetworkPolicyDisabled, type ContainerReference as ContainerReference, type ContainerReferenceParam as ContainerReferenceParam, type Conversation as Conversation, type CustomTool as CustomTool, type EasyInputMessage as EasyInputMessage, type FileSearchTool as FileSearchTool, type FunctionShellTool as FunctionShellTool, type FunctionTool as FunctionTool, type IncompleteDetails as IncompleteDetails, type LocalEnvironment as LocalEnvironment, type LocalEnvironmentParam as LocalEnvironmentParam, type McpApprovalRequest as McpApprovalRequest, type OpenAIResponse as OpenAIResponse, type OpenAIResponseCodeInterpreterToolCall as OpenAIResponseCodeInterpreterToolCall, type OpenAIResponseComputerToolCall as OpenAIResponseComputerToolCall, type OpenAIResponseCustomToolCall as OpenAIResponseCustomToolCall, type OpenAIResponseCustomToolCallOutput as OpenAIResponseCustomToolCallOutput, type OpenAIResponseError as OpenAIResponseError, type OpenAIResponseFileSearchToolCall as OpenAIResponseFileSearchToolCall, type OpenAIResponseFunctionToolCall as OpenAIResponseFunctionToolCall, type OpenAIResponseFunctionWebSearch as OpenAIResponseFunctionWebSearch, type OpenAIResponseInputFile as OpenAIResponseInputFile, type OpenAIResponseInputFileParam as OpenAIResponseInputFileParam, type OpenAIResponseInputImage as OpenAIResponseInputImage, type OpenAIResponseInputImageParam as OpenAIResponseInputImageParam, type OpenAIResponseInputText as OpenAIResponseInputText, type OpenAIResponseInputTextParam as OpenAIResponseInputTextParam, type OpenAIResponseOutputMessage as OpenAIResponseOutputMessage, type OpenAIResponseOutputRefusal as OpenAIResponseOutputRefusal, type OpenAIResponseOutputText as OpenAIResponseOutputText, type OpenAIResponsePrompt as OpenAIResponsePrompt, type OpenAIResponseReasoningItem as OpenAIResponseReasoningItem, type OpenAIResponseTextConfig as OpenAIResponseTextConfig, type OpenAIResponseUsage as OpenAIResponseUsage, type OpenAITypesResponsesResponseInputItemComputerCallOutput as OpenAITypesResponsesResponseInputItemComputerCallOutput, type OpenAITypesResponsesResponseInputItemFunctionCallOutput as OpenAITypesResponsesResponseInputItemFunctionCallOutput, type OpenAITypesResponsesResponseInputItemImageGenerationCall as OpenAITypesResponsesResponseInputItemImageGenerationCall, type OpenAITypesResponsesResponseInputItemItemReference as OpenAITypesResponsesResponseInputItemItemReference, type OpenAITypesResponsesResponseInputItemLocalShellCall as OpenAITypesResponsesResponseInputItemLocalShellCall, type OpenAITypesResponsesResponseInputItemLocalShellCallOutput as OpenAITypesResponsesResponseInputItemLocalShellCallOutput, type OpenAITypesResponsesResponseInputItemMcpApprovalResponse as OpenAITypesResponsesResponseInputItemMcpApprovalResponse, type OpenAITypesResponsesResponseInputItemMcpCall as OpenAITypesResponsesResponseInputItemMcpCall, type OpenAITypesResponsesResponseInputItemMcpListTools as OpenAITypesResponsesResponseInputItemMcpListTools, type OpenAITypesResponsesResponseInputItemMessage as OpenAITypesResponsesResponseInputItemMessage, type OpenAITypesResponsesResponseOutputItemImageGenerationCall as OpenAITypesResponsesResponseOutputItemImageGenerationCall, type OpenAITypesResponsesResponseOutputItemLocalShellCall as OpenAITypesResponsesResponseOutputItemLocalShellCall, type OpenAITypesResponsesResponseOutputItemMcpCall as OpenAITypesResponsesResponseOutputItemMcpCall, type OpenAITypesResponsesResponseOutputItemMcpListTools as OpenAITypesResponsesResponseOutputItemMcpListTools, type PartReasoningText as PartReasoningText, type Reasoning as Reasoning, type ResponseApplyPatchToolCall as ResponseApplyPatchToolCall, type ResponseApplyPatchToolCallOutput as ResponseApplyPatchToolCallOutput, type ResponseCompactionItem as ResponseCompactionItem, type ResponseCompactionItemParam as ResponseCompactionItemParam, type ResponseComputerToolCallOutputScreenshot as ResponseComputerToolCallOutputScreenshot, type ResponseFunctionShellToolCall as ResponseFunctionShellToolCall, type ResponseFunctionShellToolCallOutput as ResponseFunctionShellToolCallOutput, type ShellCall as ShellCall, type ShellCallOutput as ShellCallOutput, type ToolChoiceAllowed as ToolChoiceAllowed, type ToolChoiceApplyPatch as ToolChoiceApplyPatch, type ToolChoiceCustom as ToolChoiceCustom, type ToolChoiceFunction as ToolChoiceFunction, type ToolChoiceMcp as ToolChoiceMcp, type ToolChoiceShell as ToolChoiceShell, type ToolChoiceTypes as ToolChoiceTypes, type WebSearchPreviewTool as WebSearchPreviewTool, type WebSearchTool as WebSearchTool, type ResponseCreateResponse as ResponseCreateResponse, type ResponseCreateParams as ResponseCreateParams, }; export { Completions as Completions, type Completion as Completion, type CompletionUsage as CompletionUsage, type CompletionCreateParams as CompletionCreateParams, type CompletionCreateParamsNonStreaming as CompletionCreateParamsNonStreaming, type CompletionCreateParamsStreaming as CompletionCreateParamsStreaming, }; export { Chat as Chat }; export { Inference as Inference, type InferenceResponse as InferenceResponse, type InferenceResponseChunk as InferenceResponseChunk, type LaunchInferenceConfiguration as LaunchInferenceConfiguration, type InferenceCreateResponse as InferenceCreateResponse, type InferenceCreateParams as InferenceCreateParams, }; export { Questions as Questions, type CategoricalQuestion as CategoricalQuestion, type CategoricalQuestionConfiguration as CategoricalQuestionConfiguration, type FormQuestion as FormQuestion, type FormQuestionConfiguration as FormQuestionConfiguration, type FreeTextQuestion as FreeTextQuestion, type FreeTextQuestionConfiguration as FreeTextQuestionConfiguration, type NumberQuestion as NumberQuestion, type NumberQuestionConfiguration as NumberQuestionConfiguration, type Question as Question, type RatingQuestion as RatingQuestion, type RatingQuestionConfiguration as RatingQuestionConfiguration, type TimestampQuestion as TimestampQuestion, type TimestampQuestionConfiguration as TimestampQuestionConfiguration, type QuestionsCursorPage as QuestionsCursorPage, type QuestionCreateParams as QuestionCreateParams, type QuestionUpdateParams as QuestionUpdateParams, type QuestionListParams as QuestionListParams, }; export { Files as Files, type SGPFile as SGPFile, type FileDeleteResponse as FileDeleteResponse, type FileImportFromCloudResponse as FileImportFromCloudResponse, type SGPFilesCursorPage as SGPFilesCursorPage, type FileCreateParams as FileCreateParams, type FileRetrieveParams as FileRetrieveParams, type FileUpdateParams as FileUpdateParams, type FileListParams as FileListParams, type FileDeleteParams as FileDeleteParams, type FileImportFromCloudParams as FileImportFromCloudParams, }; export { Models as Models, type InferenceModel as InferenceModel, type InferenceModelAvailability as InferenceModelAvailability, type InferenceModelType as InferenceModelType, type LaunchVendorConfiguration as LaunchVendorConfiguration, type LlmEngineVendorConfiguration as LlmEngineVendorConfiguration, type ModelDeleteResponse as ModelDeleteResponse, type InferenceModelsCursorPage as InferenceModelsCursorPage, type ModelCreateParams as ModelCreateParams, type ModelUpdateParams as ModelUpdateParams, type ModelListParams as ModelListParams, }; export { Datasets as Datasets, type Dataset as Dataset, type DatasetArchiveResponse as DatasetArchiveResponse, type DatasetsCursorPage as DatasetsCursorPage, type DatasetCreateParams as DatasetCreateParams, type DatasetRetrieveParams as DatasetRetrieveParams, type DatasetUpdateParams as DatasetUpdateParams, type DatasetListParams as DatasetListParams, }; export { DatasetItems as DatasetItems, type DatasetItem as DatasetItem, type DatasetItemArchiveResponse as DatasetItemArchiveResponse, type DatasetItemBatchCreateResponse as DatasetItemBatchCreateResponse, type DatasetItemsCursorPage as DatasetItemsCursorPage, type DatasetItemRetrieveParams as DatasetItemRetrieveParams, type DatasetItemUpdateParams as DatasetItemUpdateParams, type DatasetItemListParams as DatasetItemListParams, type DatasetItemBatchCreateParams as DatasetItemBatchCreateParams, }; export { Evaluations as Evaluations, type AndEvaluationRunCondition as AndEvaluationRunCondition, type AutoEvaluationAgentTaskRequestWithItemLocator as AutoEvaluationAgentTaskRequestWithItemLocator, type EqEvaluationRunCondition as EqEvaluationRunCondition, type Evaluation as Evaluation, type EvaluationSchemaResponse as EvaluationSchemaResponse, type EvaluationTask as EvaluationTask, type EvaluationTasksProgressSchema as EvaluationTasksProgressSchema, type EvaluationViews as EvaluationViews, type GtEvaluationRunCondition as GtEvaluationRunCondition, type GteEvaluationRunCondition as GteEvaluationRunCondition, type InEvaluationRunCondition as InEvaluationRunCondition, type IsNotNullEvaluationRunCondition as IsNotNullEvaluationRunCondition, type IsNullEvaluationRunCondition as IsNullEvaluationRunCondition, type ItemLocator as ItemLocator, type ItemLocatorTemplate as ItemLocatorTemplate, type LtEvaluationRunCondition as LtEvaluationRunCondition, type LteEvaluationRunCondition as LteEvaluationRunCondition, type NeEvaluationRunCondition as NeEvaluationRunCondition, type NotEvaluationRunCondition as NotEvaluationRunCondition, type NotInEvaluationRunCondition as NotInEvaluationRunCondition, type OrEvaluationRunCondition as OrEvaluationRunCondition, type PaginatedListEvaluation as PaginatedListEvaluation, type EvaluationRetrieveTaxonomyResponse as EvaluationRetrieveTaxonomyResponse, type EvaluationsCursorPage as EvaluationsCursorPage, type EvaluationCreateParams as EvaluationCreateParams, type EvaluationRetrieveParams as EvaluationRetrieveParams, type EvaluationUpdateParams as EvaluationUpdateParams, type EvaluationListParams as EvaluationListParams, type EvaluationFilterParams as EvaluationFilterParams, type EvaluationRetrieveSchemaParams as EvaluationRetrieveSchemaParams, }; export { EvaluationItems as EvaluationItems, type Component as Component, type Container as Container, type EvaluationItem as EvaluationItem, type EvaluationItemExport as EvaluationItemExport, type ExportFormat as ExportFormat, type ExportMethod as ExportMethod, type TaskError as TaskError, type EvaluationItemsCursorPage as EvaluationItemsCursorPage, type EvaluationItemRetrieveParams as EvaluationItemRetrieveParams, type EvaluationItemListParams as EvaluationItemListParams, type EvaluationItemExportParams as EvaluationItemExportParams, }; export { Rubrics as Rubrics, type RestoreRequest as RestoreRequest, type RubricResponse as RubricResponse, type RubricArchiveResponse as RubricArchiveResponse, type RubricResponsesCursorPage as RubricResponsesCursorPage, type RubricCreateParams as RubricCreateParams, type RubricUpdateParams as RubricUpdateParams, type RubricListParams as RubricListParams, }; export { EvaluationGroups as EvaluationGroups, type EvaluationGroup as EvaluationGroup, type EvaluationGroupMember as EvaluationGroupMember, type EvaluationGroupRowIdentifier as EvaluationGroupRowIdentifier, type EvaluationGroupViews as EvaluationGroupViews, type EvaluationGroupRetrieveSchemaResponse as EvaluationGroupRetrieveSchemaResponse, type EvaluationGroupsCursorPage as EvaluationGroupsCursorPage, type EvaluationGroupCreateParams as EvaluationGroupCreateParams, type EvaluationGroupRetrieveParams as EvaluationGroupRetrieveParams, type EvaluationGroupUpdateParams as EvaluationGroupUpdateParams, type EvaluationGroupListParams as EvaluationGroupListParams, type EvaluationGroupReplaceParams as EvaluationGroupReplaceParams, type EvaluationGroupRetrieveSchemaParams as EvaluationGroupRetrieveSchemaParams, }; export { EvaluationDashboards as EvaluationDashboards, type EvaluationDashboard as EvaluationDashboard, type EvaluationDashboardsCursorPage as EvaluationDashboardsCursorPage, type EvaluationDashboardCreateParams as EvaluationDashboardCreateParams, type EvaluationDashboardRetrieveParams as EvaluationDashboardRetrieveParams, type EvaluationDashboardUpdateParams as EvaluationDashboardUpdateParams, type EvaluationDashboardListParams as EvaluationDashboardListParams, }; export { AnnotationTasks as AnnotationTasks, type AnnotationTask as AnnotationTask, type AnnotationTaskBatchUpdateResponse as AnnotationTaskBatchUpdateResponse, type AnnotationTaskBatchUpdateParams as AnnotationTaskBatchUpdateParams, }; export { Spans as Spans, type APIListSpan as APIListSpan, type Span as Span, type SpanBatchCreate as SpanBatchCreate, type SpanCreate as SpanCreate, type SpanStatus as SpanStatus, type SpanType as SpanType, type SpansCursorPage as SpansCursorPage, type SpanCreateParams as SpanCreateParams, type SpanUpdateParams as SpanUpdateParams, type SpanBatchParams as SpanBatchParams, type SpanSearchParams as SpanSearchParams, type SpanUpsertBatchParams as SpanUpsertBatchParams, }; export { SpanAssessments as SpanAssessments, type ApprovalStatus as ApprovalStatus, type AssessmentType as AssessmentType, type SpanAssessment as SpanAssessment, type SpanAssessmentDeleteResponse as SpanAssessmentDeleteResponse, type SpanAssessmentsAPIListPage as SpanAssessmentsAPIListPage, type SpanAssessmentCreateParams as SpanAssessmentCreateParams, type SpanAssessmentRetrieveParams as SpanAssessmentRetrieveParams, type SpanAssessmentUpdateParams as SpanAssessmentUpdateParams, type SpanAssessmentListParams as SpanAssessmentListParams, }; export { Credentials as Credentials, type Credential as Credential, type CredentialSecret as CredentialSecret, type CredentialDeleteResponse as CredentialDeleteResponse, type CredentialsCursorPage as CredentialsCursorPage, type CredentialCreateParams as CredentialCreateParams, type CredentialUpdateParams as CredentialUpdateParams, type CredentialListParams as CredentialListParams, }; export { Build as Build, type AgentexCloudBuild as AgentexCloudBuild, type StreamChunk as StreamChunk, type BuildListUndeployedResponse as BuildListUndeployedResponse, type AgentexCloudBuildsCursorPage as AgentexCloudBuildsCursorPage, type BuildCreateParams as BuildCreateParams, type BuildListParams as BuildListParams, }; export { Deploy as Deploy, type AgentexCloudDeploy as AgentexCloudDeploy, type AgentexCloudDeployEvent as AgentexCloudDeployEvent, type DeployLogsResponse as DeployLogsResponse, type AgentexCloudDeploysCursorPage as AgentexCloudDeploysCursorPage, type DeployCreateParams as DeployCreateParams, type DeployListParams as DeployListParams, type DeployLogsParams as DeployLogsParams, }; export { Secrets as Secrets, type CloudSecret as CloudSecret, type CloudSecretsCursorPage as CloudSecretsCursorPage, type SecretCreateParams as SecretCreateParams, type SecretUpdateParams as SecretUpdateParams, type SecretListParams as SecretListParams, }; export { VectorStores as VectorStores, type EmbeddingConfig as EmbeddingConfig, type EmbeddingConfigBase as EmbeddingConfigBase, type EmbeddingConfigModelsAPI as EmbeddingConfigModelsAPI, type EmbeddingModelName as EmbeddingModelName, type TextContent as TextContent, type VectorStore as VectorStore, type VectorStoreDeleteResponse as VectorStoreDeleteResponse, type VectorStoreCountResponse as VectorStoreCountResponse, type VectorStoreDropResponse as VectorStoreDropResponse, type VectorStoreQueryResponse as VectorStoreQueryResponse, type VectorStoreUpsertResponse as VectorStoreUpsertResponse, type VectorStoresCursorPageByName as VectorStoresCursorPageByName, type VectorStoreCreateParams as VectorStoreCreateParams, type VectorStoreListParams as VectorStoreListParams, type VectorStoreDeleteParams as VectorStoreDeleteParams, type VectorStoreConfigureParams as VectorStoreConfigureParams, type VectorStoreCountParams as VectorStoreCountParams, type VectorStoreQueryParams as VectorStoreQueryParams, type VectorStoreUpsertParams as VectorStoreUpsertParams, }; export { AgentConfigs as AgentConfigs, type RepoSpec as RepoSpec, type AgentConfigCreateResponse as AgentConfigCreateResponse, type AgentConfigRetrieveResponse as AgentConfigRetrieveResponse, type AgentConfigUpdateResponse as AgentConfigUpdateResponse, type AgentConfigListResponse as AgentConfigListResponse, type AgentConfigDeleteResponse as AgentConfigDeleteResponse, type AgentConfigListMcpToolsResponse as AgentConfigListMcpToolsResponse, type AgentConfigListResponsesCursorPage as AgentConfigListResponsesCursorPage, type AgentConfigCreateParams as AgentConfigCreateParams, type AgentConfigUpdateParams as AgentConfigUpdateParams, type AgentConfigListParams as AgentConfigListParams, }; export type Identity = API.Identity; }