Skip to content

Commit

Permalink
Remove ai2 packages
Browse files Browse the repository at this point in the history
  • Loading branch information
tygern committed May 13, 2024
1 parent 938db6e commit fb706c6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions cmd/collector/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package main

import (
"github.com/initialcapacity/ai-starter/internal/collector"
ai2 "github.com/initialcapacity/ai-starter/pkg/ai"
"github.com/initialcapacity/ai-starter/pkg/ai"
"github.com/initialcapacity/ai-starter/pkg/dbsupport"
"github.com/initialcapacity/ai-starter/pkg/feedsupport"
"github.com/initialcapacity/ai-starter/pkg/websupport"
Expand All @@ -23,9 +23,9 @@ func main() {
parser := feedsupport.NewParser(client)
extractor := feedsupport.NewExtractor(client)
dataGateway := collector.NewDataGateway(db)
t := ai2.NewTokenizer(tokenizer.Cl100kBase)
t := ai.NewTokenizer(tokenizer.Cl100kBase)
chunksGateway := collector.NewChunksGateway(db)
chunker := ai2.NewChunker(t, 6000)
chunker := ai.NewChunker(t, 6000)
chunksService := collector.NewChunksService(chunker, chunksGateway)

c := collector.New(parser, extractor, dataGateway, chunksService)
Expand Down
8 changes: 4 additions & 4 deletions functions.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/cloudevents/sdk-go/v2/event"
"github.com/initialcapacity/ai-starter/internal/analyzer"
"github.com/initialcapacity/ai-starter/internal/collector"
ai2 "github.com/initialcapacity/ai-starter/pkg/ai"
"github.com/initialcapacity/ai-starter/pkg/ai"
"github.com/initialcapacity/ai-starter/pkg/dbsupport"
"github.com/initialcapacity/ai-starter/pkg/feedsupport"
"github.com/initialcapacity/ai-starter/pkg/websupport"
Expand All @@ -31,9 +31,9 @@ func triggerCollect(ctx context.Context, e event.Event) error {
parser := feedsupport.NewParser(client)
extractor := feedsupport.NewExtractor(client)
dataGateway := collector.NewDataGateway(db)
t := ai2.NewTokenizer(tokenizer.Cl100kBase)
t := ai.NewTokenizer(tokenizer.Cl100kBase)
chunksGateway := collector.NewChunksGateway(db)
chunker := ai2.NewChunker(t, 6000)
chunker := ai.NewChunker(t, 6000)
chunksService := collector.NewChunksService(chunker, chunksGateway)

c := collector.New(parser, extractor, dataGateway, chunksService)
Expand All @@ -49,7 +49,7 @@ func triggerAnalyze(ctx context.Context, e event.Event) error {
db := dbsupport.CreateConnection(databaseUrl)
chunksGateway := collector.NewChunksGateway(db)
embeddingsGateway := analyzer.NewEmbeddingsGateway(db)
aiClient := ai2.NewClient(openAiKey, openAiEndpoint)
aiClient := ai.NewClient(openAiKey, openAiEndpoint)

a := analyzer.NewAnalyzer(chunksGateway, embeddingsGateway, aiClient)

Expand Down
6 changes: 3 additions & 3 deletions pkg/ai/chunker_test.go
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
package ai_test

import (
ai2 "github.com/initialcapacity/ai-starter/pkg/ai"
"github.com/initialcapacity/ai-starter/pkg/ai"
"github.com/stretchr/testify/assert"
"github.com/tiktoken-go/tokenizer"
"testing"
)

func TestChunker_Split(t *testing.T) {
token := ai2.NewTokenizer(tokenizer.Cl100kBase)
chunker := ai2.NewChunker(token, 30)
token := ai.NewTokenizer(tokenizer.Cl100kBase)
chunker := ai.NewChunker(token, 30)

result := chunker.Split("I think that this string should have 31 tokens, but it's hard to say for sure. We'll have to count them manually, I guess.")

Expand Down

0 comments on commit fb706c6

Please sign in to comment.