-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Open
Labels
enhancementNew feature or requestNew feature or requesthelp wantedExtra attention is neededExtra attention is needed
Description
We have a growing number of different API providers: OpenAI, Azure, Cloudflare Getaway. At the same time other tools keep adding their OpenAI-compatible APIs (e.g. Ollama).
Considering #693, here's a sketch of how we can add new API providers painlessly:
type apiProvider interface { // might want to expose that
SetAuthForRequest(req *http.Request)
GetFullURL(suffix string, args ...any) // Shouldn't be `any`, but a type-safe list like requestOption
}
type APIProviderConfig interface {
// whatever we need here
}client usage:
config := openai.DefaultConfigWithAPIProvider(
openai.AzureOpenAIProviderConfig("your Azure OpenAI Key", "https://your Azure OpenAI Endpoint"),
)
client := openai.NewClientWithConfig(config)sammcjliushuangls
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requesthelp wantedExtra attention is neededExtra attention is needed