8000 GitHub - suapapa/go_ragkit: Go pkg. for vector store
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

suapapa/go_ragkit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ragkit: A Go package for document indexing and retrieval in RAG systems

ragkit_logo

ragkit is a Go package designed to simplify the implementation of Retrieval-Augmented Generation (RAG) systems. It includes the definition and implementation of a VectorStore interface that performs document indexing and retrieval, providing tools for vectorization and semantic search capabilities.

Installation

go get github.com/suapapa/go_ragkit

Quick Start

import (
    // ...
    ragkit "github.com/suapapa/go_ragkit"
    vstore_helper "github.com/suapapa/go_ragkit/vector_store/weaviate/helper"
)

func main() {
    // Initialize vector store (Weaviate + Ollama)
    vstore, err := vstore_helper.NewWeaviateOllamaVectorStore(
        "DoolyFamily", // vector DB class name
        vstore_helper.DefaultOllamaEmbedModel, 
    )
    if err != nil {
        panic(err)
    }

    // Create documents from text
    docs := ragkit.MakeDocsFromTexts(
        []string{
            "고길동의 집에는 둘리, 도우너, 또치, 희동이, 철수, 영희가 살고 있다.",
            "희동이는 고길동의 조카이다.",
            // ...
        },
        nil,
    )

    // Index documents
    _, err = vstore.Index(context.Background(), docs...)
    if err != nil {
        panic(err)
    }

    // Perform semantic search
    query := "고길동과 희동이의 관계?"
    results, err := vstore.RetrieveText(context.Background(), query, 1)
    if err != nil {
        panic(err)
    }

    // Print result
    fmt.Println(results[0].Text) // <- 희동이는 고길동의 조카이다.
}

Examples

Pre-requirement - launch Weaviate for local vector DB:

docker run -it --rm \
  -p 8080:8080 -p 50051:50051 \
  cr.weaviate.io/semitechnologies/weaviate:1.30.2

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

Go pkg. for vector store

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

0