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 @@ -3534,10 +3534,13 @@ def _make_tools(tools: Iterable[ParseableToolParam] | Omit) -> List[ToolParam] |
35343534 if not is_given (tools ):
35353535 return omit
35363536
3537- validate_tools (tools )
3537+ # Materialise once so that validation doesn't consume a one-shot iterator
3538+ tools_list = list (tools ) if not isinstance (tools , list ) else tools
3539+
3540+ validate_tools (tools_list )
35383541
35393542 converted_tools : List [ToolParam ] = []
3540- for tool in tools :
3543+ for tool in tools_list :
35413544 if tool ["type" ] != "function" :
35423545 converted_tools .append (tool )
35433546 continue
You can’t perform that action at this time.
0 commit comments