retriever

package
v0.0.36 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package retriever provides functionality for retrieving relevant documents using various services.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AmazonKendraLanguageCodeAttributeFilter added in v0.0.22

func AmazonKendraLanguageCodeAttributeFilter(languageCode string) *types.AttributeFilter

Types

type AmazonKendra added in v0.0.22

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

func NewAmazonKendra added in v0.0.22

func NewAmazonKendra(client AmazonKendraClient, index string, optFns ...func(o *AmazonKendraOptions)) *AmazonKendra

func (*AmazonKendra) GetRelevantDocuments added in v0.0.22

func (r *AmazonKendra) GetRelevantDocuments(ctx context.Context, query string) ([]schema.Document, error)

type AmazonKendraClient added in v0.0.22

type AmazonKendraClient interface {
	// Retrieve retrieves documents from Amazon Kendra based on the provided input parameters.
	// It returns the retrieval output or an error if the retrieval operation fails.
	Retrieve(ctx context.Context, params *kendra.RetrieveInput, optFns ...func(*kendra.Options)) (*kendra.RetrieveOutput, error)

	// Query performs a query operation on Amazon Kendra using the specified input parameters.
	// It returns the query output or an error if the query operation fails.
	Query(ctx context.Context, params *kendra.QueryInput, optFns ...func(*kendra.Options)) (*kendra.QueryOutput, error)
}

AmazonKendraClient represents a client for interacting with Amazon Kendra.

type AmazonKendraOptions added in v0.0.22

type AmazonKendraOptions struct {
	// Number of documents to query for
	TopK int32

	// Provides filtering the results based on document attributes or metadata
	// fields.
	AttributeFilter *types.AttributeFilter
}

type AzureCognitiveSearch added in v0.0.32

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

AzureCognitiveSearch is a retriever implementation for Azure Cognitive Search service.

func NewAzureCognitiveSearch added in v0.0.32

func NewAzureCognitiveSearch(apiKey, serviceName, indexName string, optFns ...func(o *AzureCognitiveSearchOptions)) *AzureCognitiveSearch

NewAzureCognitiveSearch creates a new instance of AzureCognitiveSearch retriever with the provided options.

func (*AzureCognitiveSearch) GetRelevantDocuments added in v0.0.32

func (r *AzureCognitiveSearch) GetRelevantDocuments(ctx context.Context, query string) ([]schema.Document, error)

GetRelevantDocuments retrieves relevant documents for the given query using Azure Cognitive Search.

type AzureCognitiveSearchOptions added in v0.0.32

type AzureCognitiveSearchOptions struct {
	// Number of documents to query for
	TopK uint

	// Azure Cognitive Search API version.
	APIVersion string

	// Key to extract content from response.
	ContentKey string

	// HTTP client to use for making requests.
	HTTPClient HTTPClient
}

AzureCognitiveSearchOptions contains options for configuring the AzureCognitiveSearch retriever.

type AzureCognitiveSearchRequest added in v0.0.32

type AzureCognitiveSearchRequest struct {
	Search string `json:"search"`
	Top    uint   `json:"top"`
}

AzureCognitiveSearchRequest represents the request payload for Azure Cognitive Search.

type HTTPClient added in v0.0.32

type HTTPClient interface {
	Do(req *http.Request) (*http.Response, error)
}

type Merger added in v0.0.28

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

func NewMerger added in v0.0.28

func NewMerger(retrievers ...schema.Retriever) *Merger

func (*Merger) GetRelevantDocuments added in v0.0.28

func (r *Merger) GetRelevantDocuments(ctx context.Context, query string) ([]schema.Document, error)

type VectorStore added in v0.0.10

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

func NewVectorStore added in v0.0.10

func NewVectorStore(vectorStore schema.VectorStore, optFns ...func(o *VectorStoreOptions)) *VectorStore

func (*VectorStore) GetRelevantDocuments added in v0.0.10

func (r *VectorStore) GetRelevantDocuments(ctx context.Context, query string) ([]schema.Document, error)

GetRelevantDocuments returns documents using the vector store.

type VectorStoreOptions added in v0.0.10

type VectorStoreOptions struct {
	SearchType VectorStoreSearchType
}

type VectorStoreSearchType added in v0.0.10

type VectorStoreSearchType string
const (
	VectorStoreSearchTypeSimilarity VectorStoreSearchType = "similarity"
)

Jump to

Keyboard shortcuts

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