File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1010from typing import Any , Iterable , Optional
1111
1212_PROTOCOL_RE = re .compile (r"^https?://" , re .IGNORECASE )
13- _PATH_RE = re .compile (r"/." )
13+ _PATH_RE = re .compile (r"/.*$ " )
1414
1515
1616def validate_network_policy_allowlist (
Original file line number Diff line number Diff line change @@ -3538,10 +3538,13 @@ def _make_tools(tools: Iterable[ParseableToolParam] | Omit) -> List[ToolParam] |
35383538 if not is_given (tools ):
35393539 return omit
35403540
3541- validate_tools (tools )
3541+ # Materialise once so that validation doesn't consume a one-shot iterator
3542+ tools_list = list (tools ) if not isinstance (tools , list ) else tools
3543+
3544+ validate_tools (tools_list )
35423545
35433546 converted_tools : List [ToolParam ] = []
3544- for tool in tools :
3547+ for tool in tools_list :
35453548 if tool ["type" ] != "function" :
35463549 converted_tools .append (tool )
35473550 continue
You can’t perform that action at this time.
0 commit comments