Class: LittleGhost::Providers::OpenAI

Inherits:
OpenAICompatible show all
Defined in:
lib/little_ghost/providers/openai.rb

Overview

OpenAI connects LittleGhost agents to OpenAI models with streaming, tools, and structured results. It uses the Responses API by default.

provider = LittleGhost::Providers::OpenAI.new(
api_key: ENV.fetch("OPENAI_API_KEY"),
model: ENV.fetch("OPENAI_MODEL")
)

Supply api: :chat_completions only when a model or integration requires the Chat Completions wire API.

Constant Summary collapse

DEFAULT_BASE_URL =

The OpenAI API endpoint used when base_url is omitted.

"https://api.openai.com/v1/"

Constants inherited from OpenAICompatible

LittleGhost::Providers::OpenAICompatible::CONTEXT_OVERFLOW_MARKERS, LittleGhost::Providers::OpenAICompatible::INITIAL_RETRY_DELAY, LittleGhost::Providers::OpenAICompatible::MAX_RETRY_DELAY, LittleGhost::Providers::OpenAICompatible::TRANSIENT_STREAM_ERROR_TYPES

Instance Attribute Summary

Attributes inherited from OpenAICompatible

#api, #model

Instance Method Summary collapse

Methods inherited from OpenAICompatible

#capabilities, #stream

Constructor Details

#initialize(base_url: DEFAULT_BASE_URL, **arguments) ⇒ OpenAI

Uses the official OpenAI API base URL by default.



22
23
24
# File 'lib/little_ghost/providers/openai.rb', line 22

def initialize(base_url: DEFAULT_BASE_URL, **arguments)
  super
end