mirror of
https://github.com/ollama/ollama.git
synced 2025-04-11 21:29:32 +02:00
llm: consider null format same as empty value
This commit is contained in:
parent
2cde4b8817
commit
04314765f2
@ -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
|
||||
|
@ -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),
|
||||
|
Loading…
x
Reference in New Issue
Block a user