Class ZCL_LLM_CLIENT_OPENAI
AI Generated documentation.
Overview
The zcl_llm_client_openai
class is a specialized implementation for interacting with OpenAI's language model API. It is a concrete implementation of a language model client, designed to handle authentication, endpoint configuration, and client creation for OpenAI's chat completion services. The class follows a singleton-like pattern with a private constructor and a class method get_client()
for obtaining instances.
Public methods include:
get_client()
: Static method to create and return a new client instanceconstructor()
: Initializes the client with configuration parameters
Dependencies
zcl_llm_client_base
: Base class for language model clientszcl_llm_common
: Utility class for retrieving BADIszcl_llm_http_client_wrapper
: HTTP client creation utilityzcl_llm_so_js_oa
: Structured output handler for OpenAI responses
Details
The class implements several key protected methods to customize the OpenAI client behavior:
classDiagram
class zcl_llm_client_openai {
+get_client()
-get_chat_endpoint()
-set_auth()
-create_structured_output()
-get_http_client()
}
note "Overrides base class methods\nto provide OpenAI-specific implementation" as NoteOverride
Key implementation details:
- Authentication is handled by decrypting an encrypted token if provided
- Uses a Bearer token authentication method
- Hardcoded chat completion endpoint
/chat/completions
- Utilizes a factory method pattern for client creation
- Supports configuration through
client_config
andprovider_config
parameters
The class is designed to be extensible and configurable, allowing different authentication and client setup scenarios while maintaining a consistent interface for language model interactions.