struct
AI::OpenAI::OpenAIConfig
- AI::OpenAI::OpenAIConfig
- Struct
- Value
- Object
Overview
Configuration for OpenAI API models.
This struct holds the configuration needed to make API calls to OpenAI or OpenAI-compatible providers.
Defined in:
ai/openai/openai_config.crConstructors
Instance Method Summary
-
#file_id_prefixes : Array(String) | Nil
File ID prefixes used to identify file IDs in Responses API.
-
#generate_id : Proc(String) | Nil
Optional proc that generates unique IDs.
-
#headers : Proc(Hash(String, String))
Proc that returns the headers for API requests.
-
#provider : String
The provider identifier (e.g., "openai.chat", "openai.responses").
-
#url : Proc(URLOptions, String)
Proc that builds the full URL for an API endpoint.
Constructor Detail
Instance Method Detail
File ID prefixes used to identify file IDs in Responses API.
When nil, all file data is treated as base64 content.
Examples:
- OpenAI: ["file-"] for IDs like "file-abc123"
- Azure OpenAI: ["assistant-"] for IDs like "assistant-abc123"
Optional proc that generates unique IDs.
Used for generating tool call IDs and other identifiers.
Proc that returns the headers for API requests.
This is called for each request, allowing for dynamic header generation (e.g., token refresh).
Proc that builds the full URL for an API endpoint.
Receives a NamedTuple with:
- model_id: The model identifier
- path: The API endpoint path (e.g., "/chat/completions")
Returns the complete URL string.