Documentation ¶
Index ¶
- type AIClientInterface
- type CreateEmbeddingRequestBody
- type CreateEmbeddingResponseBody
- type CreateModerationRequestBody
- type CreateModerationResponseBody
- type Embedding
- type Match
- type ModerationResult
- type OpenAIClient
- type PineconeClient
- type PineconeDeleteRequestBody
- type PineconeSearchRequestBody
- type PineconeSearchResponseBody
- type PineconeUpsertRequestBody
- type SearchClientInterface
- type Searchable
- type Vector
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AIClientInterface ¶
type AIClientInterface interface { CreateEmbedding(items []Searchable) ([]Embedding, *errors.Error) CreateModeration(items []Searchable) ([]ModerationResult, *errors.Error) }
func NewOpenAIClient ¶
func NewOpenAIClient(settings config.OpenAISettings) AIClientInterface
type CreateEmbeddingResponseBody ¶
type CreateEmbeddingResponseBody struct {
Data []Embedding `json:"data"`
}
type CreateModerationResponseBody ¶
type CreateModerationResponseBody struct {
Results []ModerationResult `json:"results"`
}
type ModerationResult ¶
type ModerationResult struct {
Flagged bool `json:"flagged"`
}
type OpenAIClient ¶
type OpenAIClient struct {
Settings config.OpenAISettings
}
func (*OpenAIClient) CreateEmbedding ¶
func (c *OpenAIClient) CreateEmbedding(items []Searchable) ([]Embedding, *errors.Error)
func (*OpenAIClient) CreateModeration ¶
func (c *OpenAIClient) CreateModeration(items []Searchable) ([]ModerationResult, *errors.Error)
type PineconeClient ¶
type PineconeClient struct { PineconeSettings config.PineconeSettings IndexName *mattress.Secret[string] // contains filtered or unexported fields }
func NewPineconeClient ¶
func NewPineconeClient(aiClient AIClientInterface, pineconeSettings config.PineconeSettings) *PineconeClient
Connects to an existing Pinecone index, using the host and keys provided in settings.
func (*PineconeClient) Delete ¶
func (c *PineconeClient) Delete(items []Searchable) *errors.Error
Deletes the given list of searchables from the Pinecone index.
func (*PineconeClient) Search ¶
func (c *PineconeClient) Search(item Searchable) ([]string, *errors.Error)
Runs a search on the Pinecone index given a searchable item, and returns the topK most similar elements' ids.
func (*PineconeClient) Seed ¶
func (c *PineconeClient) Seed(db *gorm.DB) *errors.Error
Seeds the pinecone index with the clubs currently in the database.
func (*PineconeClient) Upsert ¶
func (c *PineconeClient) Upsert(items []Searchable) *errors.Error
Inserts the given list of searchables to the Pinecone index.
type SearchClientInterface ¶
type SearchClientInterface interface { Seed(db *gorm.DB) *errors.Error Upsert(items []Searchable) *errors.Error Delete(items []Searchable) *errors.Error Search(item Searchable) ([]string, *errors.Error) }
type Searchable ¶
type Searchable interface { // SearchId Returns the id this searchable value should be associated with. SearchId() string // Namespace Returns the namespace this searchable value should be associated with. Namespace() string // EmbeddingString Returns the string that should be used to create an embedding of this searchable value. EmbeddingString() string }
Searchable Represents a value that can be searched (i.e, able to create embeddings and upload them to vector db)
Click to show internal directories.
Click to hide internal directories.