MCPcopy Create free account
hub / github.com/THUDM/AgentBench / prompt_string

Method prompt_string

src/client/agents/http_agent.py:99–118  ·  view source on GitHub ↗
(
        prefix: str = "",
        suffix: str = "AGENT:",
        user_format: str = "USER: {content}\n\n",
        agent_format: str = "AGENT: {content}\n\n",
        prompt_key: str = "prompt",
    )

Source from the content-addressed store, hash-verified

97
98 @staticmethod
99 def prompt_string(
100 prefix: str = "",
101 suffix: str = "AGENT:",
102 user_format: str = "USER: {content}\n\n",
103 agent_format: str = "AGENT: {content}\n\n",
104 prompt_key: str = "prompt",
105 ):
106 def prompter(messages: List[Dict[str, str]]):
107 nonlocal prefix, suffix, user_format, agent_format, prompt_key
108 prompt = prefix
109 for item in messages:
110 if item["role"] == "user":
111 prompt += user_format.format(content=item["content"])
112 else:
113 prompt += agent_format.format(content=item["content"])
114 prompt += suffix
115 print(prompt)
116 return {prompt_key: prompt}
117
118 return prompter
119
120 @staticmethod
121 def claude():

Callers 1

claudeMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected