Start of Readme, More Cleanup
This commit is contained in:
@@ -6,7 +6,6 @@ import (
|
||||
"github.com/tmc/langchaingo/callbacks"
|
||||
"github.com/tmc/langchaingo/schema"
|
||||
"github.com/tmc/langchaingo/vectorstores"
|
||||
"github.com/tmc/langchaingo/vectorstores/pgvector"
|
||||
"strconv"
|
||||
)
|
||||
|
||||
@@ -37,20 +36,11 @@ func NewGetRelevantDocs(db *database.Database, llm *LLM, repoID string, size int
|
||||
}
|
||||
|
||||
func (rd *RelevantDocs) GetRelevantFileChunks(ctx context.Context, query string) ([]*FileChunkID, error) {
|
||||
conn, err := rd.db.DB(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer conn.Release()
|
||||
|
||||
vectorStore, err := pgvector.New(ctx,
|
||||
pgvector.WithConn(conn),
|
||||
pgvector.WithEmbedder(rd.llm.Embedder()),
|
||||
pgvector.WithCollectionName("file_chunks"),
|
||||
)
|
||||
vectorStore, closeFunc, err := rd.db.GetVectorStore(ctx, rd.llm.Embedder())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer closeFunc()
|
||||
|
||||
retr := vectorstores.ToRetriever(vectorStore, rd.size, vectorstores.WithFilters(map[string]any{"type": "file_chunk", "repo_id": rd.repoID}))
|
||||
retr.CallbacksHandler = rd.CallbacksHandler
|
||||
|
||||
Reference in New Issue
Block a user