MCPcopy Index your code
hub / github.com/abetlen/llama-cpp-python / _tool_call_delta

Method _tool_call_delta

examples/server/server.py:6352–6378  ·  view source on GitHub ↗
(
        self,
        *,
        tool_call: Dict[str, Any],
        tool_call_index: int,
        partial: bool,
    )

Source from the content-addressed store, hash-verified

6350 return cast(Dict[str, Any], item_state["tool_call"])
6351
6352 def _tool_call_delta(
6353 self,
6354 *,
6355 tool_call: Dict[str, Any],
6356 tool_call_index: int,
6357 partial: bool,
6358 ) -> Dict[str, Any]:
6359 function = cast(Dict[str, Any], tool_call["function"])
6360 return {
6361 "tool_calls": [
6362 {
6363 "index": tool_call_index,
6364 "id": (
6365 f"call_{self._choice_index}_{function['name']}_"
6366 f"{self._completion_id}_{tool_call_index}"
6367 ),
6368 "type": tool_call.get("type", "function"),
6369 "function": {
6370 "name": function["name"],
6371 "arguments": self._serialize_tool_arguments(
6372 function["arguments"],
6373 partial=partial,
6374 ),
6375 },
6376 }
6377 ]
6378 }
6379
6380 def _advance_stream_state(self, text: str) -> Tuple[bool, List[Dict[str, Any]]]:
6381 deltas: List[Dict[str, Any]] = []

Callers 1

_advance_stream_stateMethod · 0.95

Calls 1

Tested by

no test coverage detected