Skip to content

Commit 339a74a

Browse files
committed
refactor(sglang): add tool call parser option
1 parent 0de7139 commit 339a74a

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/strands_env/core/models.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
from strands.models.bedrock import BedrockModel
5050
from strands.models.openai import OpenAIModel
5151
from strands_sglang import SGLangClient, SGLangModel
52+
from strands_sglang.tool_parser import HermesToolCallParser, ToolCallParser
5253
from transformers import PreTrainedTokenizerBase
5354

5455
#: Factory that produces a fresh `Model` per step (for concurrent step isolation).
@@ -66,6 +67,7 @@ def sglang_model_factory(
6667
model_id: str,
6768
tokenizer: PreTrainedTokenizerBase,
6869
client: SGLangClient,
70+
tool_call_parser: ToolCallParser = HermesToolCallParser(),
6971
sampling_params: dict[str, Any] = DEFAULT_SAMPLING_PARAMS,
7072
enable_thinking: bool | None = None,
7173
) -> ModelFactory:
@@ -81,6 +83,7 @@ def sglang_model_factory(
8183
return lambda: SGLangModel(
8284
tokenizer=tokenizer,
8385
client=client,
86+
tool_call_parser=tool_call_parser,
8487
params=sampling_params,
8588
model_id=model_id,
8689
return_logprobs=True,

0 commit comments

Comments
 (0)