Finished code cleanup, readme is mostly done.
This commit is contained in:
@@ -9,6 +9,7 @@ import (
|
||||
"strconv"
|
||||
)
|
||||
|
||||
// RelevantDocs attempts to find the most relevant file chunks based on context from the prompt.
|
||||
type RelevantDocs struct {
|
||||
CallbacksHandler callbacks.Handler
|
||||
db *database.Database
|
||||
@@ -17,6 +18,7 @@ type RelevantDocs struct {
|
||||
size int
|
||||
}
|
||||
|
||||
// FileChunkID is a pointer to a repository file chunk that has been indexed.
|
||||
type FileChunkID struct {
|
||||
Name string
|
||||
ChunkID int
|
||||
@@ -26,6 +28,7 @@ type FileChunkID struct {
|
||||
Doc *schema.Document
|
||||
}
|
||||
|
||||
// NewGetRelevantDocs creates a new RelevantDocs scanner.
|
||||
func NewGetRelevantDocs(db *database.Database, llm *LLM, repoID string, size int) *RelevantDocs {
|
||||
return &RelevantDocs{
|
||||
db: db,
|
||||
@@ -35,6 +38,7 @@ func NewGetRelevantDocs(db *database.Database, llm *LLM, repoID string, size int
|
||||
}
|
||||
}
|
||||
|
||||
// GetRelevantFileChunks will scan for relevant documents based on a prompt.
|
||||
func (rd *RelevantDocs) GetRelevantFileChunks(ctx context.Context, query string) ([]*FileChunkID, error) {
|
||||
vectorStore, closeFunc, err := rd.db.GetVectorStore(ctx, rd.llm.Embedder())
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user