OpenAiClient.ts overview
Since v1.0.0
Exports Grouped by Category
- Constructors
- Context
- Layers
- Models
- Schemas
- LogProbs (class)
- ResponseCodeInterpreterCallCodeDeltaEvent (class)
- ResponseCodeInterpreterCallCodeDoneEvent (class)
- ResponseCodeInterpreterCallCompletedEvent (class)
- ResponseCodeInterpreterCallInProgressEvent (class)
- ResponseCodeInterpreterCallInterpretingEvent (class)
- ResponseCompletedEvent (class)
- ResponseContentPartAddedEvent (class)
- ResponseContentPartDoneEvent (class)
- ResponseCreatedEvent (class)
- ResponseCustomToolCallInputDeltaEvent (class)
- ResponseCustomToolCallInputDoneEvent (class)
- ResponseErrorEvent (class)
- ResponseFailedEvent (class)
- ResponseFileSearchCallCompletedEvent (class)
- ResponseFileSearchCallInProgressEvent (class)
- ResponseFileSearchCallSearchingEvent (class)
- ResponseFunctionCallArgumentsDeltaEvent (class)
- ResponseFunctionCallArgumentsDoneEvent (class)
- ResponseImageGenerationCallCompletedEvent (class)
- ResponseImageGenerationCallGeneratingEvent (class)
- ResponseImageGenerationCallInProgressEvent (class)
- ResponseImageGenerationCallPartialImageEvent (class)
- ResponseInProgressEvent (class)
- ResponseIncompleteEvent (class)
- ResponseMcpCallArgumentsDeltaEvent (class)
- ResponseMcpCallArgumentsDoneEvent (class)
- ResponseMcpCallCompletedEvent (class)
- ResponseMcpCallFailedEvent (class)
- ResponseMcpCallInProgressEvent (class)
- ResponseMcpListToolsCompletedEvent (class)
- ResponseMcpListToolsFailedEvent (class)
- ResponseMcpListToolsInProgressEvent (class)
- ResponseOutputItemAddedEvent (class)
- ResponseOutputItemDoneEvent (class)
- ResponseOutputTextAnnotationAddedEvent (class)
- ResponseOutputTextDeltaEvent (class)
- ResponseOutputTextDoneEvent (class)
- ResponseQueuedEvent (class)
- ResponseReasoningSummaryPartAddedEvent (class)
- ResponseReasoningSummaryPartDoneEvent (class)
- ResponseReasoningSummaryTextDeltaEvent (class)
- ResponseReasoningSummaryTextDoneEvent (class)
- ResponseReasoningTextDeltaEvent (class)
- ResponseReasoningTextDoneEvent (class)
- ResponseRefusalDeltaEvent (class)
- ResponseRefusalDoneEvent (class)
- ResponseStreamEvent
- ResponseWebSearchCallCompletedEvent (class)
- ResponseWebSearchCallInProgressEvent (class)
- ResponseWebSearchCallSearchingEvent (class)
- SummaryPart (class)
Constructors
make
Signature
declare const make: (options: {
readonly apiKey?: Redacted.Redacted | undefined
readonly apiUrl?: string | undefined
readonly organizationId?: Redacted.Redacted | undefined
readonly projectId?: Redacted.Redacted | undefined
readonly transformClient?: ((client: HttpClient.HttpClient) => HttpClient.HttpClient) | undefined
}) => Effect.Effect<Service, never, HttpClient.HttpClient>
Since v1.0.0
Context
OpenAiClient (class)
Signature
declare class OpenAiClient
Since v1.0.0
Layers
layer
Signature
declare const layer: (options: {
readonly apiKey?: Redacted.Redacted | undefined
readonly apiUrl?: string | undefined
readonly organizationId?: Redacted.Redacted | undefined
readonly projectId?: Redacted.Redacted | undefined
readonly transformClient?: (client: HttpClient.HttpClient) => HttpClient.HttpClient
}) => Layer.Layer<OpenAiClient, never, HttpClient.HttpClient>
Since v1.0.0
layerConfig
Signature
declare const layerConfig: (options: {
readonly apiKey?: Config.Config<Redacted.Redacted | undefined> | undefined
readonly apiUrl?: Config.Config<string | undefined> | undefined
readonly organizationId?: Config.Config<Redacted.Redacted | undefined> | undefined
readonly projectId?: Config.Config<Redacted.Redacted | undefined> | undefined
readonly transformClient?: (client: HttpClient.HttpClient) => HttpClient.HttpClient
}) => Layer.Layer<OpenAiClient, ConfigError, HttpClient.HttpClient>
Since v1.0.0
Models
ResponseStreamEvent (type alias)
Represents the events that can be emitted during a streaming response.
Signature
type ResponseStreamEvent = typeof ResponseStreamEvent.Type
Since v1.0.0
Service (interface)
Signature
export interface Service {
readonly client: Generated.Client
readonly streamRequest: <A, I, R>(
request: HttpClientRequest.HttpClientRequest,
schema: Schema.Schema<A, I, R>
) => Stream.Stream<A, AiError.AiError, R>
readonly createResponse: (
options: typeof Generated.CreateResponse.Encoded
) => Effect.Effect<Generated.Response, AiError.AiError>
readonly createResponseStream: (
options: Omit<typeof Generated.CreateResponse.Encoded, "stream">
) => Stream.Stream<ResponseStreamEvent, AiError.AiError>
readonly createEmbedding: (
options: typeof Generated.CreateEmbeddingRequest.Encoded
) => Effect.Effect<Generated.CreateEmbeddingResponse, AiError.AiError>
}
Since v1.0.0
StreamCompletionRequest (type alias)
Signature
type StreamCompletionRequest = Omit<typeof Generated.CreateChatCompletionRequest.Encoded, "stream">
Since v1.0.0
Schemas
LogProbs (class)
Signature
declare class LogProbs
Since v1.0.0
ResponseCodeInterpreterCallCodeDeltaEvent (class)
Emitted when a partial code snippet is streamed by the code interpreter.
Signature
declare class ResponseCodeInterpreterCallCodeDeltaEvent
Since v1.0.0
ResponseCodeInterpreterCallCodeDoneEvent (class)
Emitted when the code snippet is finalized by the code interpreter.
Signature
declare class ResponseCodeInterpreterCallCodeDoneEvent
Since v1.0.0
ResponseCodeInterpreterCallCompletedEvent (class)
Emitted when the code interpreter call is completed.
Signature
declare class ResponseCodeInterpreterCallCompletedEvent
Since v1.0.0
ResponseCodeInterpreterCallInProgressEvent (class)
Emitted when a code interpreter call is in progress.
Signature
declare class ResponseCodeInterpreterCallInProgressEvent
Since v1.0.0
ResponseCodeInterpreterCallInterpretingEvent (class)
Emitted when the code interpreter is actively interpreting the code snippet.
Signature
declare class ResponseCodeInterpreterCallInterpretingEvent
Since v1.0.0
ResponseCompletedEvent (class)
Emitted when the model response is complete.
Signature
declare class ResponseCompletedEvent
Since v1.0.0
ResponseContentPartAddedEvent (class)
Emitted when a new content part is added.
Signature
declare class ResponseContentPartAddedEvent
Since v1.0.0
ResponseContentPartDoneEvent (class)
Emitted when a content part is done.
Signature
declare class ResponseContentPartDoneEvent
Since v1.0.0
ResponseCreatedEvent (class)
An event that is emitted when a response is created.
Signature
declare class ResponseCreatedEvent
Since v1.0.0
ResponseCustomToolCallInputDeltaEvent (class)
Event representing a delta (partial update) to the input of a custom tool call.
Signature
declare class ResponseCustomToolCallInputDeltaEvent
Since v1.0.0
ResponseCustomToolCallInputDoneEvent (class)
Event indicating that input for a custom tool call is complete.
Signature
declare class ResponseCustomToolCallInputDoneEvent
Since v1.0.0
ResponseErrorEvent (class)
Emitted when an error occurs.
Signature
declare class ResponseErrorEvent
Since v1.0.0
ResponseFailedEvent (class)
An event that is emitted when a response fails.
Signature
declare class ResponseFailedEvent
Since v1.0.0
ResponseFileSearchCallCompletedEvent (class)
Emitted when a file search call is completed (results found).
Signature
declare class ResponseFileSearchCallCompletedEvent
Since v1.0.0
ResponseFileSearchCallInProgressEvent (class)
Emitted when a file search call is initiated.
Signature
declare class ResponseFileSearchCallInProgressEvent
Since v1.0.0
ResponseFileSearchCallSearchingEvent (class)
Emitted when a file search is currently searching.
Signature
declare class ResponseFileSearchCallSearchingEvent
Since v1.0.0
ResponseFunctionCallArgumentsDeltaEvent (class)
Emitted when there is a partial function-call arguments delta.
Signature
declare class ResponseFunctionCallArgumentsDeltaEvent
Since v1.0.0
ResponseFunctionCallArgumentsDoneEvent (class)
Emitted when function-call arguments are finalized.
Signature
declare class ResponseFunctionCallArgumentsDoneEvent
Since v1.0.0
ResponseImageGenerationCallCompletedEvent (class)
Emitted when an image generation tool call has completed and the final image is available.
Signature
declare class ResponseImageGenerationCallCompletedEvent
Since v1.0.0
ResponseImageGenerationCallGeneratingEvent (class)
Emitted when an image generation tool call is actively generating an image (intermediate state).
Signature
declare class ResponseImageGenerationCallGeneratingEvent
Since v1.0.0
ResponseImageGenerationCallInProgressEvent (class)
Emitted when an image generation tool call is in progress.
Signature
declare class ResponseImageGenerationCallInProgressEvent
Since v1.0.0
ResponseImageGenerationCallPartialImageEvent (class)
Emitted when a partial image is available during image generation streaming.
Signature
declare class ResponseImageGenerationCallPartialImageEvent
Since v1.0.0
ResponseInProgressEvent (class)
Emitted when the response is in progress.
Signature
declare class ResponseInProgressEvent
Since v1.0.0
ResponseIncompleteEvent (class)
An event that is emitted when a response finishes as incomplete.
Signature
declare class ResponseIncompleteEvent
Since v1.0.0
ResponseMcpCallArgumentsDeltaEvent (class)
Emitted when there is a delta (partial update) to the arguments of an MCP tool call.
Signature
declare class ResponseMcpCallArgumentsDeltaEvent
Since v1.0.0
ResponseMcpCallArgumentsDoneEvent (class)
Emitted when the arguments for an MCP tool call are finalized.
Signature
declare class ResponseMcpCallArgumentsDoneEvent
Since v1.0.0
ResponseMcpCallCompletedEvent (class)
Emitted when an MCP tool call has completed successfully.
Signature
declare class ResponseMcpCallCompletedEvent
Since v1.0.0
ResponseMcpCallFailedEvent (class)
Emitted when an MCP tool call has failed.
Signature
declare class ResponseMcpCallFailedEvent
Since v1.0.0
ResponseMcpCallInProgressEvent (class)
Emitted when an MCP tool call is in progress.
Signature
declare class ResponseMcpCallInProgressEvent
Since v1.0.0
ResponseMcpListToolsCompletedEvent (class)
Emitted when the list of available MCP tools has been successfully retrieved.
Signature
declare class ResponseMcpListToolsCompletedEvent
Since v1.0.0
ResponseMcpListToolsFailedEvent (class)
Emitted when the attempt to list available MCP tools has failed.
Signature
declare class ResponseMcpListToolsFailedEvent
Since v1.0.0
ResponseMcpListToolsInProgressEvent (class)
Emitted when the system is in the process of retrieving the list of available MCP tools.
Signature
declare class ResponseMcpListToolsInProgressEvent
Since v1.0.0
ResponseOutputItemAddedEvent (class)
Emitted when a new output item is added.
Signature
declare class ResponseOutputItemAddedEvent
Since v1.0.0
ResponseOutputItemDoneEvent (class)
Emitted when an output item is marked done.
Signature
declare class ResponseOutputItemDoneEvent
Since v1.0.0
ResponseOutputTextAnnotationAddedEvent (class)
Emitted when an annotation is added to output text content.
Signature
declare class ResponseOutputTextAnnotationAddedEvent
Since v1.0.0
ResponseOutputTextDeltaEvent (class)
Emitted when there is an additional text delta.
Signature
declare class ResponseOutputTextDeltaEvent
Since v1.0.0
ResponseOutputTextDoneEvent (class)
Emitted when text content is finalized.
Signature
declare class ResponseOutputTextDoneEvent
Since v1.0.0
ResponseQueuedEvent (class)
Emitted when a response is queued and waiting to be processed.
Signature
declare class ResponseQueuedEvent
Since v1.0.0
ResponseReasoningSummaryPartAddedEvent (class)
Emitted when a reasoning summary part is completed.
Signature
declare class ResponseReasoningSummaryPartAddedEvent
Since v1.0.0
ResponseReasoningSummaryPartDoneEvent (class)
Emitted when a new reasoning summary part is added.
Signature
declare class ResponseReasoningSummaryPartDoneEvent
Since v1.0.0
ResponseReasoningSummaryTextDeltaEvent (class)
Emitted when a delta is added to a reasoning summary text.
Signature
declare class ResponseReasoningSummaryTextDeltaEvent
Since v1.0.0
ResponseReasoningSummaryTextDoneEvent (class)
Emitted when a reasoning summary text is completed.
Signature
declare class ResponseReasoningSummaryTextDoneEvent
Since v1.0.0
ResponseReasoningTextDeltaEvent (class)
Emitted when a delta is added to a reasoning text.
Signature
declare class ResponseReasoningTextDeltaEvent
Since v1.0.0
ResponseReasoningTextDoneEvent (class)
Emitted when a reasoning text is completed.
Signature
declare class ResponseReasoningTextDoneEvent
Since v1.0.0
ResponseRefusalDeltaEvent (class)
Emitted when there is a partial refusal text.
Signature
declare class ResponseRefusalDeltaEvent
Since v1.0.0
ResponseRefusalDoneEvent (class)
Emitted when refusal text is finalized.
Signature
declare class ResponseRefusalDoneEvent
Since v1.0.0
ResponseStreamEvent
Represents the events that can be emitted during a streaming response.
Signature
declare const ResponseStreamEvent: Schema.Union<
[
typeof ResponseCreatedEvent,
typeof ResponseQueuedEvent,
typeof ResponseInProgressEvent,
typeof ResponseCompletedEvent,
typeof ResponseIncompleteEvent,
typeof ResponseFailedEvent,
typeof ResponseOutputItemAddedEvent,
typeof ResponseOutputItemDoneEvent,
typeof ResponseContentPartAddedEvent,
typeof ResponseContentPartDoneEvent,
typeof ResponseOutputTextDeltaEvent,
typeof ResponseOutputTextDoneEvent,
typeof ResponseOutputTextAnnotationAddedEvent,
typeof ResponseRefusalDeltaEvent,
typeof ResponseRefusalDoneEvent,
typeof ResponseFunctionCallArgumentsDeltaEvent,
typeof ResponseFunctionCallArgumentsDoneEvent,
typeof ResponseFileSearchCallInProgressEvent,
typeof ResponseFileSearchCallSearchingEvent,
typeof ResponseFileSearchCallCompletedEvent,
typeof ResponseWebSearchCallInProgressEvent,
typeof ResponseWebSearchCallSearchingEvent,
typeof ResponseWebSearchCallCompletedEvent,
typeof ResponseReasoningSummaryPartAddedEvent,
typeof ResponseReasoningSummaryPartDoneEvent,
typeof ResponseReasoningSummaryTextDeltaEvent,
typeof ResponseReasoningSummaryTextDoneEvent,
typeof ResponseReasoningTextDeltaEvent,
typeof ResponseReasoningTextDoneEvent,
typeof ResponseImageGenerationCallInProgressEvent,
typeof ResponseImageGenerationCallGeneratingEvent,
typeof ResponseImageGenerationCallPartialImageEvent,
typeof ResponseImageGenerationCallCompletedEvent,
typeof ResponseMcpCallArgumentsDeltaEvent,
typeof ResponseMcpCallArgumentsDoneEvent,
typeof ResponseMcpCallInProgressEvent,
typeof ResponseMcpCallCompletedEvent,
typeof ResponseMcpCallFailedEvent,
typeof ResponseMcpListToolsInProgressEvent,
typeof ResponseMcpListToolsCompletedEvent,
typeof ResponseMcpListToolsFailedEvent,
typeof ResponseCodeInterpreterCallInProgressEvent,
typeof ResponseCodeInterpreterCallInterpretingEvent,
typeof ResponseCodeInterpreterCallCompletedEvent,
typeof ResponseCodeInterpreterCallCodeDeltaEvent,
typeof ResponseCodeInterpreterCallCodeDoneEvent,
typeof ResponseCustomToolCallInputDeltaEvent,
typeof ResponseCustomToolCallInputDoneEvent,
typeof ResponseErrorEvent
]
>
Since v1.0.0
ResponseWebSearchCallCompletedEvent (class)
Emitted when a web search call is completed.
Signature
declare class ResponseWebSearchCallCompletedEvent
Since v1.0.0
ResponseWebSearchCallInProgressEvent (class)
Emitted when a web search call is initiated.
Signature
declare class ResponseWebSearchCallInProgressEvent
Since v1.0.0
ResponseWebSearchCallSearchingEvent (class)
Emitted when a web search call is executing.
Signature
declare class ResponseWebSearchCallSearchingEvent
Since v1.0.0
SummaryPart (class)
Signature
declare class SummaryPart
Since v1.0.0