Class: LittleGhost::Providers::OpenAI
- Inherits:
-
OpenAICompatible
- Object
- OpenAICompatible
- LittleGhost::Providers::OpenAI
- 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_urlis 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
Instance Method Summary collapse
-
#initialize(base_url: DEFAULT_BASE_URL, **arguments) ⇒ OpenAI
constructor
Uses the official OpenAI API base URL by default.
Methods inherited from OpenAICompatible
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 |