easydel.inference.tools.parsers.seed_oss_tool_parser#
- class easydel.inference.tools.parsers.seed_oss_tool_parser.SeedOssToolParser(tokenizer: AutoTokenizer)[source]#
Bases:
ToolParserTool parser for Seed OSS models.
Handles XML-style tool calls with seed-specific prefixes and thinking tag support. Similar to Qwen3Coder but with seed: namespace prefixes.
Features: - XML parsing with <seed:tool_call> wrapper - Thinking tag support (<seed:think>…</seed:think>) - Function and parameter XML tags - Type-aware parameter conversion - Streaming with state management
Format: <seed:think>…reasoning…</seed:think> <seed:tool_call> <function=name> <parameter=param>value</parameter> </function> </seed:tool_call>
Filters tool calls from thinking sections and maintains streaming state for progressive parameter emission.
- TOOL_CALL_END = '</seed:tool_call>'#
- TOOL_CALL_START = '<seed:tool_call>'#
- extract_tool_calls(model_output: str, request: ChatCompletionRequest) ExtractedToolCallInformation[source]#
Extract tool calls from complete model output (batch mode).
Parses the entire model response to identify and extract tool/function calls. This method is used for non-streaming responses where the complete output is available.
- Parameters
model_output – Complete text generated by the model
request – Original request containing tool definitions
- Returns
Parsed tool calls and remaining content
- Return type
- Raises
NotImplementedError – Must be implemented by subclasses
Note
This method is stateless - it doesn’t use instance state. Each parser implements model-specific extraction logic.
- extract_tool_calls_streaming(previous_text: str, current_text: str, delta_text: str, previous_token_ids: Sequence[int], current_token_ids: Sequence[int], delta_token_ids: Sequence[int], request: ChatCompletionRequest) easydel.inference.openai_api_modules.DeltaMessage | None[source]#
Extract tool calls from streaming model output.
Processes incremental model output to identify partial tool calls and emit appropriate streaming updates. Maintains state across calls to handle incomplete JSON/XML structures.
- Parameters
previous_text – Text accumulated up to previous call
current_text – Text accumulated including current chunk
delta_text – New text in current chunk
previous_token_ids – Token IDs up to previous call
current_token_ids – Token IDs including current chunk
delta_token_ids – New token IDs in current chunk
request – Original request with tool definitions
- Returns
Incremental tool call update, or None if no update
- Return type
- Raises
NotImplementedError – Must be implemented by subclasses
Note
This method is stateful - it uses instance variables to track parsing progress across streaming chunks.