code formatiing

This commit is contained in:
krishnaduttPanchagnula 2023-05-30 02:00:37 +05:30
parent a5e9da6bf0
commit 1d942080ee
No known key found for this signature in database
GPG key ID: 2BDACA6646C509E3

View file

@ -184,14 +184,6 @@ func completionEndpoint(cm *ConfigMerger, o *Option) func(c *fiber.Ctx) error {
result = append(result, r...) result = append(result, r...)
} }
resp := &OpenAIResponse{
Model: input.Model, // we have to return what the user sent here, due to OpenAI spec.
Choices: result,
Object: "text_completion",
}
jsonResult, _ := json.Marshal(resp)
log.Debug().Msgf("Response: %s", jsonResult)
if input.Stream { if input.Stream {
responses := make(chan OpenAIResponse) responses := make(chan OpenAIResponse)
@ -223,6 +215,14 @@ func completionEndpoint(cm *ConfigMerger, o *Option) func(c *fiber.Ctx) error {
} }
})) }))
} }
resp := &OpenAIResponse{
Model: input.Model, // we have to return what the user sent here, due to OpenAI spec.
Choices: result,
Object: "text_completion",
}
jsonResult, _ := json.Marshal(resp)
log.Debug().Msgf("Response: %s", jsonResult)
// Return the prediction in the response body // Return the prediction in the response body
return c.JSON(resp) return c.JSON(resp)