From 884d26093c80491a3fe07f606fc04851dc317199 Mon Sep 17 00:00:00 2001 From: Parth Sareen Date: Thu, 22 May 2025 18:53:31 -0700 Subject: [PATCH] llama: add minimum memory for grammar (#10820) --- llama/llama.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/llama/llama.go b/llama/llama.go index adee6f63ca..0dc64e57ed 100644 --- a/llama/llama.go +++ b/llama/llama.go @@ -580,7 +580,7 @@ func SchemaToGrammar(schema []byte) []byte { defer C.free(unsafe.Pointer(cStr)) // Allocate buffer for grammar based on schema length but with upper bound - maxLen := min(1024*1024, len(schema)*4) + maxLen := max(32768, min(1024*1024, len(schema)*4)) buf := make([]byte, maxLen) // Call C function to convert schema to grammar