Skip to content

Commit b6d38f5

Browse files
committed
tool parser openai-19
Signed-off-by: Debolina Roy <[email protected]>
1 parent aba00b4 commit b6d38f5

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

tests/entrypoints/openai/tool_parsers/test_openai_tool_parser.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33

44
import json
55
from pprint import pprint
6-
from typing import List, Tuple, Dict, Any
6+
from typing import Any, Dict, List, Tuple
77

8+
# Third-party libraries
89
import jsonschema
910
import openai
1011
import pytest
@@ -128,13 +129,13 @@ async def client(server):
128129
# ==========================================================
129130
# Utility to extract reasoning and tool calls
130131
# ==========================================================
131-
def extract_reasoning_and_calls(chunks: list) -> Tuple[str, List[str], List[str]]:
132+
def extract_reasoning_and_calls(chunks: list) -> tuple[str, list[str], list[str]]:
132133
"""
133134
Extract accumulated reasoning text and tool call arguments
134135
from streaming chunks.
135136
"""
136137
reasoning_content: str = ""
137-
tool_calls: Dict[int, Dict[str, str]] = {}
138+
tool_calls: dict[int, dict[str, str]] = {}
138139

139140
for chunk in chunks:
140141
choice = getattr(chunk.choices[0], "delta", None)
@@ -155,8 +156,8 @@ def extract_reasoning_and_calls(chunks: list) -> Tuple[str, List[str], List[str]
155156
if getattr(func, "arguments", None):
156157
tool_entry["arguments"] += func.arguments
157158

158-
function_names: List[str] = [v["name"] for _, v in sorted(tool_calls.items())]
159-
arguments: List[str] = [v["arguments"] for _, v in sorted(tool_calls.items())]
159+
function_names: list[str] = [v["name"] for _, v in sorted(tool_calls.items())]
160+
arguments: list[str] = [v["arguments"] for _, v in sorted(tool_calls.items())]
160161

161162
return reasoning_content, arguments, function_names
162163

0 commit comments

Comments
 (0)