Skip to content

Commit fb6f9d4

Browse files
authored
refactor(integrations): rename gemini package to provider-neutral ai (closes #68) (#95)
* feat(integrations): add provider-neutral ai package 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> * refactor: migrate all callers from integrations/gemini to integrations/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> * chore(integrations): remove deprecated gemini package 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> * fix(integrations): address review comments — stale names and docs - 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> * fix(integrations): delete gemini_test.go after rename to prompts_test.go 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> --------- Signed-off-by: Kavirubc <hapuarachchikaviru@gmail.com>
1 parent 0cfc0d2 commit fb6f9d4

25 files changed

Lines changed: 79 additions & 83 deletions

cmd/simili-web/main.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import (
1717

1818
"github.com/similigh/simili-bot/internal/core/config"
1919
"github.com/similigh/simili-bot/internal/core/pipeline"
20-
"github.com/similigh/simili-bot/internal/integrations/gemini"
20+
"github.com/similigh/simili-bot/internal/integrations/ai"
2121
"github.com/similigh/simili-bot/internal/integrations/github"
2222
"github.com/similigh/simili-bot/internal/integrations/qdrant"
2323
"github.com/similigh/simili-bot/internal/steps"
@@ -115,7 +115,7 @@ func initDependencies(cfg *config.Config) (*pipeline.Dependencies, error) {
115115
}
116116

117117
// Embedder (Gemini/OpenAI auto-selected by available keys)
118-
embedder, err := gemini.NewEmbedder(cfg.Embedding.APIKey, cfg.Embedding.Model)
118+
embedder, err := ai.NewEmbedder(cfg.Embedding.APIKey, cfg.Embedding.Model)
119119
if err != nil {
120120
return nil, fmt.Errorf("failed to init embedder: %w", err)
121121
}
@@ -151,7 +151,7 @@ func initDependencies(cfg *config.Config) (*pipeline.Dependencies, error) {
151151
if envModel := os.Getenv("LLM_MODEL"); envModel != "" {
152152
llmModel = envModel
153153
}
154-
llm, err := gemini.NewLLMClient(llmKey, llmModel)
154+
llm, err := ai.NewLLMClient(llmKey, llmModel)
155155
if err != nil {
156156
return nil, fmt.Errorf("failed to init LLM: %w", err)
157157
}

cmd/simili/commands/batch.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import (
2121

2222
"github.com/similigh/simili-bot/internal/core/config"
2323
"github.com/similigh/simili-bot/internal/core/pipeline"
24-
"github.com/similigh/simili-bot/internal/integrations/gemini"
24+
"github.com/similigh/simili-bot/internal/integrations/ai"
2525
"github.com/similigh/simili-bot/internal/integrations/github"
2626
"github.com/similigh/simili-bot/internal/integrations/qdrant"
2727
)
@@ -281,7 +281,7 @@ func initializeDependencies(cfg *config.Config) (*pipeline.Dependencies, error)
281281
deps := &pipeline.Dependencies{}
282282

283283
// Initialize Embedder (Gemini/OpenAI auto-selected by available keys)
284-
embedder, err := gemini.NewEmbedder(cfg.Embedding.APIKey, cfg.Embedding.Model)
284+
embedder, err := ai.NewEmbedder(cfg.Embedding.APIKey, cfg.Embedding.Model)
285285
if err != nil {
286286
return nil, fmt.Errorf("failed to initialize embedder: %w", err)
287287
}
@@ -338,7 +338,7 @@ func initializeDependencies(cfg *config.Config) (*pipeline.Dependencies, error)
338338
if envModel := os.Getenv("LLM_MODEL"); envModel != "" {
339339
llmModel = envModel
340340
}
341-
llm, err := gemini.NewLLMClient(llmKey, llmModel)
341+
llm, err := ai.NewLLMClient(llmKey, llmModel)
342342
if err != nil {
343343
return nil, fmt.Errorf("failed to initialize LLM client: %w", err)
344344
}

cmd/simili/commands/index.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import (
1717
"github.com/google/go-github/v60/github"
1818
"github.com/google/uuid"
1919
similiConfig "github.com/similigh/simili-bot/internal/core/config"
20-
"github.com/similigh/simili-bot/internal/integrations/gemini"
20+
"github.com/similigh/simili-bot/internal/integrations/ai"
2121
similiGithub "github.com/similigh/simili-bot/internal/integrations/github"
2222
"github.com/similigh/simili-bot/internal/integrations/qdrant"
2323
"github.com/similigh/simili-bot/internal/utils/text"
@@ -89,13 +89,13 @@ func runIndex(cmd *cobra.Command, args []string) {
8989

9090
ghClient := similiGithub.NewClient(ctx, token)
9191

92-
geminiClient, err := gemini.NewEmbedder(cfg.Embedding.APIKey, cfg.Embedding.Model)
92+
embedder, err := ai.NewEmbedder(cfg.Embedding.APIKey, cfg.Embedding.Model)
9393
if err != nil {
9494
log.Fatalf("Failed to init embedder: %v", err)
9595
}
96-
defer geminiClient.Close()
96+
defer embedder.Close()
9797
embeddingDimensions := cfg.Embedding.Dimensions
98-
if dim := geminiClient.Dimensions(); dim > 0 {
98+
if dim := embedder.Dimensions(); dim > 0 {
9999
embeddingDimensions = dim
100100
}
101101

@@ -144,7 +144,7 @@ func runIndex(cmd *cobra.Command, args []string) {
144144
go func(id int) {
145145
defer wg.Done()
146146
for job := range jobs {
147-
processIssue(ctx, id, job.Issue, ghClient, geminiClient, qdrantClient, splitter, cfg.Qdrant.Collection, org, repoName, indexDryRun)
147+
processIssue(ctx, id, job.Issue, ghClient, embedder, qdrantClient, splitter, cfg.Qdrant.Collection, org, repoName, indexDryRun)
148148
}
149149
}(i)
150150
}
@@ -198,7 +198,7 @@ func runIndex(cmd *cobra.Command, args []string) {
198198
log.Println("Indexing complete.")
199199
}
200200

201-
func processIssue(ctx context.Context, workerID int, issue *github.Issue, gh *similiGithub.Client, em *gemini.Embedder, qd *qdrant.Client, splitter *text.RecursiveCharacterSplitter, collection, org, repo string, dryRun bool) {
201+
func processIssue(ctx context.Context, workerID int, issue *github.Issue, gh *similiGithub.Client, em *ai.Embedder, qd *qdrant.Client, splitter *text.RecursiveCharacterSplitter, collection, org, repo string, dryRun bool) {
202202
// 1. Fetch Comments (with pagination)
203203
var allComments []*github.IssueComment
204204
page := 1

cmd/simili/commands/learn.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import (
1616
"time"
1717

1818
similiConfig "github.com/similigh/simili-bot/internal/core/config"
19-
"github.com/similigh/simili-bot/internal/integrations/gemini"
19+
"github.com/similigh/simili-bot/internal/integrations/ai"
2020
similiGithub "github.com/similigh/simili-bot/internal/integrations/github"
2121
"github.com/similigh/simili-bot/internal/integrations/qdrant"
2222
"github.com/spf13/cobra"
@@ -89,7 +89,7 @@ func runLearn(cmd *cobra.Command, args []string) {
8989
ghClient := similiGithub.NewClient(ctx, token)
9090

9191
// 3. Initialize Embedder
92-
embedder, err := gemini.NewEmbedder(cfg.Embedding.APIKey, cfg.Embedding.Model)
92+
embedder, err := ai.NewEmbedder(cfg.Embedding.APIKey, cfg.Embedding.Model)
9393
if err != nil {
9494
log.Fatalf("Failed to initialize embedder: %v", err)
9595
}

cmd/simili/commands/process.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import (
1818

1919
"github.com/similigh/simili-bot/internal/core/config"
2020
"github.com/similigh/simili-bot/internal/core/pipeline"
21-
"github.com/similigh/simili-bot/internal/integrations/gemini"
21+
"github.com/similigh/simili-bot/internal/integrations/ai"
2222
"github.com/similigh/simili-bot/internal/integrations/github"
2323
"github.com/similigh/simili-bot/internal/integrations/qdrant"
2424
)
@@ -204,7 +204,7 @@ func runProcess() {
204204

205205
// Initialize clients with error logging
206206
// Embedder
207-
embedder, err := gemini.NewEmbedder(cfg.Embedding.APIKey, cfg.Embedding.Model)
207+
embedder, err := ai.NewEmbedder(cfg.Embedding.APIKey, cfg.Embedding.Model)
208208
if err == nil {
209209
deps.Embedder = embedder
210210
if verbose {
@@ -262,7 +262,7 @@ func runProcess() {
262262
if envModel := os.Getenv("LLM_MODEL"); envModel != "" {
263263
llmModel = envModel
264264
}
265-
llm, err := gemini.NewLLMClient(llmKey, llmModel)
265+
llm, err := ai.NewLLMClient(llmKey, llmModel)
266266
if err == nil {
267267
deps.LLMClient = llm
268268
if verbose {

internal/core/pipeline/registry.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
"fmt"
1111
"sync"
1212

13-
"github.com/similigh/simili-bot/internal/integrations/gemini"
13+
"github.com/similigh/simili-bot/internal/integrations/ai"
1414
"github.com/similigh/simili-bot/internal/integrations/github"
1515
"github.com/similigh/simili-bot/internal/integrations/qdrant"
1616
)
@@ -28,8 +28,8 @@ type StepFactory func(deps *Dependencies) (Step, error)
2828

2929
// Dependencies holds the dependencies that can be injected into steps.
3030
type Dependencies struct {
31-
Embedder *gemini.Embedder
32-
LLMClient *gemini.LLMClient
31+
Embedder *ai.Embedder
32+
LLMClient *ai.LLMClient
3333
VectorStore qdrant.VectorStore
3434
GitHub *github.Client
3535
DryRun bool
Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,8 @@
33
// Created: 2026-02-02
44
// Last Modified: 2026-02-17
55

6-
// Package gemini provides AI integration for embeddings and LLM.
7-
//
8-
// TODO(2026-02-16): This package is named "gemini" for historical reasons, but it
9-
// now supports multiple providers (Gemini and OpenAI). Recommend renaming
10-
// directory/package to provider-neutral naming (for example `internal/integrations/ai`).
11-
package gemini
6+
// Package ai provides AI integration for embeddings and LLM.
7+
package ai
128

139
import (
1410
"context"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// Created: 2026-02-02
44
// Last Modified: 2026-02-17
55

6-
package gemini
6+
package ai
77

88
import (
99
"context"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// Created: 2026-02-02
44
// Last Modified: 2026-02-05
55

6-
package gemini
6+
package ai
77

88
import (
99
"fmt"

internal/integrations/gemini/gemini_test.go renamed to internal/integrations/ai/prompts_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// Created: 2026-02-02
44
// Last Modified: 2026-02-02
55

6-
package gemini
6+
package ai
77

88
import (
99
"strings"

0 commit comments

Comments
 (0)