-
Couldn't load subscription status.
- Fork 88
feat: added go sdk setup in custom providers doc #521
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
feat: added go sdk setup in custom providers doc #521
Conversation
📝 WalkthroughSummary by CodeRabbit
WalkthroughAdds a Go SDK example tab to the Custom Providers documentation ( Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
cd6838f to
810b456
Compare
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.
810b456 to
6749ba6
Compare
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.
Actionable comments posted: 0
🧹 Nitpick comments (3)
docs/features/custom-providers.mdx (3)
140-140: Avoid unused parameter compile error in Go: ignore ctx if not used.Rename the parameter to
_so the snippet compiles when copied.-func (a *MyAccount) GetKeysForProvider(ctx context.Context, provider schemas.ModelProvider) ([]schemas.Key, error) { +func (a *MyAccount) GetKeysForProvider(_ context.Context, provider schemas.ModelProvider) ([]schemas.Key, error) {
143-154: Validate presence of API keys to prevent empty credentials.Return a clear error if env vars are missing; avoids 401s and makes the sample safer to copy.
- case schemas.OpenAI: - return []schemas.Key{{ - Value: os.Getenv("OPENAI_API_KEY"), - Models: []string{}, - Weight: 1.0, - }}, nil + case schemas.OpenAI: + key := os.Getenv("OPENAI_API_KEY") + if key == "" { + return nil, fmt.Errorf("OPENAI_API_KEY is not set") + } + return []schemas.Key{{ + Value: key, + Models: []string{}, + Weight: 1.0, + }}, nil case ProviderOpenAICustom: - return []schemas.Key{{ - Value: os.Getenv("OPENAI_CUSTOM_API_KEY"), // API key for OpenAI-compatible endpoint - Models: []string{}, - Weight: 1.0, - }}, nil + key := os.Getenv("OPENAI_CUSTOM_API_KEY") // API key for OpenAI-compatible endpoint + if key == "" { + return nil, fmt.Errorf("OPENAI_CUSTOM_API_KEY is not set") + } + return []schemas.Key{{ + Value: key, + Models: []string{}, + Weight: 1.0, + }}, nil
198-199: Optional: Add a minimal usage snippet.Consider adding a short example showing constructing the SDK client with
MyAccountand usingmodel: "openai-custom/..."to mirror the cURL example below. This helps readers connect configuration with usage.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
docs/features/custom-providers.mdx(1 hunks)
🔇 Additional comments (1)
docs/features/custom-providers.mdx (1)
112-196: Go SDK tab addition looks solid; previous review issues resolved.
- The context parameter now uses
context.Context(non-pointer) and the unusedbifrostimport has been removed. Good cleanup.
Merge activity
|

Summary
Added Go SDK example for creating custom providers in the documentation, showing how to implement the Account interface with custom provider configuration.
Changes
Type of change
Affected areas
How to test
/docs/features/custom-providers.mdxBreaking changes
Related issues
Improves developer experience by providing Go SDK examples for custom provider implementation.
Checklist