-
Notifications
You must be signed in to change notification settings - Fork 6
feat: add Type() to Provider interface and configurable instance Name #237
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -48,6 +48,9 @@ var anthropicIsFailure = func(statusCode int) bool { | |
| } | ||
|
|
||
| func NewAnthropic(cfg config.Anthropic, bedrockCfg *config.AWSBedrock) *Anthropic { | ||
| if cfg.Name == "" { | ||
| cfg.Name = config.ProviderAnthropic | ||
| } | ||
| if cfg.BaseURL == "" { | ||
| cfg.BaseURL = "https://api.anthropic.com/" | ||
| } | ||
|
|
@@ -68,10 +71,14 @@ func NewAnthropic(cfg config.Anthropic, bedrockCfg *config.AWSBedrock) *Anthropi | |
| } | ||
| } | ||
|
|
||
| func (p *Anthropic) Name() string { | ||
| func (p *Anthropic) Type() string { | ||
| return config.ProviderAnthropic | ||
| } | ||
|
|
||
| func (p *Anthropic) Name() string { | ||
| return p.cfg.Name | ||
|
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. Since
Contributor
Author
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. Yes, it should. I can add it in
Contributor
Author
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. Added here: 7d0c198 |
||
| } | ||
|
|
||
| func (p *Anthropic) RoutePrefix() string { | ||
| return fmt.Sprintf("/%s", p.Name()) | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
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.
Keeping the provider type ("anthropic", "openai", "copilot") so interceptions preserve this value and we are still easily able to aggregate by provider. The
ProviderNamefield provides the specific instance identity. Alternatively, we could store the upstream URL instead.Examples: