33
44import json
55from pprint import pprint
6- from typing import List , Tuple , Dict , Any
6+ from typing import Any , Dict , List , Tuple
77
8+ # Third-party libraries
89import jsonschema
910import openai
1011import 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