llm_ctrl_embeddings

package
v0.3.41 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 10, 2025 License: BSD-3-Clause Imports: 17 Imported by: 0

README

Embeddings and Context Vectors.

This package is an utility module to create vectors and embeddings to use in contexts and RAG.

It requires OLLAMA.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LLMEmbeddings

type LLMEmbeddings struct {
	// contains filtered or unexported fields
}

func NewLLMEmbeddings

func NewLLMEmbeddings(args ...any) (instance *LLMEmbeddings, err error)

func (*LLMEmbeddings) Close added in v0.3.40

func (instance *LLMEmbeddings) Close()

func (*LLMEmbeddings) Context added in v0.3.39

func (instance *LLMEmbeddings) Context(requestContext *llm_commons.LLMRequestContext, contextKnowledge ...string) (response *llm_commons.LLMResponse, err error)

Context processes a request with context knowledge and returns an LLM response or an error.

func (*LLMEmbeddings) Contextualize added in v0.3.40

func (instance *LLMEmbeddings) Contextualize(sessionId, vectorId, userQuery string, userQueryMaxResults int, lang, model string, contextKnowledge ...string) (response *llm_commons.LLMResponse, err error)

Contextualize processes contextual knowledge to generate an LLM response or returns an error if input is invalid.

func (*LLMEmbeddings) Embeddings

func (instance *LLMEmbeddings) Embeddings(request *llm_commons.LLMRequestEmbeddings) (response []float64, err error)

Embeddings https://ollama.com/blog/embedding-models

func (*LLMEmbeddings) Open added in v0.3.40

func (instance *LLMEmbeddings) Open() (err error)

func (*LLMEmbeddings) Submit added in v0.3.39

func (instance *LLMEmbeddings) Submit(request *llm_commons.LLMRequest) (response *llm_commons.LLMResponse, err error)

type LLMEmbeddingsRAG added in v0.3.40

type LLMEmbeddingsRAG struct {
	// contains filtered or unexported fields
}

LLMEmbeddingsRAG represents a structure with access to vectorDB. This object is the gate for the RAG for LLMs

func NewLLMEmbeddingsRAG added in v0.3.40

func NewLLMEmbeddingsRAG(args ...interface{}) (instance *LLMEmbeddingsRAG, err error)

func (*LLMEmbeddingsRAG) AddToCollection added in v0.3.40

func (instance *LLMEmbeddingsRAG) AddToCollection(dbName string, collName string, writeMode string, docs ...interface{}) (err error)

func (*LLMEmbeddingsRAG) Close added in v0.3.40

func (instance *LLMEmbeddingsRAG) Close()

func (*LLMEmbeddingsRAG) CollectionExists added in v0.3.40

func (instance *LLMEmbeddingsRAG) CollectionExists(dbName, collName string) (response bool)

func (*LLMEmbeddingsRAG) CollectionHash added in v0.3.40

func (instance *LLMEmbeddingsRAG) CollectionHash(dbName, collName string) (response string)

func (*LLMEmbeddingsRAG) DB added in v0.3.40

func (instance *LLMEmbeddingsRAG) DB(dbName string) (response vectordb_commons.IVectorDB, err error)

func (*LLMEmbeddingsRAG) DBExists added in v0.3.40

func (instance *LLMEmbeddingsRAG) DBExists(dbName string) (response bool)

func (*LLMEmbeddingsRAG) Load added in v0.3.40

func (instance *LLMEmbeddingsRAG) Load(dbName string, filename string, writeMode string) (err error)

func (*LLMEmbeddingsRAG) Open added in v0.3.40

func (instance *LLMEmbeddingsRAG) Open() (err error)

func (*LLMEmbeddingsRAG) Options added in v0.3.40

func (instance *LLMEmbeddingsRAG) Options(dbName string) (response *llm_commons.LLMRagOptionsItem)

func (*LLMEmbeddingsRAG) Put added in v0.3.40

func (instance *LLMEmbeddingsRAG) Put(dbName, name string, writeMode string, docs ...interface{}) (err error)

func (*LLMEmbeddingsRAG) Query added in v0.3.40

func (instance *LLMEmbeddingsRAG) Query(dbName, collection, query string, wheres []map[string]interface{}, maxResults int) (response []map[string]interface{}, err error)

Query executes a search query on a specified collection within the VectorDB, applying given filters and returning results. "wheres" is an array of filters. More filters and more loops to get different data

func (*LLMEmbeddingsRAG) RemoveCollection added in v0.3.40

func (instance *LLMEmbeddingsRAG) RemoveCollection(dbName, collName string) (err error)

func (*LLMEmbeddingsRAG) RemoveFromCollection added in v0.3.40

func (instance *LLMEmbeddingsRAG) RemoveFromCollection(dbName string, collName string, params ...interface{}) (err error)

func (*LLMEmbeddingsRAG) Sanitize added in v0.3.40

func (instance *LLMEmbeddingsRAG) Sanitize(data []map[string]interface{}) (response []map[string]interface{})

Sanitize processes and filters the input data to remove unwanted fields and sanitize the content field. Only specific fields ("content", "similarity", "metadata", "id") are retained in the response. The "content" field is sanitized by removing specific text patterns ("search_document: ").

func (*LLMEmbeddingsRAG) Upsert added in v0.3.40

func (instance *LLMEmbeddingsRAG) Upsert(dbName string, collName string, docs ...interface{}) (err error)

func (*LLMEmbeddingsRAG) VectorRoot added in v0.3.40

func (instance *LLMEmbeddingsRAG) VectorRoot(dbName string) (response string)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL