retriever

package
v0.0.61 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2023 License: MIT Imports: 15 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

func Run added in v0.0.52

func Run(ctx context.Context, retriever schema.Retriever, query string, optFns ...func(*Options)) ([]schema.Document, error)

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) Callbacks added in v0.0.52

func (r *AmazonKendra) Callbacks() []schema.Callback

Callbacks returns the registered callbacks of the retriever.

func (*AmazonKendra) GetRelevantDocuments added in v0.0.22

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

func (*AmazonKendra) Verbose added in v0.0.52

func (r *AmazonKendra) Verbose() bool

Verbose returns the verbosity setting of the retriever.

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 {
	*schema.CallbackOptions
	// 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) Callbacks added in v0.0.52

func (r *AzureCognitiveSearch) Callbacks() []schema.Callback

Callbacks returns the registered callbacks of the retriever.

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.

func (*AzureCognitiveSearch) Verbose added in v0.0.52

func (r *AzureCognitiveSearch) Verbose() bool

Verbose returns the verbosity setting of the retriever.

type AzureCognitiveSearchOptions added in v0.0.32

type AzureCognitiveSearchOptions struct {
	*schema.CallbackOptions
	// 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, optFns ...func(o *MergerOptions)) *Merger

func (*Merger) Callbacks added in v0.0.52

func (r *Merger) Callbacks() []schema.Callback

Callbacks returns the registered callbacks of the retriever.

func (*Merger) GetRelevantDocuments added in v0.0.28

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

func (*Merger) Verbose added in v0.0.52

func (r *Merger) Verbose() bool

Verbose returns the verbosity setting of the retriever.

type MergerOptions added in v0.0.52

type MergerOptions struct {
	*schema.CallbackOptions
}

type Options added in v0.0.52

type Options struct {
	Callbacks   []schema.Callback
	ParentRunID string
}

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) Callbacks added in v0.0.52

func (r *VectorStore) Callbacks() []schema.Callback

Callbacks returns the registered callbacks of the retriever.

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.

func (*VectorStore) Verbose added in v0.0.52

func (r *VectorStore) Verbose() bool

Verbose returns the verbosity setting of the retriever.

type VectorStoreOptions added in v0.0.10

type VectorStoreOptions struct {
	*schema.CallbackOptions
	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