Compare commits

...

1 Commits

Author SHA1 Message Date
jmorganca
04314765f2 llm: consider null format same as empty value 2024-12-17 09:16:01 -08:00
2 changed files with 2 additions and 2 deletions

View File

@ -701,7 +701,7 @@ func (s *llmServer) Completion(ctx context.Context, req CompletionRequest, fn fu
if len(req.Format) > 0 {
switch {
case bytes.Equal(req.Format, []byte(`""`)):
case bytes.Equal(req.Format, []byte(`""`)) || bytes.Equal(req.Format, []byte(`null`)):
// fallthrough
case bytes.Equal(req.Format, []byte(`"json"`)):
request["grammar"] = grammarJSON

View File

@ -46,7 +46,7 @@ func TestLLMServerCompletionFormat(t *testing.T) {
}
}
valids := []string{`"json"`, `{"type":"object"}`, ``, `""`}
valids := []string{`"json"`, `{"type":"object"}`, ``, `""`, `null`}
for _, valid := range valids {
err := s.Completion(ctx, CompletionRequest{
Options: new(api.Options),