From 4e1be7d99faae17db27569b3e0031df4b103c53d Mon Sep 17 00:00:00 2001 From: sashabaranov <677093+sashabaranov@users.noreply.github.com> Date: Fri, 3 Mar 2023 11:07:40 +0400 Subject: [PATCH] remove deprecated answers API (#108) --- answers.go | 50 -------------------------------------------------- 1 file changed, 50 deletions(-) delete mode 100644 answers.go diff --git a/answers.go b/answers.go deleted file mode 100644 index 5a99078..0000000 --- a/answers.go +++ /dev/null @@ -1,50 +0,0 @@ -package gogpt - -import ( - "bytes" - "context" - "encoding/json" - "net/http" -) - -type AnswerRequest struct { - Documents []string `json:"documents,omitempty"` - File string `json:"file,omitempty"` - Question string `json:"question"` - SearchModel string `json:"search_model,omitempty"` - Model string `json:"model"` - ExamplesContext string `json:"examples_context"` - Examples [][]string `json:"examples"` - MaxTokens int `json:"max_tokens,omitempty"` - Stop []string `json:"stop,omitempty"` - Temperature *float64 `json:"temperature,omitempty"` -} - -type AnswerResponse struct { - Answers []string `json:"answers"` - Completion string `json:"completion"` - Model string `json:"model"` - Object string `json:"object"` - SearchModel string `json:"search_model"` - SelectedDocuments []struct { - Document int `json:"document"` - Text string `json:"text"` - } `json:"selected_documents"` -} - -// Search — perform a semantic search api call over a list of documents. -func (c *Client) Answers(ctx context.Context, request AnswerRequest) (response AnswerResponse, err error) { - var reqBytes []byte - reqBytes, err = json.Marshal(request) - if err != nil { - return - } - - req, err := http.NewRequestWithContext(ctx, http.MethodPost, c.fullURL("/answers"), bytes.NewBuffer(reqBytes)) - if err != nil { - return - } - - err = c.sendRequest(req, &response) - return -}