postapi

package
v0.0.0-...-2e32b89 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const MAX_FILE_SIZE int64 = 10 << 20 // 10 MB
View Source
const MAX_TOTAL_UPLOAD_SIZE int64 = 10 << 20 // 10 MB

Variables

This section is empty.

Functions

func FormParseVerify

func FormParseVerify(form form.Form, name string, w http.ResponseWriter, r *http.Request) errorlist.Errors

Util: does grunt work of decoding + verifying form + writing errors back

Types

type Answer

type Answer struct {
	Answer  string    `json:"answer"`
	Context []Context `json:"context"`
	Tokens  int       `json:"tokens"`
}

type Context

type Context struct {
	Text  string `json:"text"`
	Title string `json:"title"`
}

type HandlerContext

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

func NewHandlerContext

func NewHandlerContext(openAIClient *openai.Client, vectorDB vectordb.VectorDB) *HandlerContext

func (*HandlerContext) QuestionHandler

func (ctx *HandlerContext) QuestionHandler(w http.ResponseWriter, r *http.Request)

Handle Requests For Question

func (*HandlerContext) UploadHandler

func (ctx *HandlerContext) UploadHandler(w http.ResponseWriter, r *http.Request)

type OpenAIResponse

type OpenAIResponse struct {
	Response string `json:"response"`
	Tokens   int    `json:"tokens"`
}

type UploadResponse

type UploadResponse struct {
	Message             string            `json:"message"`
	NumFilesSucceeded   int               `json:"num_files_succeeded"`
	NumFilesFailed      int               `json:"num_files_failed"`
	SuccessfulFileNames []string          `json:"successful_file_names"`
	FailedFileNames     map[string]string `json:"failed_file_names"`
	FilePreviews        map[string]string `json:"file_previews"`
}

Jump to

Keyboard shortcuts

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