Skip to content

Commit

Permalink
Merge branch 'master' into parallel_grpc
Browse files Browse the repository at this point in the history
  • Loading branch information
mudler authored Nov 15, 2023
2 parents 98a7afa + 66a558f commit dcefcdc
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ GOLLAMA_VERSION?=aeba71ee842819da681ea537e78846dc75949ac0

GOLLAMA_STABLE_VERSION?=50cee7712066d9e38306eccadcfbb44ea87df4b7

CPPLLAMA_VERSION?=bd90eca237b498dd106d315dcb9ad3e6fae3906f
CPPLLAMA_VERSION?=6bb4908a17150b49373b5f977685b2e180a04f6f

# gpt4all version
GPT4ALL_REPO?=https://github.com/nomic-ai/gpt4all
Expand Down
2 changes: 1 addition & 1 deletion api/openai/chat.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ func ChatEndpoint(cm *config.ConfigLoader, o *options.Option) func(c *fiber.Ctx)
noActionDescription = config.FunctionsConfig.NoActionDescriptionName
}

if input.ResponseFormat == "json_object" {
if input.ResponseFormat.Type == "json_object" {
input.Grammar = grammar.JSONBNF
}

Expand Down
2 changes: 1 addition & 1 deletion api/openai/completion.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func CompletionEndpoint(cm *config.ConfigLoader, o *options.Option) func(c *fibe
return fmt.Errorf("failed reading parameters from request:%w", err)
}

if input.ResponseFormat == "json_object" {
if input.ResponseFormat.Type == "json_object" {
input.Grammar = grammar.JSONBNF
}

Expand Down
2 changes: 1 addition & 1 deletion api/openai/image.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ func ImageEndpoint(cm *config.ConfigLoader, o *options.Option) func(c *fiber.Ctx
}

b64JSON := false
if input.ResponseFormat == "b64_json" {
if input.ResponseFormat.Type == "b64_json" {
b64JSON = true
}
// src and clip_skip
Expand Down
8 changes: 7 additions & 1 deletion api/schema/openai.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,12 @@ type OpenAIModel struct {
Object string `json:"object"`
}

type ChatCompletionResponseFormatType string

type ChatCompletionResponseFormat struct {
Type ChatCompletionResponseFormatType `json:"type,omitempty"`
}

type OpenAIRequest struct {
config.PredictionOptions

Expand All @@ -92,7 +98,7 @@ type OpenAIRequest struct {
// whisper
File string `json:"file" validate:"required"`
//whisper/image
ResponseFormat string `json:"response_format"`
ResponseFormat ChatCompletionResponseFormat `json:"response_format"`
// image
Size string `json:"size"`
// Prompt is read only by completion/image API calls
Expand Down

0 comments on commit dcefcdc

Please sign in to comment.