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

fix(client): new_memories_with_actions maybe a list or a dict #2093

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

outyua
Copy link

@outyua outyua commented Dec 17, 2024

Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change.

Fixes # (issue)

new_memories_with_actions variable in Memory._add_to_vector_store returns a list or a dict, when it returns a list, for resp in new_memories_with_actions["memory"]: block will report an error: ERROR:root:Error in new_memories_with_actions: list indices must be integers or slices, not str

some contexts:

I use qwen-turbo as LLM, and a custom openai_base_url: https://dashscope.aliyuncs.com/compatible-mode/v1

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

Please delete options that are not relevant.

  • Test Script (please provide)
message = "I want to eat an apple"
client.add(
    messages=message,
    user_id="user1",
    agent_id="agent1",
)

# until now is correct

message = "I want to eat an apple"
client.add(
    messages=message,
    user_id="user1",
    agent_id="agent1",
)

# expect to add a memory or update the above memory
# but it reports the error, and no memory changes
# debug in `_add_to_vector_store`, the variable `new_memories_with_actions` is a list, so the error occurs

BTW:
There has another way to fix is to change the prompt, maybe that will be a better patch

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules
  • I have checked my code and corrected any misspellings

Maintainer Checklist

  • Made sure Checks passed

@CLAassistant
Copy link

CLAassistant commented Dec 17, 2024

CLA assistant check
All committers have signed the CLA.

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

Successfully merging this pull request may close these issues.

2 participants