openaimod

package
v0.0.0-...-e37d8fb Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FxOptions

func FxOptions() fx.Option

Types

type ChatGPTResp

type ChatGPTResp struct {
	ID      string   `json:"id"`
	Model   string   `json:"model"`
	Choices []Choice `json:"choices"`
	Usage   struct {
		TotalTokens      int64 `json:"total_tokens"`
		PromptTokens     int64 `json:"prompt_tokens"`
		CompletionTokens int64 `json:"completion_tokens"`
	} `json:"usage"`
}

type ChatGpt

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

func NewChatGpt

func NewChatGpt(client gpt.Client) *ChatGpt

func (*ChatGpt) GetResponse

func (c *ChatGpt) GetResponse(ctx context.Context, question string) (string, error)

GetResponse get response from gpt3

type Choice

type Choice struct {
	Message struct {
		Role    string `json:"role"`
		Content string `json:"content"`
	}
	FinishReason string `json:"finish_reason"`
	Index        int    `json:"index"`
}

type Config

type Config struct {
	Key string
}

type NullWriter

type NullWriter int

NullWriter is a writer on which all Write calls succeed

func (NullWriter) Write

func (NullWriter) Write([]byte) (int, error)

Write implements io.Writer

Jump to

Keyboard shortcuts

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