Skip to main content Link Search Menu Expand Document (external link)

OpenAiLanguageModel.ts overview

Since v1.0.0


Exports Grouped by Category


Ai Models

model

Signature

declare const model: (
  model: (string & {}) | Model,
  config?: Omit<Config.Service, "model">
) => AiModel.Model<"openai", LanguageModel.LanguageModel, OpenAiClient>

Source

Since v1.0.0

modelWithTokenizer

Signature

declare const modelWithTokenizer: (
  model: (string & {}) | Model,
  config?: Omit<Config.Service, "model">
) => AiModel.Model<"openai", LanguageModel.LanguageModel | Tokenizer.Tokenizer, OpenAiClient>

Source

Since v1.0.0

Configuration

withConfigOverride

Signature

declare const withConfigOverride: {
  (overrides: Config.Service): <A, E, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>
  <A, E, R>(self: Effect.Effect<A, E, R>, overrides: Config.Service): Effect.Effect<A, E, R>
}

Source

Since v1.0.0

Constructors

make

Signature

declare const make: (options: {
  readonly model: (string & {}) | Model
  readonly config?: Omit<Config.Service, "model">
}) => Effect.Effect<LanguageModel.Service, never, OpenAiClient>

Source

Since v1.0.0

Context

Config (class)

Signature

declare class Config

Source

Since v1.0.0

Layers

layer

Signature

declare const layer: (options: {
  readonly model: (string & {}) | Model
  readonly config?: Omit<Config.Service, "model">
}) => Layer.Layer<LanguageModel.LanguageModel, never, OpenAiClient>

Source

Since v1.0.0

layerWithTokenizer

Signature

declare const layerWithTokenizer: (options: {
  readonly model: (string & {}) | Model
  readonly config?: Omit<Config.Service, "model">
}) => Layer.Layer<LanguageModel.LanguageModel | Tokenizer.Tokenizer, never, OpenAiClient>

Source

Since v1.0.0

Models

Model (type alias)

Signature

type Model = typeof Generated.ChatModel.Encoded | typeof Generated.ModelIdsResponsesEnum.Encoded

Source

Since v1.0.0

utils

Config (namespace)

Source

Since v1.0.0

Service (interface)

Signature

export interface Service
  extends Simplify<
    Partial<Omit<typeof Generated.CreateResponse.Encoded, "input" | "tools" | "tool_choice" | "stream" | "text">>
  > {
  /**
   * File ID prefixes used to identify file IDs in Responses API.
   * When undefined, all file data is treated as base64 content.
   *
   * Examples:
   * - OpenAI: ['file-'] for IDs like 'file-abc123'
   * - Azure OpenAI: ['assistant-'] for IDs like 'assistant-abc123'
   */
  readonly fileIdPrefixes?: ReadonlyArray<string>
  /**
   * Configuration options for a text response from the model.
   */
  readonly text?: {
    /**
     * Constrains the verbosity of the model's response. Lower values will
     * result in more concise responses, while higher values will result in
     * more verbose responses.
     *
     * Defaults to `"medium"`.
     */
    readonly verbosity?: "low" | "medium" | "high"
  }

  /**
   * Controls whether tool and response format schemas are sent with
   * `strict: true` to enable OpenAI's structured outputs mode.
   *
   * When `true` (default), OpenAI validates that tool schemas comply with
   * strict mode requirements (all properties in `required`,
   * `additionalProperties: false` on all objects, etc.).
   *
   * Set to `false` to send tool schemas without strict mode validation,
   * which is useful when tool parameter schemas use `Schema.optional()`
   * (optional properties are not listed in `required` by Effect's JSON
   * schema generator, which strict mode rejects).
   *
   * Defaults to `true` for backward compatibility.
   */
  readonly strict?: boolean
}

Source

Since v1.0.0

ProviderMetadata (namespace)

Source

Since v1.0.0

Service (interface)

Signature

export interface Service {
  source: {} | {}
}

Source

Since v1.0.0