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

Method _new_tool_call_state

examples/server/server.py:5479–5514  ·  view source on GitHub ↗
(self, item_plan: Dict[str, Any])

Source from the content-addressed store, hash-verified

5477 return True
5478
5479 def _new_tool_call_state(self, item_plan: Dict[str, Any]) -> Dict[str, Any]:
5480 if item_plan["kind"] == "buffered":
5481 return {"kind": "buffered", "buffer": ""}
5482 if item_plan["kind"] == "json-message":
5483 return {
5484 "kind": "json-message",
5485 "pending": "",
5486 "mode": "function-name",
5487 "tool_call": {
5488 "type": "function",
5489 "function": {
5490 "name": "",
5491 "arguments": "",
5492 },
5493 },
5494 "arguments_text": "",
5495 "json_started": False,
5496 "json_complete": False,
5497 "json_depth": 0,
5498 "json_in_string": False,
5499 "json_escaped": False,
5500 }
5501 return {
5502 "kind": "tagged-parameters",
5503 "pending": "",
5504 "mode": "function-header",
5505 "tool_call": {
5506 "type": "function",
5507 "function": {
5508 "name": "",
5509 "arguments": ResponseParser.PartialJsonObject(OrderedDict(), complete=False),
5510 },
5511 },
5512 "current_parameter": None,
5513 "current_schema_type": None,
5514 }
5515
5516 def _new_stream_state(self, plan: Dict[str, Any]) -> ResponseParser.StreamState:
5517 if plan["kind"] == "json-root":

Callers 1

_advance_stream_stateMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected