You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
tl;dr support something similar to openai.client for python developers
Add a familiar python interface to the API server. In essence, instead of making python developers write REST/requests code or asking them to do this (taken from #689):
### imports# (truncated)### wrapper codedefprocess_agent_step(agent, user_message, no_verify):
"""Copied from main.py (unpacks the content of agent.step())"""new_messages, heartbeat_request, function_failed, token_warning=agent.step(user_message, first_message=False, skip_verify=no_verify)
skip_next_user_input=Falseiftoken_warning:
user_message=system.get_token_limit_warning()
skip_next_user_input=Trueeliffunction_failed:
user_message=system.get_heartbeat(constants.FUNC_FAILED_HEARTBEAT_MESSAGE)
skip_next_user_input=Trueelifheartbeat_request:
user_message=system.get_heartbeat(constants.REQ_HEARTBEAT_MESSAGE)
skip_next_user_input=Truereturnnew_messages, user_message, skip_next_user_inputdefsend_agent_a_message(agent, user_input, no_verify=False, allow_multi_step=True):
"""A convenience wrapper around the agent step, which: 1. Packages the first message correctly 2. Allows the agent to run back-to-back calls """# package the messageuser_message=system.package_user_message(user_input)
whileTrue:
try:
new_messages, user_message, skip_next_user_input=process_agent_step(agent, user_message, no_verify)
ifnotallow_multi_stepornotskip_next_user_input:
breakexceptKeyboardInterrupt:
print("User interrupt occured.")
input("Continue?")
exceptExceptionase:
print(f"An exception ocurred when running agent.step(): {e}")
### Main looppersona_desc=utils.get_persona_text("sam_pov.txt")
user_desc=utils.get_human_text("basic.txt")
# Create an AgentConfig option from the inputsagent_config=AgentConfig(
# name="agent_4",name="bill_gates",
persona=persona_desc,
human=user_desc,
preset="memgpt_chat",
model="gpt-4",
model_endpoint_type="openai",
model_endpoint="https://api.openai.com/v1",
context_window=8192,
)
Hi @cpacker just checking in to confirm will indeed be looking at this. Was quite busy over the weekend, but will be actively working on it over the next few days.
Is your feature request related to a problem? Please describe.
tl;dr support something similar to
openai.client
for python developersAdd a familiar python interface to the API server. In essence, instead of making python developers write REST/requests code or asking them to do this (taken from #689):
Allow developers to use a
client
that sits inside the package and is a light wrapper on top of the API server (https://github.com/cpacker/MemGPT/blob/main/memgpt/server/server.py):The text was updated successfully, but these errors were encountered: