Skip to content

Conversation

@Aqua-123
Copy link

@Aqua-123 Aqua-123 commented Jan 9, 2026

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

    • Provider registry routes "provider/model" IDs; supports native providers via env vars and OpenAI-compatible endpoints with custom name/baseURL; mixing providers is supported.
    • Default behavior unchanged: uses Vercel AI Gateway when no providers are configured.
    • README adds Provider Configuration with examples; adds Groq and OpenAI-compatible dependencies.
  • Refactors

    • Agents now receive RuntimeConfig; per-agent model, maxRetries, and providerOptions are injected.
    • Embedding, rerank, vector search, and Qdrant ops now require explicit embeddingModelId and collectionName; DocIndex/CodeIndex constructors updated; server context and doc tools pass these through.
    • Removed legacy static config export; .gitignore now ignores qdrant_storage/.

Written for commit 497ffcf. Summary will update on new commits.

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.
Copy link

@cubic-dev-ai cubic-dev-ai bot left a 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",
Copy link

@cubic-dev-ai cubic-dev-ai bot Jan 9, 2026

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>
Suggested change
"nano": "google/gemini-3-flash",
"nano": "openai/gpt-5.2",
Fix with Cubic

Comment on lines +151 to +171
// 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,
})
Copy link
Contributor

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)

Copy link
Author

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

  1. 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",
    ...
  }
}
  1. 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
    }
  }
}
  1. 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
}
  1. 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

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.

2 participants