Class ZCL_LLM_CLIENT_OLLAMA
AI Generated documentation.
Overview
The zcl_llm_client_ollama
class is a subclass of zcl_llm_client_base
and provides a client for interacting with the Ollama API. It is designed to handle chat requests and responses, and provides methods for building requests, handling HTTP responses, and parsing messages.
Dependencies
The class depends on the following external objects:
zcl_llm_http_client_wrapper
: for creating an HTTP clientzcl_llm_common
: for encryption and decryptionzif_llm_client
: for interacting with the Ollama APIzif_llm_tool
: for interacting with tools
Details
Class Structure
class zcl_llm_client_ollama : zcl_llm_client_base
+-- constructor
+-- get_client
+-- get_http_client
+-- set_auth
+-- build_request_json
+-- get_chat_endpoint
+-- handle_http_response
+-- parse_message
Main Interactions
The class interacts with the following external objects:
zcl_llm_http_client_wrapper
: for creating an HTTP clientzcl_llm_common
: for encryption and decryptionzif_llm_client
: for interacting with the Ollama APIzif_llm_tool
: for interacting with tools
Logic Flow
The class follows the following logic flow:
- The
get_client
method creates a new instance of the class and returns it. - The
get_http_client
method creates an HTTP client usingzcl_llm_http_client_wrapper
. - The
set_auth
method sets the authentication headers for the HTTP client. - The
build_request_json
method builds the request JSON by modifying the request and adding Ollama-specific format parameters. - The
get_chat_endpoint
method returns the chat endpoint URL. - The
handle_http_response
method handles the HTTP response and parses the message. - The
parse_message
method parses the message and returns the parsed data.
Expert Notes
- The class uses a combination of encryption and decryption to secure the communication with the Ollama API.
- The class supports multiple tools and can handle tool-specific requests.
- The class uses a JSON-based format for the request and response data.
- The class provides a flexible way to handle chat requests and responses.