Skip to content

Conversation

@TejasGhatte
Copy link
Collaborator

@TejasGhatte TejasGhatte commented Sep 26, 2025

Summary

Added Go SDK example for creating custom providers in the documentation, showing how to implement the Account interface with custom provider configuration.

Changes

  • Added a Go SDK code example in the custom-providers.mdx documentation
  • Demonstrated how to implement the Account interface with custom provider support
  • Included example configuration for an OpenAI-compatible custom provider
  • Showed how to set custom base URLs, network configurations, and allowed request types

Type of change

  • Bug fix
  • Feature
  • Refactor
  • Documentation
  • Chore/CI

Affected areas

  • Core (Go)
  • Transports (HTTP)
  • Providers/Integrations
  • Plugins
  • UI (Next.js)
  • Docs

How to test

  1. View the updated documentation page at /docs/features/custom-providers.mdx
  2. Verify the Go SDK tab appears alongside existing examples
  3. Ensure the code example is properly formatted and syntax highlighted

Breaking changes

  • No

Related issues

Improves developer experience by providing Go SDK examples for custom provider implementation.

Checklist

  • I updated documentation where needed

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Sep 26, 2025

📝 Walkthrough

Summary by CodeRabbit

  • Documentation
    • Added a Go SDK example tab to the Custom Providers docs.
    • Provides a runnable example showing how to register multiple providers (e.g., OpenAI and an OpenAI-compatible provider) with environment-based API keys.
    • Demonstrates provider-specific configuration, including custom base URL, timeouts, retries, concurrency, and request restrictions (enabling chat completion and streaming).
    • No changes to app behavior; documentation-only update.

Walkthrough

Adds a Go SDK example tab to the Custom Providers documentation (docs/features/custom-providers.mdx) showing a MyAccount example that wires OpenAI and an OpenAI‑compatible custom provider, sources API keys from environment variables, and supplies provider-specific settings (BaseURL, timeouts, retries, concurrency, allowed chat completion/streaming). No runtime code changes.

Changes

Cohort / File(s) Summary
Docs — Custom Providers (Go SDK example)
docs/features/custom-providers.mdx
Added a Go SDK example implementing MyAccount that declares provider constants, implements GetKeysForProvider (env-based keys) and GetConfigForProvider, configures a custom provider BaseURL, timeouts, retry settings, concurrency/buffer sizing, and a CustomProviderConfig allowing ChatCompletion and ChatCompletionStream. No other files modified.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

I thump my paws — a Go tab blooms,
Keys from the earth, base URLs zoom.
Streams and retries in tidy array,
Two providers hop into play.
Rabbit nods — docs gleam, ready to relay.

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title Check ✅ Passed The title succinctly conveys the main change by indicating that a Go SDK setup example was added to the custom providers documentation, uses a clear conventional-commit prefix, and avoids unnecessary detail or noise.
Description Check ✅ Passed The description closely follows the repository template by providing a summary, detailed change list, type of change, affected areas, testing instructions, breaking-changes declaration, related issues, and a checklist, covering all critical sections for a documentation update while omitting only non-critical optional parts like screenshots.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch 09-26-feat_added_go_sdk_setup_in_custom_providers_doc

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Collaborator Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@TejasGhatte TejasGhatte marked this pull request as ready for review September 26, 2025 10:04
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 46cdc22 and cd6838f.

📒 Files selected for processing (1)
  • docs/features/custom-providers.mdx (1 hunks)

@TejasGhatte TejasGhatte force-pushed the 09-26-feat_added_go_sdk_setup_in_custom_providers_doc branch from cd6838f to 810b456 Compare September 26, 2025 10:50
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cd6838f and 810b456.

📒 Files selected for processing (1)
  • docs/features/custom-providers.mdx (1 hunks)

@TejasGhatte TejasGhatte force-pushed the 09-26-feat_added_go_sdk_setup_in_custom_providers_doc branch from 810b456 to 6749ba6 Compare September 26, 2025 11:03
Copy link
Contributor

@coderabbitai coderabbitai bot left a 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 MyAccount and using model: "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

📥 Commits

Reviewing files that changed from the base of the PR and between 810b456 and 6749ba6.

📒 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 unused bifrost import has been removed. Good cleanup.

Copy link
Collaborator

Pratham-Mishra04 commented Oct 27, 2025

Merge activity

  • Oct 27, 6:19 AM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Oct 27, 6:20 AM UTC: @Pratham-Mishra04 merged this pull request with Graphite.

@Pratham-Mishra04 Pratham-Mishra04 merged commit 6a69522 into main Oct 27, 2025
4 checks passed
@Pratham-Mishra04 Pratham-Mishra04 deleted the 09-26-feat_added_go_sdk_setup_in_custom_providers_doc branch October 27, 2025 06:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants