Documentation ¶
Overview ¶
Package revisor contains services for processing and retrieving articles.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrTooManyTokens = fmt.Errorf("too many tokens")
ErrTooManyTokens is returned when article is too long.
Functions ¶
This section is empty.
Types ¶
type ChatGPT ¶
type ChatGPT struct {
// contains filtered or unexported fields
}
ChatGPT is a client to make requests to OpenAI chatgpt service.
func NewChatGPT ¶
NewChatGPT creates new ChatGPT client.
func (*ChatGPT) BulletPoints ¶
BulletPoints shortens article.
type Extractor ¶
type Extractor struct {
// contains filtered or unexported fields
}
Extractor is extracts article from HTML page.
type OpenAIClient ¶
type OpenAIClient interface {
CreateChatCompletion(context.Context, openai.ChatCompletionRequest) (openai.ChatCompletionResponse, error)
}
OpenAIClient is interface for OpenAI client with the possibility to mock it
type OpenAIClientMock ¶
type OpenAIClientMock struct { // CreateChatCompletionFunc mocks the CreateChatCompletion method. CreateChatCompletionFunc func(contextMoqParam context.Context, chatCompletionRequest openai.ChatCompletionRequest) (openai.ChatCompletionResponse, error) // contains filtered or unexported fields }
OpenAIClientMock is a mock implementation of OpenAIClient.
func TestSomethingThatUsesOpenAIClient(t *testing.T) { // make and configure a mocked OpenAIClient mockedOpenAIClient := &OpenAIClientMock{ CreateChatCompletionFunc: func(contextMoqParam context.Context, chatCompletionRequest openai.ChatCompletionRequest) (openai.ChatCompletionResponse, error) { panic("mock out the CreateChatCompletion method") }, } // use mockedOpenAIClient in code that requires OpenAIClient // and then make assertions. }
func (*OpenAIClientMock) CreateChatCompletion ¶
func (mock *OpenAIClientMock) CreateChatCompletion(contextMoqParam context.Context, chatCompletionRequest openai.ChatCompletionRequest) (openai.ChatCompletionResponse, error)
CreateChatCompletion calls CreateChatCompletionFunc.
func (*OpenAIClientMock) CreateChatCompletionCalls ¶
func (mock *OpenAIClientMock) CreateChatCompletionCalls() []struct { ContextMoqParam context.Context ChatCompletionRequest openai.ChatCompletionRequest }
CreateChatCompletionCalls gets all the calls that were made to CreateChatCompletion. Check the length with:
len(mockedOpenAIClient.CreateChatCompletionCalls())
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service is a main application service.
func NewService ¶
NewService creates new service.
func (*Service) GPTCacheStat ¶
GPTCacheStat returns cache stats.