Completions.ts overview
Since v1.0.0
Exports Grouped by Category
constructors
make
Signature
declare const make: (options: {
readonly create: (options: {
readonly system: Option.Option<string>
readonly input: Chunk.NonEmptyChunk<Message>
readonly tools: Array<{
readonly name: string
readonly description: string
readonly parameters: JsonSchema.JsonSchema7
readonly structured: boolean
}>
readonly required: boolean | string
readonly span: Span
}) => Effect.Effect<AiResponse, AiError>
readonly stream: (options: {
readonly system: Option.Option<string>
readonly input: Chunk.NonEmptyChunk<Message>
readonly tools: Array<{
readonly name: string
readonly description: string
readonly parameters: JsonSchema.JsonSchema7
readonly structured: boolean
}>
readonly required: boolean | string
readonly span: Span
}) => Stream.Stream<AiResponse, AiError>
}) => Effect.Effect<Completions.Service>
Since v1.0.0
models
CompletionOptions (interface)
Signature
export interface CompletionOptions {
readonly system: Option.Option<string>
readonly input: Chunk.NonEmptyChunk<Message>
readonly tools: Array<{
readonly name: string
readonly description: string
readonly parameters: JsonSchema.JsonSchema7
readonly structured: boolean
}>
readonly required: boolean | string
}
Since v1.0.0
Completions (namespace)
Since v1.0.0
TaggedSchema (interface)
Signature
export interface TaggedSchema<A, I, R> extends Schema.Schema<A, I, R> {
readonly _tag: string
}
Since v1.0.0
IdentifiedSchema (interface)
Signature
export interface IdentifiedSchema<A, I, R> extends Schema.Schema<A, I, R> {
readonly identifier: string
}
Since v1.0.0
Service (interface)
Signature
export interface Service {
readonly create: (input: AiInput.Input) => Effect.Effect<AiResponse, AiError>
readonly stream: (input: AiInput.Input) => Stream.Stream<AiResponse, AiError>
readonly structured: {
<A, I, R>(options: {
readonly input: AiInput.Input
readonly schema: StructuredSchema<A, I, R>
}): Effect.Effect<WithResolved<A>, AiError, R>
<A, I, R>(options: {
readonly input: AiInput.Input
readonly schema: Schema.Schema<A, I, R>
readonly toolCallId: string
}): Effect.Effect<WithResolved<A>, AiError, R>
}
readonly toolkit: <Tools extends AiToolkit.Tool.AnySchema>(options: {
readonly input: AiInput.Input
readonly tools: AiToolkit.Handlers<Tools>
readonly required?: Tools["_tag"] | boolean | undefined
readonly concurrency?: Concurrency | undefined
}) => Effect.Effect<
WithResolved<AiToolkit.Tool.Success<Tools>>,
AiError | AiToolkit.Tool.Failure<Tools>,
AiToolkit.Tool.Context<Tools>
>
readonly toolkitStream: <Tools extends AiToolkit.Tool.AnySchema>(options: {
readonly input: AiInput.Input
readonly tools: AiToolkit.Handlers<Tools>
readonly required?: Tools["_tag"] | boolean | undefined
readonly concurrency?: Concurrency | undefined
}) => Stream.Stream<
WithResolved<AiToolkit.Tool.Success<Tools>>,
AiError | AiToolkit.Tool.Failure<Tools>,
AiToolkit.Tool.Context<Tools>
>
}
Since v1.0.0
StructuredSchema (type alias)
Signature
type StructuredSchema<A, I, R> = TaggedSchema<A, I, R> | IdentifiedSchema<A, I, R>
Since v1.0.0
tags
Completions (class)
Signature
declare class Completions
Since v1.0.0