UNPKG

@anthropic-ai/sdk

Version:
29 lines • 1.83 kB
import type { Attributes } from '@opentelemetry/api'; import type { BaseAnthropic } from "../../../client.js"; import { Stream } from "../../../core/streaming.js"; import type { RequestOptions } from "../../../internal/request-options.js"; import { type ApiCallSpan, type ApiCallSpanSettings } from "../../../internal/tracing.js"; import type { AnyMessage, MessageCreateBody } from "./types.js"; /** * What a `messages.create` span starts with from `request`, the options of its request. * `startApiCallSpan` reads the attributes that one field of the body or one header gives. A sampler * sees only the attributes that a span starts with. */ export declare function messagesCreateSpanSettings(client: BaseAnthropic, request: RequestOptions): ApiCallSpanSettings; /** * The ID of the Agent that `body`, the body of a `sessions.create` request, names: the request * gives it as a string or in an object. An `agent` that is neither is for the API to refuse. */ export declare function sessionsCreateSpanAttributes(body: unknown): Attributes | undefined; /** * In content mode, sets the request's content on `call`. The span does not start with it, because * the size limit counts it together with the response's content. Returns `call`. */ export declare function recordMessagesCreateRequest(client: BaseAnthropic, call: ApiCallSpan | undefined, body: MessageCreateBody): ApiCallSpan | undefined; /** * Sets the sums over the response's usage and, in content mode, the response's content on `call`. * A streamed response is recorded as the application reads it * (`endAnthropicApiCallSpanWhenStreamEnds`). */ export declare function recordMessagesCreateResponse(client: BaseAnthropic, call: ApiCallSpan | undefined, body: MessageCreateBody, data: AnyMessage | Stream<unknown>): void; //# sourceMappingURL=api-call.d.ts.map