Documentation
¶
Index ¶
- Variables
- func ApplyProviderTransforms(req *openai.ChatCompletionNewParams, provider *typ.Provider, model string, ...) *openai.ChatCompletionNewParams
- func ApplyResponseTransforms(resp map[string]interface{}, provider *typ.Provider, model string) map[string]interface{}
- func MessageToMap(msg openai.ChatCompletionMessageParamUnion) (map[string]interface{}, error)
- type OpenAIConfig
- type ProviderTransform
- type ResponseTransform
Constants ¶
This section is empty.
Variables ¶
var ProviderConfigs = []providerConfig{
{
APIBasePattern: "api.deepseek.com",
ModelPattern: "*",
Transform: applyDeepSeekTransform,
},
{
APIBasePattern: "generativelanguage.googleapis.com",
ModelPattern: "gemini",
Transform: applyGeminiTransform,
},
{
APIBasePattern: "poe.com",
ModelPattern: "gemini",
Transform: applyGeminiPoeTransform,
},
}
ProviderConfigs holds all registered provider configurations Add new providers here with their APIBase domain patterns
var ResponseConfigs = []responseConfig{
{"api.deepseek.com", applyDeepSeekResponseTransform},
}
ResponseConfigs holds all registered provider response configurations
Functions ¶
func ApplyProviderTransforms ¶
func ApplyProviderTransforms(req *openai.ChatCompletionNewParams, provider *typ.Provider, model string, config *OpenAIConfig) *openai.ChatCompletionNewParams
ApplyProviderTransforms applies provider-specific transformations Falls back to default handling if no specific transform found
func ApplyResponseTransforms ¶
func ApplyResponseTransforms(resp map[string]interface{}, provider *typ.Provider, model string) map[string]interface{}
ApplyResponseTransforms applies provider-specific transformations to responses
func MessageToMap ¶
func MessageToMap(msg openai.ChatCompletionMessageParamUnion) (map[string]interface{}, error)
MessageToMap converts a ChatCompletionMessageParamUnion to a map for modification
Types ¶
type OpenAIConfig ¶
type OpenAIConfig struct {
// HasThinking indicates whether the request contains thinking content
// This can be used by providers like DeepSeek to handle reasoning_content
HasThinking bool
// ReasoningEffort specifies the reasoning effort level for OpenAI-compatible APIs
// Valid values: "none", "minimal", "low", "medium", "high", "xhigh"
// Defaults to "low" when HasThinking is true
ReasoningEffort shared.ReasoningEffort
}
OpenAIConfig contains additional metadata that may be used by provider transforms
type ProviderTransform ¶
type ProviderTransform func(*openai.ChatCompletionNewParams, *typ.Provider, string, *OpenAIConfig) *openai.ChatCompletionNewParams
ProviderTransform applies provider-specific transformations to OpenAI requests
func GetProviderTransform ¶
func GetProviderTransform(provider *typ.Provider, model string) ProviderTransform
GetProviderTransform identifies provider by APIBase and returns its transform Returns nil if no specific transform is needed (fallback to default)
type ResponseTransform ¶
ResponseTransform applies provider-specific transformations to OpenAI responses
func GetResponseTransform ¶
func GetResponseTransform(provider *typ.Provider) ResponseTransform
GetResponseTransform identifies provider by APIBase and returns its response transform