-
Notifications
You must be signed in to change notification settings - Fork 83
Add gateway implementations for custom LLM provider feature #2456
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,11 +19,18 @@ | |
| package models | ||
|
|
||
| import ( | ||
| "strings" | ||
| "time" | ||
|
|
||
| api "github.com/wso2/api-platform/gateway/gateway-controller/pkg/api/management" | ||
| ) | ||
|
|
||
| // DefaultTemplateVersion is used when a template does not declare a version. | ||
| const DefaultTemplateVersion = "v1.0" | ||
|
|
||
| // DefaultTemplateManagedBy is used when a template does not declare managedBy. | ||
| const DefaultTemplateManagedBy = "customer" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For Custom Policies, we are using. managedBy: customerShould we use the same for the LLM Provider template? managedBy: other
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should use one approach ideally. Do we see any issue in managedBy: wso2/customer pair?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Mm, yeah +1 for a consistent approach. |
||
|
|
||
| // StoredLLMProviderTemplate represents the LLM provider template stored in the database and in-memory | ||
| type StoredLLMProviderTemplate struct { | ||
| UUID string `json:"uuid"` | ||
|
|
@@ -36,3 +43,30 @@ type StoredLLMProviderTemplate struct { | |
| func (t *StoredLLMProviderTemplate) GetHandle() string { | ||
| return t.Configuration.Metadata.Name | ||
| } | ||
|
|
||
| func (t *StoredLLMProviderTemplate) GetGroupID() string { | ||
| if t.Configuration.Spec.GroupId != nil { | ||
| if v := strings.TrimSpace(*t.Configuration.Spec.GroupId); v != "" { | ||
| return v | ||
| } | ||
| } | ||
| return t.Configuration.Metadata.Name | ||
| } | ||
|
|
||
| func (t *StoredLLMProviderTemplate) GetVersion() string { | ||
| if t.Configuration.Spec.Version != nil { | ||
| if v := strings.TrimSpace(*t.Configuration.Spec.Version); v != "" { | ||
| return v | ||
| } | ||
| } | ||
| return DefaultTemplateVersion | ||
| } | ||
|
|
||
| func (t *StoredLLMProviderTemplate) GetManagedBy() string { | ||
| if t.Configuration.Spec.ManagedBy != nil { | ||
| if p := strings.TrimSpace(*t.Configuration.Spec.ManagedBy); p != "" { | ||
| return p | ||
| } | ||
| } | ||
| return DefaultTemplateManagedBy | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shall we change this to openai for consistency?