MCPcopy Index your code
hub / github.com/OpenBMB/ChatDev / call_user

Function call_user

functions/function_calling/user.py:1–17  ·  view source on GitHub ↗

If you think it's necessary to get input from the user, use this function to send the instruction to the user and get their response. Args: instruction: The instruction to send to the user.

(instruction: str, _context: dict | None = None)

Source from the content-addressed store, hash-verified

1def call_user(instruction: str, _context: dict | None = None) -> str:
2 """
3 If you think it's necessary to get input from the user, use this function to send the instruction to the user and get their response.
4
5 Args:
6 instruction: The instruction to send to the user.
7 """
8 prompt = _context.get("human_prompt") if _context else None
9 if prompt is None:
10 return f"Human prompt unavailable, default response for instruction: {instruction}"
11 result = prompt.request(
12 node_id=_context.get("node_id", "model_function_calling"),
13 task_description="Please response to the model instruction.",
14 inputs=instruction,
15 metadata={"source": "function_tool"},
16 )
17 return result.text

Callers

nothing calls this directly

Calls 2

getMethod · 0.45
requestMethod · 0.45

Tested by

no test coverage detected