@miller-tech/uap 1.76.2 → 1.76.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
Binary file
|
|
@@ -561,14 +561,17 @@ class ToolCallClient:
|
|
|
561
561
|
**kwargs,
|
|
562
562
|
}
|
|
563
563
|
|
|
564
|
+
# Non-OpenAI sampling/server params (top_k, min_p, grammar,
|
|
565
|
+
# chat_template_kwargs) MUST be passed via extra_body — the OpenAI
|
|
566
|
+
# SDK rejects them as direct kwargs ("unexpected keyword argument
|
|
567
|
+
# 'top_k'"), which previously made every tool-call test fail before
|
|
568
|
+
# reaching the model. Collect them into one extra_body dict.
|
|
569
|
+
extra_body: dict = {}
|
|
570
|
+
|
|
564
571
|
# Strategy 5: Thinking mode suppression (model-specific)
|
|
565
572
|
if request_config.get("suppress_thinking"):
|
|
566
|
-
|
|
567
|
-
"
|
|
568
|
-
"enable_thinking": request_config.get(
|
|
569
|
-
"enable_thinking", False
|
|
570
|
-
)
|
|
571
|
-
}
|
|
573
|
+
extra_body["chat_template_kwargs"] = {
|
|
574
|
+
"enable_thinking": request_config.get("enable_thinking", False)
|
|
572
575
|
}
|
|
573
576
|
# Version check: llama.cpp >= 3761 supports chat_template_kwargs
|
|
574
577
|
# Older versions will ignore unknown extra_body keys
|
|
@@ -582,14 +585,19 @@ class ToolCallClient:
|
|
|
582
585
|
f"parallel={request_config.get('parallel_tool_calls', True)}"
|
|
583
586
|
)
|
|
584
587
|
|
|
588
|
+
# `stop` is a standard OpenAI param -> top-level kwarg.
|
|
585
589
|
if request_config.get("stop_sequences"):
|
|
586
590
|
request_params["stop"] = request_config["stop_sequences"]
|
|
591
|
+
# llama.cpp sampling params -> extra_body (forwarded by the SDK).
|
|
587
592
|
if request_config.get("top_k") is not None:
|
|
588
|
-
|
|
593
|
+
extra_body["top_k"] = request_config["top_k"]
|
|
589
594
|
if request_config.get("min_p") is not None:
|
|
590
|
-
|
|
595
|
+
extra_body["min_p"] = request_config["min_p"]
|
|
591
596
|
if grammar_text and tools:
|
|
592
|
-
|
|
597
|
+
extra_body["grammar"] = grammar_text
|
|
598
|
+
|
|
599
|
+
if extra_body:
|
|
600
|
+
request_params["extra_body"] = extra_body
|
|
593
601
|
|
|
594
602
|
# Make API call
|
|
595
603
|
response = self._client.chat.completions.create(**request_params)
|