-
Notifications
You must be signed in to change notification settings - Fork 1
feat: Add additional LLM provider options to be used #1
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?
Conversation
Add provider registry supporting native AI SDK providers (openai, anthropic, google, groq) and OpenAI-compatible endpoints (LM Studio, Ollama, self-hosted). Defaults to Vercel Gateway when no providers configured.
Replace static config imports with config interfaces passed as parameters. Each agent now receives only the config values it needs, enabling full user config customization through the provider system.
Remove static config dependency from embed, qdrant, and rerank modules. All functions now require explicit parameters instead of falling back to global config defaults.
…ructors Pass embedding model ID through constructors and propagate to all embed and search operations. Makes collection names required parameters.
Update createDocTools and individual tool factories to accept and use explicit collection names instead of relying on global config.
Update run, serve, search, and index commands to pass embedding model ID from runtime config when creating DocIndex and CodeIndex instances.
Remove the deprecated static config object now that all modules use dependency injection via createRuntimeConfig(resolvedConfig).
Document the new multi-provider system including: - Default Vercel AI Gateway setup - Native providers (OpenAI, Anthropic, Google, Groq) with env vars - OpenAI-compatible endpoints (Ollama, LM Studio, custom APIs) - Mixed provider configurations Also update Requirements and Dependencies sections to reference the new provider configuration.
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.
2 issues found across 34 files
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="readme.md">
<violation number="1" location="readme.md:175">
P2: Inconsistent example: the `nano` model references `google/gemini-3-flash` but the `providers` array only includes `openai` and `anthropic`. Users following this example will get errors. Either add `{ "type": "google" }` to providers, or change nano to use an openai/anthropic model.</violation>
<violation number="2" location="readme.md:273">
P2: LM Studio example is missing the `embedding` model configuration. All other provider examples include it, and embedding is required for the indexing functionality. Consider adding an embedding model or noting that users need to configure one from another provider.</violation>
</file>
Since this is your first cubic review, here's how it works:
- cubic automatically reviews your code and comments on bugs and improvements
- Teach cubic by replying to its comments. cubic learns from your replies and gets better over time
- Ask questions if you need clarification on any suggestion
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
| "embedding": "openai/text-embedding-3-small", | ||
| "reranker": "cohere/rerank-v3.5" | ||
| "fast": "openai/gpt-5.2", | ||
| "nano": "google/gemini-3-flash", |
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.
P2: Inconsistent example: the nano model references google/gemini-3-flash but the providers array only includes openai and anthropic. Users following this example will get errors. Either add { "type": "google" } to providers, or change nano to use an openai/anthropic model.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At readme.md, line 175:
<comment>Inconsistent example: the `nano` model references `google/gemini-3-flash` but the `providers` array only includes `openai` and `anthropic`. Users following this example will get errors. Either add `{ "type": "google" }` to providers, or change nano to use an openai/anthropic model.</comment>
<file context>
@@ -165,25 +165,167 @@ Example:
- "embedding": "openai/text-embedding-3-small",
- "reranker": "cohere/rerank-v3.5"
+ "fast": "openai/gpt-5.2",
+ "nano": "google/gemini-3-flash",
+ "embedding": "openai/text-embedding-3-small"
}
</file context>
| "nano": "google/gemini-3-flash", | |
| "nano": "openai/gpt-5.2", |
| // Create sub-agents with injected config | ||
| const researchAgent = createResearchAgent(blackboard, researchTools, { | ||
| maxRetries: runtimeConfig.agents.runtime.research.maxRetries, | ||
| model: runtimeConfig.models.fast, | ||
| providerOptions: runtimeConfig.agents.runtime.research.providerOptions, | ||
| }) | ||
| const plannerAgent = createPlannerAgent(blackboard, plannerTools, { | ||
| maxRetries: runtimeConfig.agents.runtime.planner.maxRetries, | ||
| model: runtimeConfig.models.fast, | ||
| providerOptions: runtimeConfig.agents.runtime.planner.providerOptions, | ||
| }) | ||
| const writerAgent = createWriterAgent(blackboard, writerTools, { | ||
| maxRetries: runtimeConfig.agents.runtime.writer.maxRetries, | ||
| model: runtimeConfig.models.prose, | ||
| providerOptions: runtimeConfig.agents.runtime.writer.providerOptions, | ||
| }) | ||
| const userAgent = createUserAgent(blackboard, userTools, { | ||
| maxRetries: runtimeConfig.agents.runtime.userInteraction.maxRetries, | ||
| model: runtimeConfig.models.fast, | ||
| providerOptions: runtimeConfig.agents.runtime.userInteraction.providerOptions, | ||
| }) |
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.
@Aqua-123 i'm assuming we should now specify provider options via docbot.config.json? same for fallback models? (which used to be both hardcoded in config.ts)
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.
So the flow of user config being loaded is that
- User configures provider + models in docbot.config.jsonc
{
"providers": [
{
"type": "openai-compatible",
"name": "lmstudio", // ← this becomes the provider prefix
"baseURL": "http://localhost:1234/v1"
}
],
"models": {
"planning": "lmstudio/loaded-model", // ← "lmstudio" + "loaded-model"
"prose": "lmstudio/loaded-model",
...
}
}- initializeProviders() registers custom providers (src/config/providers/index.ts:34-46):
registerProviders(configs) {
if (configs.length > 0) {
this.useGateway = false // ← switches OFF gateway mode
}
for (const config of configs) {
if (config.type === "openai-compatible") {
this.registerOpenAICompatible(config) // ← registers "lmstudio" → factory
}
}
}- getModel("lmstudio/loaded-model") resolves the model (index.ts:71-112):
getModel(modelId: string) {
const providerName = "lmstudio" // parsed from "lmstudio/loaded-model"
const modelName = "loaded-model"
// 1. Check custom providers first ← MATCHES HERE
if (this.customProviders.has("lmstudio")) {
return this.customProviders.get("lmstudio")!("loaded-model")
}
// 2. Native overrides (openai, anthropic, etc. with custom keys)
// 3. Gateway mode (default, but disabled when providers are configured)
// 4. Default native providers (uses env vars)
// 5. Error if unknown
}- The custom provider uses @ai-sdk/openai-compatible (openai-compatible.ts):
createOpenAICompatible({
name: "lmstudio",
baseURL: "http://localhost:1234/v1",
apiKey: config.apiKey, // optional
})So what is not taken as proper config input is
- maxRetries per agent
- Provider-specific providerOptions (reasoning effort, thinking levels, etc.)
- Gateway fallback model chains
- Reranker model (Cohere)
- Vector dimensions
Now we can determine which of these we want to add these configurable or not
Summary by cubic
Adds a provider registry so Docbot can use native providers (OpenAI, Anthropic, Google, Groq) and OpenAI-compatible endpoints (Ollama, LM Studio, vLLM) while keeping Vercel AI Gateway as the default when no providers are configured. Refactors config flow to inject RuntimeConfig and remove global static config, and passes embedding model IDs and collection names explicitly end-to-end.
New Features
Refactors
Written for commit 497ffcf. Summary will update on new commits.