Documentation ¶
Index ¶
- type Client
- func (c *Client) GetDocuments(ctx context.Context) ([]dct.Document, error)
- func (c *Client) GetIDs(ctx context.Context) ([]string, error)
- func (c *Client) GetSummaries(ctx context.Context) ([]Summary, error)
- func (c *Client) StoreAnswer(ctx context.Context, id, answer string) error
- func (c *Client) StoreDocuments(ctx context.Context, documents []dct.Document) error
- func (c *Client) StoreQuestion(ctx context.Context, id, question string) error
- func (c *Client) StoreSummaries(ctx context.Context, summaries []Summary) error
- func (c *Client) StoreText(ctx context.Context, id, text string) error
- type Databaser
- type Summary
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client implements the db.Databaser interface using AWS S3 and AWS DynamoDB.
func New ¶
func New(newSession *session.Session, bucketName, questionsTableName, summariesTableName string) *Client
New generates a Client pointer instance.
func (*Client) GetDocuments ¶
GetDocuments implements the db.Databaser.GetDocuments method using AWS S3 and returns a slice of structs representing the rows in the documents.jsonl file.
func (*Client) GetIDs ¶
GetIDs implements the db.Databaser.GetIDs method using AWS DynamoDB and returns a slice of the IDs of the items stored in the "summaries" table.
func (*Client) GetSummaries ¶
GetSummaries implements the db.Databaser.GetSummaries method using AWS DynamoDB and returns a slice of structs representing the rows stored in the "summaries" table.
func (*Client) StoreAnswer ¶
StoreAnswer implements the db.Databaser.StoreAnswer method using AWS DynamoDB and stores the received answer generated by OpenAI in the "questions" table.
func (*Client) StoreDocuments ¶
StoreDocuments implements the db.Databaser.StoreDocuments method using AWS S3 and stores the provided slice of structs representing the documents.jsonl file and replaces it in storage.
func (*Client) StoreQuestion ¶
StoreQuestion implements the db.Databaser.StoreQuestion method using AWS DynamoDB and stores the received user question in the "questions" table.
func (*Client) StoreSummaries ¶
StoreSummaries implements the db.Databaser.StoreSummaries method using AWS DynamoDB and stores the provided slice of structs in the "summaries" table.
type Databaser ¶
type Databaser interface { GetIDs(ctx context.Context) ([]string, error) GetSummaries(ctx context.Context) ([]Summary, error) StoreSummaries(ctx context.Context, summaries []Summary) error StoreText(ctx context.Context, id, text string) error GetDocuments(ctx context.Context) ([]dct.Document, error) StoreDocuments(ctx context.Context, answers []dct.Document) error StoreQuestion(ctx context.Context, id, question string) error StoreAnswer(ctx context.Context, id, answer string) error }
Databaser defines methods for interacting with the storage layer of the application.