Skip to content

Get up and running with Kimi, GLM, MiniMax, DeepSeek, gpt-oss, Qwen, Gemma and other models.

llm: remove the unused Grammar completion-request field

Jesse Gross7027546ccfc3
diff --git a/llm/llama_server.go b/llm/llama_server.go
index 464bd693f..6f27b7547 100644
--- a/llm/llama_server.go
+++ b/llm/llama_server.go
@@ -1594,8 +1594,6 @@ func (s *llamaServerRunner) Completion(ctx context.Context, req CompletionReques
return fmt.Errorf("invalid format: %q; expected \"json\" or a valid JSON Schema object", req.Format)
}
}
- } else if req.Grammar != "" {
- lsReq.Grammar = req.Grammar
}
// Convert media: replace Ollama's stable [img-N] markers with the per-process
diff --git a/llm/llama_server_test.go b/llm/llama_server_test.go
index 09f6eb489..a9c9bd826 100644
--- a/llm/llama_server_test.go
+++ b/llm/llama_server_test.go
@@ -1160,7 +1160,6 @@ func TestLlamaServerCompletionRequestFormat(t *testing.T) {
tests := []struct {
name string
format string
- grammar string
wantGrammar bool
wantJsonSchema bool
wantErr bool
@@ -1186,11 +1185,6 @@ func TestLlamaServerCompletionRequestFormat(t *testing.T) {
format: `{"type":"object","properties":{"name":{"type":"string"}}}`,
wantJsonSchema: true,
},
- {
- name: "raw grammar",
- grammar: `root ::= "hello"`,
- wantGrammar: true,
- },
{
name: "invalid format",
format: `"xml"`,
@@ -1228,7 +1222,6 @@ func TestLlamaServerCompletionRequestFormat(t *testing.T) {
req := CompletionRequest{
Prompt: "test",
Options: &opts,
- Grammar: tt.grammar,
}
if tt.format != "" {
req.Format = json.RawMessage(tt.format)
diff --git a/llm/server.go b/llm/server.go
index a11b7f83f..c1f494468 100644
--- a/llm/server.go
+++ b/llm/server.go
@@ -209,7 +209,6 @@ type CompletionRequest struct {
Media []MediaData
Options *api.Options
- Grammar string // set before sending the request to the subprocess
Shift bool
Truncate bool
PreservedTokens []string // parser tokens to render as text; ignored by non-llama-server runners