Add OpenAI Mock Server (#31)
* add constants for completions, refactor usage, add test server Signed-off-by: Oleg <97077423+RobotSail@users.noreply.github.com> * append v1 endpoint to test Signed-off-by: Oleg <97077423+RobotSail@users.noreply.github.com> * add makefile for easy targets Signed-off-by: Oleg <97077423+RobotSail@users.noreply.github.com> * lint files & add linter Signed-off-by: Oleg <97077423+RobotSail@users.noreply.github.com> * disable real API tests in short mode Signed-off-by: Oleg <97077423+RobotSail@users.noreply.github.com> Signed-off-by: Oleg <97077423+RobotSail@users.noreply.github.com>
This commit is contained in:
15
edits.go
15
edits.go
@@ -7,7 +7,7 @@ import (
|
||||
"net/http"
|
||||
)
|
||||
|
||||
// EditsRequest represents a request structure for Edits API
|
||||
// EditsRequest represents a request structure for Edits API.
|
||||
type EditsRequest struct {
|
||||
Model *string `json:"model,omitempty"`
|
||||
Input string `json:"input,omitempty"`
|
||||
@@ -17,24 +17,17 @@ type EditsRequest struct {
|
||||
TopP float32 `json:"top_p,omitempty"`
|
||||
}
|
||||
|
||||
// EditsUsage represents Usage of EditsResponse
|
||||
type EditsUsage struct {
|
||||
PromptTokens int `json:"prompt_tokens"`
|
||||
CompletionTokens int `json:"completion_tokens"`
|
||||
TotalTokens int `json:"total_tokens"`
|
||||
}
|
||||
|
||||
// EditsChoice represents one of possible edits
|
||||
// EditsChoice represents one of possible edits.
|
||||
type EditsChoice struct {
|
||||
Text string `json:"text"`
|
||||
Index int `json:"index"`
|
||||
}
|
||||
|
||||
// EditsResponse represents a response structure for Edits API
|
||||
// EditsResponse represents a response structure for Edits API.
|
||||
type EditsResponse struct {
|
||||
Object string `json:"object"`
|
||||
Created uint64 `json:"created"`
|
||||
Usage EditsUsage `json:"usage"`
|
||||
Usage Usage `json:"usage"`
|
||||
Choices []EditsChoice `json:"choices"`
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user