mirror of
https://github.com/crawlab-team/crawlab.git
synced 2026-01-21 17:21:09 +01:00
feat: add deployment name to LLMProvider for Azure OpenAI support
Updated LLMProvider struct to include a new 'DeploymentName' field: - Added 'deployment_name' tag for JSON and BSON serialization - Modified IsUnset() method to check for deployment name in Azure OpenAI configuration - Ensures more comprehensive validation for Azure OpenAI provider setup
This commit is contained in:
@@ -4,14 +4,15 @@ package models
|
||||
type LLMProvider struct {
|
||||
any `collection:"llm_providers"`
|
||||
BaseModel[LLMProvider] `bson:",inline"`
|
||||
Key string `json:"key" bson:"key"` // Provider key (e.g., "openai", "anthropic", "gemini")
|
||||
Name string `json:"name" bson:"name"` // Display name for UI
|
||||
Enabled bool `json:"enabled" bson:"enabled"` // Whether this provider is enabled
|
||||
ApiKey string `json:"api_key" bson:"api_key"` // API key for the provider
|
||||
ApiBaseUrl string `json:"api_base_url" bson:"api_base_url"` // API base URL for the provider
|
||||
ApiVersion string `json:"api_version" bson:"api_version"` // API version for the provider
|
||||
Models []string `json:"models" bson:"models"` // Models supported by this provider
|
||||
Unset bool `json:"unset" bson:"-"` // Whether the provider is unset
|
||||
Key string `json:"key" bson:"key"` // Provider key (e.g., "openai", "anthropic", "gemini")
|
||||
Name string `json:"name" bson:"name"` // Display name for UI
|
||||
Enabled bool `json:"enabled" bson:"enabled"` // Whether this provider is enabled
|
||||
ApiKey string `json:"api_key" bson:"api_key"` // API key for the provider
|
||||
ApiBaseUrl string `json:"api_base_url" bson:"api_base_url"` // API base URL for the provider
|
||||
DeploymentName string `json:"deployment_name" bson:"deployment_name"` // Deployment name for the provider
|
||||
ApiVersion string `json:"api_version" bson:"api_version"` // API version for the provider
|
||||
Models []string `json:"models" bson:"models"` // Models supported by this provider
|
||||
Unset bool `json:"unset" bson:"-"` // Whether the provider is unset
|
||||
}
|
||||
|
||||
func (p *LLMProvider) IsUnset() bool {
|
||||
@@ -23,7 +24,7 @@ func (p *LLMProvider) IsUnset() bool {
|
||||
}
|
||||
switch p.Key {
|
||||
case "azure-openai":
|
||||
return p.ApiBaseUrl == "" && p.ApiVersion == ""
|
||||
return p.ApiBaseUrl == "" || p.DeploymentName == "" || p.ApiVersion == ""
|
||||
case "openai-compatible":
|
||||
return p.ApiBaseUrl == ""
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user