mirror of
https://github.com/OpenBMB/ChatDev.git
synced 2026-04-26 03:38:12 +00:00
18 lines
741 B
Python
Executable File
18 lines
741 B
Python
Executable File
def call_user(instruction: str, _context: dict | None = None) -> str:
|
|
"""
|
|
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.
|
|
"""
|
|
prompt = _context.get("human_prompt") if _context else None
|
|
if prompt is None:
|
|
return f"Human prompt unavailable, default response for instruction: {instruction}"
|
|
result = prompt.request(
|
|
node_id=_context.get("node_id", "model_function_calling"),
|
|
task_description="Please response to the model instruction.",
|
|
inputs=instruction,
|
|
metadata={"source": "function_tool"},
|
|
)
|
|
return result.text
|