openaibusiness

package
v0.0.0-...-435fad9 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type OpenAIService

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

OpenAIService provides business logic for OpenAI transactions.

func NewOpenAIService

func NewOpenAIService(openAIStore openaistorage.OpenAIStore, msgService *messagebusiness.MessageService) *OpenAIService

NewOpenAIService creates a new instance of OpenAIService.

func (*OpenAIService) CountUserTransactions

func (s *OpenAIService) CountUserTransactions(userID uuid.UUID) (int64, error)

CountUserTransactions counts the total number of transactions for a specific user.

func (*OpenAIService) CreateTransaction

func (s *OpenAIService) CreateTransaction(userID, threadID uuid.UUID, message, model, role string) (uuid.UUID, error)

func (*OpenAIService) DeleteTransaction

func (s *OpenAIService) DeleteTransaction(transactionID uuid.UUID) error

DeleteTransaction deletes a transaction by its ID.

func (*OpenAIService) GetTransactionByID

func (s *OpenAIService) GetTransactionByID(transactionID uuid.UUID) (*openaimodel.OpenAITransaction, error)

GetTransactionsByTran retrieves all transactions for a specific user.

func (*OpenAIService) GetTransactionsByThreadID

func (s *OpenAIService) GetTransactionsByThreadID(threadID uuid.UUID) ([]openaimodel.OpenAITransaction, error)

GetTransactionByID retrieves a specific transaction by its ID.

func (*OpenAIService) GetTransactionsByUserID

func (s *OpenAIService) GetTransactionsByUserID(userID uuid.UUID) ([]openaimodel.OpenAITransaction, error)

GetTransactionsByUserID retrieves all transactions for a specific user.

func (*OpenAIService) SummarizeUserUsage

func (s *OpenAIService) SummarizeUserUsage(userID uuid.UUID) (int64, error)

SummarizeUserUsage calculates the total message length processed for a specific user.

func (*OpenAIService) UpdateTransaction

func (s *OpenAIService) UpdateTransaction(transaction *openaimodel.OpenAITransaction) error

UpdateTransaction updates an existing OpenAI transaction.

Jump to

Keyboard shortcuts

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