Open davidkundrats opened 1 month ago
我也遇到了相同的问题
@DimonHo hi i just pushed a bandaid fix to a fork on my profile here
this does not work with the dev portal and i am looking into it now. it should work via the CLI however. hopefully i can resolve without having to change the dev portal code since i think its compiled, and i am not sure if the source is publicly available
@DimonHo actually you may need to just implement the lines i wrote as it seems the docker image / memgpt module installed via pip is behind this repo. the relevant lines are here in agent.py:
raw_function_args = function_call.arguments
function_args = parse_json(raw_function_args)
if "inner_thoughts" in function_args:
response_message.content = function_args.pop("inner_thoughts")
then, in memgpt/llm_api/azure, you will have to implement the logic from my commit regarding the azure openai formatting
Describe the bug A clear and concise description of what the bug is.
Upon hitting enter to send first message, a runtime error occurs when a dictionary tries calling the method "to_openai_dict()".
I am using Azure OpenAI for my LLM (embedding and chat completion).
Stack trace here: An exception occurred when running agent.step(): Traceback (most recent call last): File "/home/david/Work/Memgpt/MemGPT/venv/lib/python3.10/site-packages/memgpt/main.py", line 459, in run_agent_loop new_messages, user_message, skip_next_user_input = process_agent_step(user_message, no_verify) File "/home/david/Work/Memgpt/MemGPT/venv/lib/python3.10/site-packages/memgpt/main.py", line 427, in process_agent_step new_messages, heartbeat_request, function_failed, token_warning, tokens_accumulated = memgpt_agent.step( File "/home/david/Work/Memgpt/MemGPT/venv/lib/python3.10/site-packages/memgpt/agent.py", line 800, in step raise e File "/home/david/Work/Memgpt/MemGPT/venv/lib/python3.10/site-packages/memgpt/agent.py", line 698, in step response = self._get_ai_reply( File "/home/david/Work/Memgpt/MemGPT/venv/lib/python3.10/site-packages/memgpt/agent.py", line 409, in _get_ai_reply raise e File "/home/david/Work/Memgpt/MemGPT/venv/lib/python3.10/site-packages/memgpt/agent.py", line 378, in _get_ai_reply response = create( File "/home/david/Work/Memgpt/MemGPT/venv/lib/python3.10/site-packages/memgpt/llm_api/llm_api_tools.py", line 223, in wrapper raise e File "/home/david/Work/Memgpt/MemGPT/venv/lib/python3.10/site-packages/memgpt/llm_api/llm_api_tools.py", line 196, in wrapper return func(*args, **kwargs) File "/home/david/Work/Memgpt/MemGPT/venv/lib/python3.10/site-packages/memgpt/llm_api/llm_api_tools.py", line 370, in create return azure_openai_chat_completions_request( File "/home/david/Work/Memgpt/MemGPT/venv/lib/python3.10/site-packages/memgpt/llm_api/azure_openai.py", line 122, in azure_openai_chat_completions_request raise e File "/home/david/Work/Memgpt/MemGPT/venv/lib/python3.10/site-packages/memgpt/llm_api/azure_openai.py", line 100, in azure_openai_chat_completions_request data["messages"] = [i.to_openai_dict() for i in data["messages"]] File "/home/david/Work/Memgpt/MemGPT/venv/lib/python3.10/site-packages/memgpt/llm_api/azure_openai.py", line 100, in
data["messages"] = [i.to_openai_dict() for i in data["messages"]]
AttributeError: 'dict' object has no attribute 'to_openai_dict'
Please describe your setup
pip install pymemgpt
? `memgpt
? (Terminal)Screenshots If applicable, add screenshots to help explain your problem.
Additional context Add any other context about the problem here. I had tried fixing this error by replacing 'to_openai_dict()' and received the following error: 400 Client Error: model error for URL my endpoint url
MemGPT Config Please attach your
~/.memgpt/config
file or copy past it below.[defaults] preset = memgpt_chat persona = sam_pov human = basic
[model] model = gpt-4 model_endpoint = my endpoint model_endpoint_type = azure context_window = 8192
[embedding] embedding_endpoint_type = azure embedding_endpoint = my endpoint embedding_model = text-embedding-ada-002 embedding_dim = 1536 embedding_chunk_size = 300
[archival_storage] type = chroma path = /home/david/.memgpt/chroma uri = localhost:8000
[recall_storage] type = sqlite path = /home/david/.memgpt uri =
[metadata_storage] type = sqlite path = /home/david/.memgpt uri =
[version] memgpt_version = 0.3.24
[client] anon_clientid = 00000000-0000-0000-0000-000000000000