ops

package
v0.260318.0-hotfix Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 18, 2026 License: MPL-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ProviderConfigs = []providerConfig{

	{
		APIBasePattern: "api.deepseek.com",
		ModelPattern:   "*",
		Transform:      applyDeepSeekTransform,
	},

	{
		APIBasePattern: "api.moonshot.cn",
		ModelPattern:   "*",
		Transform:      applyDeepSeekTransform,
	},

	{
		APIBasePattern: "api.moonshot.ai",
		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

View Source
var ResponseConfigs = []responseConfig{

	{"api.deepseek.com", applyDeepSeekResponseTransform},
}

ResponseConfigs holds all registered provider response configurations

Functions

func ApplyProviderTransforms

func ApplyProviderTransforms(req *openai.ChatCompletionNewParams, providerURL, model string, config *protocol.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{}, providerURL, 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 ProviderTransform

ProviderTransform applies provider-specific transformations to OpenAI requests

func GetProviderTransform

func GetProviderTransform(providerURL, model string) ProviderTransform

GetProviderTransform identifies provider by APIBase URL string and returns its transform Returns nil if no specific transform is needed (fallback to default)

type ResponseTransform

type ResponseTransform func(map[string]interface{}, string, string) map[string]interface{}

ResponseTransform applies provider-specific transformations to OpenAI responses

func GetResponseTransform

func GetResponseTransform(providerURL string) ResponseTransform

GetResponseTransform identifies provider by APIBase URL and returns its response transform

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL