MCPcopy Create free account
hub / github.com/abetlen/llama-cpp-python / _start_direct_tool_call

Method _start_direct_tool_call

examples/server/server.py:5562–5583  ·  view source on GitHub ↗
(self, tool_call_index: int)

Source from the content-addressed store, hash-verified

5560 )
5561
5562 def _start_direct_tool_call(self, tool_call_index: int) -> None:
5563 self._item.pending = ""
5564 self._item.mode = self.ITEM_MODE_FUNCTION_HEADER
5565 self._item.tool_call_index = tool_call_index
5566 self._item.tool_name = ""
5567 self._item.parameter_count = 0
5568 tool_calls = self._message.setdefault("tool_calls", [])
5569 assert isinstance(tool_calls, list)
5570 while len(tool_calls) <= tool_call_index:
5571 tool_calls.append({"function": {"name": "", "arguments": ""}})
5572 visible_tool_call = tool_calls[tool_call_index]
5573 assert isinstance(visible_tool_call, dict)
5574 self._item.visible_tool_call = visible_tool_call
5575 function = visible_tool_call.setdefault("function", {})
5576 assert isinstance(function, dict)
5577 self._item.visible_function = function
5578 if tool_call_index == 0:
5579 self._message["function_call"] = self._item.visible_function
5580 self._item.current_parameter = None
5581 self._item.current_parameter_value = ""
5582 self._item.current_schema_type = None
5583 self._item.current_parameter_schema = {}
5584
5585 def _advance_direct_tool_call_state(self, text: str) -> Tuple[bool, List[Dict[str, Any]]]:
5586 deltas: List[Dict[str, Any]] = []

Callers 1

Calls 1

appendMethod · 0.80

Tested by

no test coverage detected