Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'LLMSinglePlan' object has no attribute 'related_message' #59

Open
ilmonati opened this issue May 18, 2023 · 8 comments
Open

'LLMSinglePlan' object has no attribute 'related_message' #59

ilmonati opened this issue May 18, 2023 · 8 comments

Comments

@ilmonati
Copy link

ilmonati commented May 18, 2023

I ran into this error:

[Rebecca] Act Starting to act on plan.
[Marty] Act Starting to act on plan.
[Ricardo] Observe Observed 0 new events since 22:43:22
[Rebecca] Observe Observed 1 new events since 22:43:12
[Marty] Observe Observed 0 new events since 22:43:25
Traceback (most recent call last):
  File "/usr/local/google/home/ilmo/Downloads/GPTeam/src/main.py", line 46, in run_world_async
    await world.run()
  File "/usr/local/google/home/ilmo/Downloads/GPTeam/src/world/base.py", line 113, in run
    await asyncio.gather(*tasks)
  File "/usr/local/google/home/ilmo/Downloads/GPTeam/src/world/base.py", line 101, in run_agent_loop
    await self.run_next_agent()
  File "/usr/local/google/home/ilmo/Downloads/GPTeam/src/world/base.py", line 96, in run_next_agent
    await agent.run_for_one_step()
  File "/usr/local/google/home/ilmo/Downloads/GPTeam/src/agent/base.py", line 1075, in run_for_one_step
    await self._do_first_plan()
  File "/usr/local/google/home/ilmo/Downloads/GPTeam/src/agent/base.py", line 976, in _do_first_plan
    await self._act(current_plan)
  File "/usr/local/google/home/ilmo/Downloads/GPTeam/src/agent/base.py", line 874, in _act
    if (plan.related_message):
AttributeError: 'LLMSinglePlan' object has no attribute 'related_message'

I believe changing src/agent/base.py (at line 873) will fix it:

        # Gather relevant memories
        try:
            memory_query = plan.related_message.get_event_message()
        except AttributeError:
            memory_query = plan.description
        	
        relevant_memories = await get_relevant_memories(
            memory_query,
            memories=self.memories,
            k=20,
        )
@ilmonati
Copy link
Author

Actually, if related_message gets set to None, same errors pop up elsewhere (e.g., line 888). It's probably worth solving the issue more robustly here (line 189):

            related_message = (
                AgentMessage.from_event(related_event, context)
                if related_event
                else None
            )

Could a string be used instead of None?

@ducatirob777
Copy link

I have experienced the same issue as @ilmonati

@mgunnin
Copy link

mgunnin commented May 23, 2023

Having the same problem.

@mgunnin
Copy link

mgunnin commented May 23, 2023

Ok, I believe this should fix the error.. I'm now receiving a new error but it runs much longer after I edited "src/agent/plans.py" and added the following on line 123

related_message: Optional[AgentMessage] = None

@MoHayat
Copy link

MoHayat commented May 31, 2023

@mgunnin is the new error something along the lines of this?

Traceback (most recent call last):
  File "/Users/mohayat/projects/GPTeam/.venv/lib/python3.11/site-packages/langchain/output_parsers/pydantic.py", line 26, in parse
    return self.pydantic_object.parse_obj(json_object)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "pydantic/main.py", line 526, in pydantic.main.BaseModel.parse_obj
  File "pydantic/main.py", line 341, in pydantic.main.BaseModel.__init__
pydantic.error_wrappers.ValidationError: 5 validation errors for LLMPlanResponse
plans -> 0 -> location_id
  value is not a valid uuid (type=type_error.uuid)
plans -> 1 -> location_id
  value is not a valid uuid (type=type_error.uuid)
plans -> 2 -> location_id
  value is not a valid uuid (type=type_error.uuid)
plans -> 3 -> location_id
  value is not a valid uuid (type=type_error.uuid)
plans -> 4 -> location_id
  value is not a valid uuid (type=type_error.uuid)

@walter-grace
Copy link

[Rebecca] Moved Location Conference Room -> Park @ 20:34:52
Traceback (most recent call last):
File "/Users/waltgrace/Downloads/GPTeam-main 2/.venv/lib/python3.11/site-packages/langchain/output_parsers/pydantic.py", line 25, in parse
json_object = json.loads(json_str)
^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/json/init.py", line 346, in loads
return _default_decoder.decode(s)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/waltgrace/Downloads/GPTeam-main 2/src/main.py", line 46, in run_world_async
await world.run()
File "/Users/waltgrace/Downloads/GPTeam-main 2/src/world/base.py", line 113, in run
await asyncio.gather(*tasks)
File "/Users/waltgrace/Downloads/GPTeam-main 2/src/world/base.py", line 101, in run_agent_loop
await self.run_next_agent()
File "/Users/waltgrace/Downloads/GPTeam-main 2/src/world/base.py", line 96, in run_next_agent
await agent.run_for_one_step()
File "/Users/waltgrace/Downloads/GPTeam-main 2/src/agent/base.py", line 1061, in run_for_one_step
self.react_response = await self._react(events)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/waltgrace/Downloads/GPTeam-main 2/src/agent/base.py", line 846, in _react
parsed_reaction_response: LLMReactionResponse = reaction_parser.parse(response)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/waltgrace/Downloads/GPTeam-main 2/.venv/lib/python3.11/site-packages/langchain/output_parsers/fix.py", line 38, in parse
parsed_completion = self.parser.parse(new_completion)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/waltgrace/Downloads/GPTeam-main 2/.venv/lib/python3.11/site-packages/langchain/output_parsers/pydantic.py", line 31, in parse
raise OutputParserException(msg)
langchain.schema.OutputParserException: Failed to parse LLMReactionResponse from completion Decision: continue

Thought process: "I should continue with my current plan because I haven't received any new information or messages that require my immediate attention. I will continue to be cautious and avoid getting caught by the authorities. I will keep my eyes and ears open for any potential deals or opportunities that come my way.". Got: Expecting value: line 1 column 1 (char 0)

Same error... Does this code not work anymore?

@MoHayat
Copy link

MoHayat commented Jun 2, 2023

There does seem to be a decoding issue if you let it run for long enough, might be a missing handler for a specific response from OpenAI

@Alec2435
Copy link
Contributor

Alec2435 commented Jun 3, 2023

This usually happens because gpt-3.5-turbo generates a bad output and whichever area this is coming from doesn't have sufficient retry logic. When running with gpt-4 this should be much more infrequent, although quite costly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants