llama.cpp/tools/server/tests/unit
R 3d26a09dc7
server : add thinking content blocks to Anthropic Messages API (#18551)
* server : add thinking content blocks to Anthropic Messages API

Add support for returning reasoning/thinking content in Anthropic API
responses when using models with --reasoning-format deepseek and the
thinking parameter enabled.

- Non-streaming: adds thinking block before text in content array
- Streaming: emits thinking_delta events with correct block indices
- Partial streaming: tracks reasoning state across chunks via
  anthropic_has_reasoning member variable

Tested with bartowski/DeepSeek-R1-Distill-Qwen-7B-GGUF model.

* server : fix Anthropic API streaming for thinking content blocks

Add signature field and fix duplicate content_block_start events in
Anthropic Messages API streaming responses for reasoning models.

* server: refactor Anthropic streaming state to avoid raw pointer

Replace raw pointer to task_result_state with direct field copies:
- Copy state fields in update() before processing chunk
- Use local copies in to_json_anthropic() instead of dereferencing
- Pre-compute state updates for next chunk in update()

This makes the data flow clearer and avoids unsafe pointer patterns.
2026-01-06 16:17:13 +01:00
..
test_basic.py server: add router multi-model tests (#17704) (#17722) 2025-12-03 15:10:37 +01:00
test_chat_completion.py server: return_progress to also report 0% processing state (#18305) 2025-12-23 21:49:05 +01:00
test_compat_anthropic.py server : add thinking content blocks to Anthropic Messages API (#18551) 2026-01-06 16:17:13 +01:00
test_completion.py server : handle failures to restore host cache (#17078) 2025-11-09 14:27:05 +02:00
test_ctx_shift.py memory : remove KV cache size padding (#16812) 2025-10-28 20:19:44 +02:00
test_embedding.py server : disable context shift by default (#15416) 2025-08-19 16:46:37 +03:00
test_infill.py server : support unified cache across slots (#16736) 2025-11-02 18:14:04 +02:00
test_lora.py server : disable context shift by default (#15416) 2025-08-19 16:46:37 +03:00
test_rerank.py server / ranking : add sorting and management of top_n (#16403) 2025-10-11 16:39:04 +03:00
test_router.py server: add router multi-model tests (#17704) (#17722) 2025-12-03 15:10:37 +01:00
test_security.py server: add --media-path for local media files (#17697) 2025-12-02 22:49:20 +01:00
test_sleep.py server: add auto-sleep after N seconds of idle (#18228) 2025-12-21 02:24:42 +01:00
test_slot_save.py server : disable context shift by default (#15416) 2025-08-19 16:46:37 +03:00
test_speculative.py kv-cache : pad the cache size to 256 for performance (#17046) 2025-11-07 20:03:25 +02:00
test_template.py server : speed up tests (#15836) 2025-09-06 14:45:24 +02:00
test_tokenize.py server : disable context shift by default (#15416) 2025-08-19 16:46:37 +03:00
test_tool_call.py server : speed up tests (#15836) 2025-09-06 14:45:24 +02:00
test_vision_api.py server : speed up tests (#15836) 2025-09-06 14:45:24 +02:00