retriever

package
v0.0.97 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2023 License: MIT Imports: 17 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

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

	// UserContext provides information about the user context for an Amazon Kendra index.
	UserContext *types.UserContext

	// DisableRetrieve disabled the Retrieve API call so that only the Query API is used.
	DisableRetrieve bool
}

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 BedrockAgentRuntimeClient added in v0.0.86

type BedrockAgentRuntimeClient interface {
	Retrieve(context.Context, *bedrockagentruntime.RetrieveInput, ...func(*bedrockagentruntime.Options)) (*bedrockagentruntime.RetrieveOutput, error)
}

BedrockAgentRuntimeClient is an interface representing the Bedrock Agent Runtime client.

type BedrockKnowledgeBase added in v0.0.88

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

BedrockKnowledgeBase is a retriever implementation for retrieving documents from a knowledge base using the Bedrock Agent Runtime client.

func NewBedrockKnowledgeBase added in v0.0.88

func NewBedrockKnowledgeBase(client BedrockAgentRuntimeClient, knowledgeBaseID string, optFns ...func(o *BedrockKnowledgeBaseOptions)) *BedrockKnowledgeBase

NewBedrockKnowledgeBase creates a new BedrockKnowledgeBase retriever with the specified client, knowledge base ID, and options.

func (*BedrockKnowledgeBase) Callbacks added in v0.0.88

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

Callbacks returns the registered callbacks of the retriever.

func (*BedrockKnowledgeBase) GetRelevantDocuments added in v0.0.88

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

GetRelevantDocuments retrieves relevant documents from the knowledge base based on the given query.

func (*BedrockKnowledgeBase) Verbose added in v0.0.88

func (r *BedrockKnowledgeBase) Verbose() bool

Verbose returns the verbosity setting of the retriever.

type BedrockKnowledgeBaseOptions added in v0.0.88

type BedrockKnowledgeBaseOptions struct {
	*schema.CallbackOptions

	// RetrievalConfiguration provides search parameters for retrieving from knowledge base.
	RetrievalConfiguration types.KnowledgeBaseRetrievalConfiguration
}

BedrockKnowledgeBaseOptions represents the options for configuring BedrockKnowledgeBase.

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