Skip to content

refactor(integrations): rename gemini package to provider-neutral ai (closes #68)#95

Merged
Kavirubc merged 6 commits intomainfrom
feature/internal-integration-neutral
Mar 3, 2026
Merged

refactor(integrations): rename gemini package to provider-neutral ai (closes #68)#95
Kavirubc merged 6 commits intomainfrom
feature/internal-integration-neutral

Conversation

@Kavirubc
Copy link
Member

@Kavirubc Kavirubc commented Mar 3, 2026

Description

Renames internal/integrations/geminiinternal/integrations/ai to reflect that the package now supports multiple AI providers (Gemini and OpenAI), not just Gemini. This is a pure structural rename with no behaviour changes.

Type of Change

  • ♻️ Refactoring (no functional changes)

Related Issues

Fixes #68

Changes Made

  • Added internal/integrations/ai/ with package ai declarations (renamed from package gemini)
  • Removed the TODO comment in embedder.go that flagged the misleading package name; updated the package-level doc comment
  • Updated import paths from integrations/geminiintegrations/ai in all 16 caller files across internal/steps/, internal/transfer/, internal/core/pipeline/, and cmd/
  • Updated all gemini.X package qualifiers to ai.X at every call site
  • Deleted the now-obsolete internal/integrations/gemini/ directory

Testing

  • I have run go build ./... successfully
  • I have run go test ./... successfully
  • I have run go vet ./... successfully
  • I have tested the changes locally

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • New and existing unit tests pass locally with my changes

Additional Notes

Three modular commits:

  1. feat(integrations): add provider-neutral ai package — new directory with updated package declarations
  2. refactor: migrate all callers from integrations/gemini to integrations/ai — import path + qualifier updates
  3. chore(integrations): remove deprecated gemini package — deletion of old directory

Summary by CodeRabbit

Release Notes

  • Refactor

    • Generalized the AI integration layer throughout the application. All Gemini-specific dependencies have been replaced with a unified AI integration interface that handles embeddings, language models, and related processing tasks.
  • Tests

    • Updated test files and mock dependencies to align with the new AI integration layer.

@coderabbitai
Copy link

coderabbitai bot commented Mar 3, 2026

Warning

Rate limit exceeded

@Kavirubc has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 1 minutes and 50 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between db21ccc and 45a24da.

📒 Files selected for processing (4)
  • cmd/simili/commands/index.go
  • internal/integrations/ai/prompts_test.go
  • internal/integrations/ai/retry.go
  • internal/transfer/vdb_router.go
📝 Walkthrough

Walkthrough

This PR systematically renames the internal/integrations/gemini package to internal/integrations/ai to make the integration provider-neutral. All import paths, package declarations, and type references throughout the codebase are updated consistently. No behavioral changes or logic modifications are introduced.

Changes

Cohort / File(s) Summary
Package Rename in Integration Layer
internal/integrations/ai/embedder.go, internal/integrations/ai/llm.go, internal/integrations/ai/prompts.go, internal/integrations/ai/provider.go, internal/integrations/ai/retry.go, internal/integrations/ai/*_test.go
Package declaration updated from gemini to ai; documentation comment in embedder.go updated to reflect provider-neutral naming.
Main Command Entry Points
cmd/simili-web/main.go, cmd/simili/commands/batch.go, cmd/simili/commands/process.go
Import paths and constructor calls updated from gemini.NewEmbedder() / gemini.NewLLMClient() to ai.NewEmbedder() / ai.NewLLMClient().
Command Implementation Files
cmd/simili/commands/index.go, cmd/simili/commands/learn.go
Import paths updated; function parameter types updated from *gemini.Embedder to *ai.Embedder.
Pipeline Registry
internal/core/pipeline/registry.go
Dependency types updated: Embedder and LLMClient fields changed from gemini to ai types.
Step Implementations
internal/steps/duplicate_detector.go, internal/steps/indexer.go, internal/steps/similarity.go, internal/steps/vectordb_prep.go
Embedder and/or LLMClient field types updated from gemini to ai; input types updated accordingly.
Router and Processing Steps
internal/steps/llm_router.go, internal/steps/quality_checker.go, internal/steps/triage.go
LLMClient and input types updated; struct fields changed from gemini to ai types; input construction updated to ai data structures.
Complex Step Implementations
internal/steps/response_builder.go, internal/steps/transfer_check.go
Multiple type references updated: LLMClient, type assertions (QualityResult, RouterResult, DuplicateResult), and function return types switched from gemini to ai.
Response Builder Tests
internal/steps/response_builder_test.go
Test mocks and type assertions updated from gemini to ai types; nested type references updated.
Transfer Layer
internal/transfer/vdb_router.go
Import and public constructor signature updated; parameter type changed from *gemini.Embedder to *ai.Embedder.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~18 minutes

Possibly related PRs

Suggested labels

refactor


🐰 A hop, skip, and a rename we take,
From gemini's name to ai awake,
No logic changed, just imports flow,
Provider-neutral now, watch it grow! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 36.36% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: renaming the gemini package to a provider-neutral ai package, which is reflected across all file changes.
Linked Issues check ✅ Passed All requirements from issue #68 are met: package renamed to ai, import paths updated across all callers, package-level docs updated, and TODO removed from embedder.go.
Out of Scope Changes check ✅ Passed All changes are within scope: pure package/import rename with documentation updates, no behavioral modifications or unrelated code changes.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/internal-integration-neutral

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.

Kavirubc added 3 commits March 3, 2026 13:13
Introduces internal/integrations/ai as a renamed copy of the former
gemini package. Package declaration updated to `package ai` across all
source and test files. Removes the TODO comment in embedder.go that
flagged the misleading package name and updates the package-level doc
comment accordingly.

No behaviour changes — all logic, types, and tests are identical.

Relates to #68

Signed-off-by: Kavirubc <hapuarachchikaviru@gmail.com>
…s/ai

Updates every import path and package qualifier across all 16 caller
files:

  internal/steps/   — 10 files (transfer_check, response_builder,
                       duplicate_detector, similarity, vectordb_prep,
                       indexer, llm_router, quality_checker, triage,
                       response_builder_test)
  internal/transfer/ — vdb_router.go
  internal/core/pipeline/ — registry.go
  cmd/simili/commands/ — batch, index, learn, process
  cmd/simili-web/     — main.go

`gemini.X` → `ai.X` at every call site. No logic changes.

Relates to #68

Signed-off-by: Kavirubc <hapuarachchikaviru@gmail.com>
Deletes internal/integrations/gemini now that all callers have been
migrated to internal/integrations/ai. Keeps the codebase free of
dead code and eliminates the misleading provider-specific package name.

Closes #68

Signed-off-by: Kavirubc <hapuarachchikaviru@gmail.com>
@Kavirubc Kavirubc force-pushed the feature/internal-integration-neutral branch from 310656f to db21ccc Compare March 3, 2026 07:43
@Kavirubc Kavirubc requested a review from Copilot March 3, 2026 07:43
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR is a pure structural rename that resolves issue #68: the internal AI integration package is moved from internal/integrations/gemini (package gemini) to internal/integrations/ai (package ai), reflecting that it already supports multiple providers (Gemini and OpenAI), not just Gemini.

Changes:

  • Renamed internal/integrations/gemini/internal/integrations/ai/ with updated package ai declarations and an updated package-level doc comment in embedder.go
  • Updated all import paths from integrations/geminiintegrations/ai and all gemini.X call-site qualifiers to ai.X across 16 caller files
  • Deleted the now-obsolete internal/integrations/gemini/ directory

Reviewed changes

Copilot reviewed 25 out of 25 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
internal/integrations/ai/embedder.go Updated package declaration from geminiai and replaced package-level doc comment with provider-neutral wording
internal/integrations/ai/llm.go Updated package declaration
internal/integrations/ai/prompts.go Updated package declaration
internal/integrations/ai/provider.go Updated package declaration
internal/integrations/ai/retry.go Updated package declaration (doc comment left stale — see comment)
internal/integrations/ai/gemini_test.go Updated package declaration (filename not renamed — see comment)
internal/integrations/ai/provider_test.go Updated package declaration
internal/integrations/ai/retry_test.go Updated package declaration
internal/transfer/vdb_router.go Updated import path and ai.Embedder type; function and doc comment names still reference "Gemini"
internal/steps/vectordb_prep.go Import path and type updated
internal/steps/triage.go Import path and type/struct references updated
internal/steps/transfer_check.go Import path and all type references updated
internal/steps/similarity.go Import path and type updated
internal/steps/response_builder.go Import path and type assertion references updated
internal/steps/response_builder_test.go Import path and struct literal references updated
internal/steps/quality_checker.go Import path and type references updated
internal/steps/llm_router.go Import path and all type references updated
internal/steps/indexer.go Import path and type updated
internal/steps/duplicate_detector.go Import path and all type references updated
internal/core/pipeline/registry.go Import path and Dependencies struct fields updated
cmd/simili/commands/process.go Import path and constructor calls updated
cmd/simili/commands/learn.go Import path and constructor call updated
cmd/simili/commands/index.go Import path and function signature updated; local variable still named geminiClient
cmd/simili/commands/batch.go Import path and constructor calls updated
cmd/simili-web/main.go Import path and constructor calls updated
Comments suppressed due to low confidence (2)

internal/integrations/ai/gemini_test.go:6

  • The test file is still named gemini_test.go even though it now belongs to package ai. The filename was not updated as part of this rename. It should be renamed to a provider-neutral name (e.g., prompts_test.go or llm_test.go) to be consistent with the purpose of this PR and the surrounding package name.
    internal/integrations/ai/retry.go:6
  • The package-level doc comment on line 6 still reads // Package gemini provides Gemini AI integration for embeddings and LLM. — it was not updated as part of this rename. It should be updated to // Package ai provides AI integration for embeddings and LLM. to match the updated doc comment in embedder.go.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

ghClient := similiGithub.NewClient(ctx, token)

geminiClient, err := gemini.NewEmbedder(cfg.Embedding.APIKey, cfg.Embedding.Model)
geminiClient, err := ai.NewEmbedder(cfg.Embedding.APIKey, cfg.Embedding.Model)
Copy link

Copilot AI Mar 3, 2026

Choose a reason for hiding this comment

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

The local variable geminiClient (lines 92–147) was not renamed as part of this PR, even though the underlying type is now *ai.Embedder and the PR description states all gemini.X qualifiers were updated. This leaves a stale, provider-specific name for an instance of the now provider-neutral ai.Embedder. It should be renamed to something like embedder or aiEmbedder for consistency.

Copilot uses AI. Check for mistakes.
Comment on lines +140 to +141
// VDBRouterWithGeminiEmbedder is a convenience constructor accepting *ai.Embedder directly.
func NewVDBRouterFromGemini(embedder *ai.Embedder, store qdrant.VectorStore, collection string, maxResults int) *VDBRouter {
Copy link

Copilot AI Mar 3, 2026

Choose a reason for hiding this comment

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

The function name NewVDBRouterFromGemini and its doc comment VDBRouterWithGeminiEmbedder both still contain "Gemini" references despite this being a rename PR aimed at removing provider-specific naming. Since this function accepts an *ai.Embedder (which is now provider-neutral), the function name and comment are inconsistent with the rest of the refactoring. The function should be renamed to something like NewVDBRouterFromEmbedder (or simply removed as a thin wrapper over NewVDBRouter), and the doc comment should be updated accordingly.

Suggested change
// VDBRouterWithGeminiEmbedder is a convenience constructor accepting *ai.Embedder directly.
func NewVDBRouterFromGemini(embedder *ai.Embedder, store qdrant.VectorStore, collection string, maxResults int) *VDBRouter {
// VDBRouterWithEmbedder is a convenience constructor accepting *ai.Embedder directly.
func NewVDBRouterFromEmbedder(embedder *ai.Embedder, store qdrant.VectorStore, collection string, maxResults int) *VDBRouter {

Copilot uses AI. Check for mistakes.
@Kavirubc Kavirubc added the e2e label Mar 3, 2026
Copy link

@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: 2

🧹 Nitpick comments (1)
cmd/simili/commands/index.go (1)

92-96: Variable name geminiClient is misleading after package rename.

The variable is named geminiClient, but it's now an *ai.Embedder that could be backed by either Gemini or OpenAI. Consider renaming to embedder or aiClient for consistency with the provider-neutral package name.

♻️ Suggested rename for clarity
-	geminiClient, err := ai.NewEmbedder(cfg.Embedding.APIKey, cfg.Embedding.Model)
+	embedder, err := ai.NewEmbedder(cfg.Embedding.APIKey, cfg.Embedding.Model)
 	if err != nil {
 		log.Fatalf("Failed to init embedder: %v", err)
 	}
-	defer geminiClient.Close()
+	defer embedder.Close()
 	embeddingDimensions := cfg.Embedding.Dimensions
-	if dim := geminiClient.Dimensions(); dim > 0 {
+	if dim := embedder.Dimensions(); dim > 0 {
 		embeddingDimensions = dim
 	}

Also update the reference at line 147:

-				processIssue(ctx, id, job.Issue, ghClient, geminiClient, qdrantClient, splitter, cfg.Qdrant.Collection, org, repoName, indexDryRun)
+				processIssue(ctx, id, job.Issue, ghClient, embedder, qdrantClient, splitter, cfg.Qdrant.Collection, org, repoName, indexDryRun)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@cmd/simili/commands/index.go` around lines 92 - 96, The variable name
geminiClient is misleading because ai.NewEmbedder returns an *ai.Embedder that
may wrap different providers; rename geminiClient to embedder (or aiClient)
wherever used (the local declaration from ai.NewEmbedder, the subsequent defer
geminiClient.Close(), and any other references such as the usage noted around
line 147) and update the defer call to embedder.Close() and all usages to match
the new name so the identifier reflects the provider-neutral ai.Embedder type.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@internal/integrations/ai/retry.go`:
- Around line 6-7: The package-level doc comment is stale ("Package gemini")
while the file declares package ai; update the top-of-file package comment to
read "Package ai ..." to match the declared package and godoc conventions so
tools and readers aren't misled; locate the comment immediately above the
package ai declaration and edit its text accordingly.

In `@internal/transfer/vdb_router.go`:
- Around line 140-142: The docstring and constructor name drift: the comment
refers to a non-existent symbol VDBRouterWithGeminiEmbedder and the exported
constructor NewVDBRouterFromGemini uses provider-specific wording in a
provider-neutral package; rename or add a neutral constructor (e.g.,
NewVDBRouterFromEmbedder) that calls NewVDBRouter(embedder, store, collection,
maxResults) and update the doc comment to reference that neutral name, then add
a thin deprecated alias function named VDBRouterWithGeminiEmbedder (or keep
NewVDBRouterFromGemini) that simply calls the new neutral constructor so
existing callers continue to work while new code uses the neutral API.

---

Nitpick comments:
In `@cmd/simili/commands/index.go`:
- Around line 92-96: The variable name geminiClient is misleading because
ai.NewEmbedder returns an *ai.Embedder that may wrap different providers; rename
geminiClient to embedder (or aiClient) wherever used (the local declaration from
ai.NewEmbedder, the subsequent defer geminiClient.Close(), and any other
references such as the usage noted around line 147) and update the defer call to
embedder.Close() and all usages to match the new name so the identifier reflects
the provider-neutral ai.Embedder type.

ℹ️ Review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 62b867d and db21ccc.

📒 Files selected for processing (25)
  • cmd/simili-web/main.go
  • cmd/simili/commands/batch.go
  • cmd/simili/commands/index.go
  • cmd/simili/commands/learn.go
  • cmd/simili/commands/process.go
  • internal/core/pipeline/registry.go
  • internal/integrations/ai/embedder.go
  • internal/integrations/ai/gemini_test.go
  • internal/integrations/ai/llm.go
  • internal/integrations/ai/prompts.go
  • internal/integrations/ai/provider.go
  • internal/integrations/ai/provider_test.go
  • internal/integrations/ai/retry.go
  • internal/integrations/ai/retry_test.go
  • internal/steps/duplicate_detector.go
  • internal/steps/indexer.go
  • internal/steps/llm_router.go
  • internal/steps/quality_checker.go
  • internal/steps/response_builder.go
  • internal/steps/response_builder_test.go
  • internal/steps/similarity.go
  • internal/steps/transfer_check.go
  • internal/steps/triage.go
  • internal/steps/vectordb_prep.go
  • internal/transfer/vdb_router.go

@gh-simili-bot
Copy link
Contributor

🧪 E2E Test

Bot responded: yes

| Auto-closer (dry-run) | processed: 0 closed: 0 grace: 0 human: 0 |

Test repo → gh-simili-bot/simili-e2e-22613358902
Run → logs

Auto-generated by E2E pipeline

gh-simili-bot
gh-simili-bot previously approved these changes Mar 3, 2026
- retry.go: update package-level doc from "Package gemini" to
  "Package ai" to match the declared package name
- vdb_router.go: rename NewVDBRouterFromGemini →
  NewVDBRouterFromEmbedder and fix its stale doc comment
- index.go: rename local variable geminiClient → embedder to
  match the provider-neutral *ai.Embedder type
- gemini_test.go → prompts_test.go: rename test file to a
  provider-neutral name consistent with the package rename

Relates to #68

Signed-off-by: Kavirubc <hapuarachchikaviru@gmail.com>
The previous commit added prompts_test.go but did not stage the deletion
of gemini_test.go, leaving both files tracked by git and causing
duplicate function declaration errors in CI.

Relates to #68

Signed-off-by: Kavirubc <hapuarachchikaviru@gmail.com>
@Kavirubc Kavirubc added e2e and removed e2e labels Mar 3, 2026
@gh-simili-bot
Copy link
Contributor

🧪 E2E Test

Bot responded: yes

| Auto-closer (dry-run) | processed: 0 closed: 0 grace: 0 human: 0 |

Test repo → gh-simili-bot/simili-e2e-22613922911
Run → logs

Auto-generated by E2E pipeline

@Kavirubc Kavirubc merged commit fb6f9d4 into main Mar 3, 2026
5 checks passed
@Kavirubc Kavirubc deleted the feature/internal-integration-neutral branch March 3, 2026 08:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor: rename internal/integrations/gemini to provider-neutral package

3 participants