orkes.services.LLMProviderStrategy#

class orkes.services.LLMProviderStrategy[source]#

Abstract base class for LLM provider strategies.

This class defines the interface for handling provider-specific logic, such as preparing payloads, parsing responses, and generating headers. Each provider (e.g., OpenAI, Anthropic) should have its own implementation of this class.

__init__()#

Methods

__init__()

get_headers(api_key)

Gets the authentication headers for the LLM provider.

get_messages_payload(messages)

Converts an Orkes message schema to a format suitable for the LLM provider.

get_tools_payload(tools)

Converts an Orkes tool schema to a format suitable for the LLM provider.

parse_response(response_data)

Parses a response from the LLM provider.

parse_stream_chunk(chunk)

Parses a single chunk of a streaming response.

prepare_payload(model, messages, stream, ...)

Prepares the payload for a request to the LLM provider.