wip go engine

Co-authored-by: Patrick Devine <pdevine@sonic.net>
This commit is contained in:
Jeffrey Morgan
2023-07-03 15:22:44 -04:00
parent 172274b809
commit 76cb60d496
39 changed files with 1377 additions and 1 deletions

28
api/types.go Normal file
View File

@@ -0,0 +1,28 @@
package api
import (
"fmt"
"net/http"
"strings"
)
type Error struct {
Code int32 `json:"code"`
Message string `json:"message"`
}
func (e Error) Error() string {
if e.Message == "" {
return fmt.Sprintf("%d %v", e.Code, strings.ToLower(http.StatusText(int(e.Code))))
}
return e.Message
}
type GenerateRequest struct {
Model string `json:"model"`
Prompt string `json:"prompt"`
}
type GenerateResponse struct {
Response string `json:"response"`
}