-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Description
Name and Version
root@llm:/app# /app/llama-server --version
ggml_cuda_init: GGML_CUDA_FORCE_MMQ: no
ggml_cuda_init: GGML_CUDA_FORCE_CUBLAS: no
ggml_cuda_init: found 1 CUDA devices:
Device 0: NVIDIA GeForce RTX 5090, compute capability 12.0, VMM: yes
load_backend: loaded CUDA backend from /app/libggml-cuda.so
load_backend: loaded CPU backend from /app/libggml-cpu-icelake.so
version: 6795 (ee09828)
built with cc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0 for x86_64-linux-gnu
Operating systems
Linux
GGML backends
CUDA
Hardware
RTX 5090
Models
gpt-oss-20b
Problem description & steps to reproduce
When a tool is declared with z.string().regex(/^(anon-)?\d{11,}$/) using typescript-sdk llama.cpp fails with failed to parse grammar.
When serving the same model through LM Studio same code works fine.
If I change regex to z.string().regex(/^(anon-)?[0-9]{11,}$/) llama.cpp works as well.
Here's a simple code to reproduce the issue:
package.json
test_llm.js
test_mcp.js
First Bad Commit
No response
Relevant log output
llm | parse: error parsing grammar: unknown escape at \d"{11,}) "\"" space
llm | test-args-testId-kv ::= "\"testId\"" space ":" space test-args-testId
llm | test-call ::= "test"channel " <|constrain|>json"? "<|message|>" test-args
llm | test-call0 ::= "test" " <|constrain|>json"? "<|message|>" test-args
llm |
llm |
llm | channel ::= "<|channel|>" ( "commentary" | "analysis" )
llm | recipient-in-channel ::= channel " to=functions." ( test-call0 )
llm | recipient-in-role ::= "<|start|>assistant"? " to=functions." ( test-call )
llm | root ::= recipient-in-role | recipient-in-channel
llm | space ::= | " " | "\n"{1,2} [ \t]{0,20}
llm | test-args ::= "{" space test-args-testId-kv "}" space
llm | test-args-testId ::= "\"" (("anon-")? "\d"{11,}) "\"" space
llm | test-args-testId-kv ::= "\"testId\"" space ":" space test-args-testId
llm | test-call ::= "test"channel " <|constrain|>json"? "<|message|>" test-args
llm | test-call0 ::= "test" " <|constrain|>json"? "<|message|>" test-args
llm |
llm | llama_grammar_init_impl: failed to parse grammar
llm | srv send_error: task id = 365, error: Failed to parse grammar
llm | srv process_sing: failed to launch slot with task, id_task = 365
llm | srv update_slots: all slots are idle
llm | srv cancel_tasks: cancel task, id_task = 365
llm | srv update_slots: all slots are idle
llm | srv log_server_r: request: POST /v1/chat/completions 172.19.0.1 400