crewAI icon indicating copy to clipboard operation
crewAI copied to clipboard

[BUG] Memory Rag Storage Issue

Open human058382928 opened this issue 1 year ago • 20 comments

Description

Started getting this error regarding rag with the latest version 0.83.0

Steps to Reproduce

Just using the default crew configuration with memory=True.

Expected behavior

no errors

Screenshots/Code snippets

    return Crew(
        agents=agents,
        tasks=tasks,
        manager_agent=create_manager_agent(),
        process=Process.sequential,
        memory=True,
        verbose=crewai_verbose,
        **kwargs
    )

Operating System

Ubuntu 20.04

Python Version

3.10

crewAI Version

0.83.0

crewAI Tools Version

0.14.0

Virtual Environment

Conda

Evidence

2024-11-27 10:42:36,152 - 13765931008 - rag_storage.py-rag_storage:118 - ERROR: Error during short_term search: APIStatusError.__init__() missing 2 required keyword-only arguments: 'response' and 'body'
2024-11-27 10:42:36,457 - 13765931008 - rag_storage.py-rag_storage:118 - ERROR: Error during entities search: APIStatusError.__init__() missing 2 required keyword-only arguments: 'response' and 'body'

Possible Solution

Not sure currently

Additional context

Nothing else

human058382928 avatar Nov 27 '24 18:11 human058382928

the same with memory based on Azure OpenAI:

embedder_config = {
    "provider": "azure",
    "config": {
        "api_key": os.getenv("AZURE_OPENAI_API_KEY"),
        "api_base": os.getenv("AZURE_OPENAI_ENDPOINT"),
        "api_version": os.getenv("AZURE_API_VERSION"),
        "model_name": os.getenv("AZURE_OPENAI_EMBEDDED_MODEL"),
        "deployment_id": os.getenv("AZURE_OPENAI_EMBEDDED_DEPLOYMENT"),
    }
}
crew = Crew(
...
embedder=embedder_config
...

error:

2024-11-27 23:46:04,920 - 17808 - rag_storage.py-rag_storage:89 - ERROR: Error during short_term save: APIStatusError.__init__() missing 2 required keyword-only arguments: 'response' and 'body'
2024-11-27 23:46:26,410 - 17808 - rag_storage.py-rag_storage:89 - ERROR: Error during entities save: APIStatusError.__init__() missing 2 required keyword-only arguments: 'response' and 'body'

voytas75 avatar Nov 27 '24 22:11 voytas75

Same issue..

khalidmaquilang avatar Nov 28 '24 21:11 khalidmaquilang

same issue.

SwordFaith avatar Nov 29 '24 12:11 SwordFaith

Same issue

mujtaba-dot-ai avatar Dec 04 '24 10:12 mujtaba-dot-ai

Same Issue

eidKhalaf avatar Dec 04 '24 10:12 eidKhalaf

the same with memory based on Azure OpenAI:

embedder_config = {
    "provider": "azure",
    "config": {
        "api_key": os.getenv("AZURE_OPENAI_API_KEY"),
        "api_base": os.getenv("AZURE_OPENAI_ENDPOINT"),
        "api_version": os.getenv("AZURE_API_VERSION"),
        "model_name": os.getenv("AZURE_OPENAI_EMBEDDED_MODEL"),
        "deployment_id": os.getenv("AZURE_OPENAI_EMBEDDED_DEPLOYMENT"),
    }
}
crew = Crew(
...
embedder=embedder_config
...

error:

2024-11-27 23:46:04,920 - 17808 - rag_storage.py-rag_storage:89 - ERROR: Error during short_term save: APIStatusError.__init__() missing 2 required keyword-only arguments: 'response' and 'body'
2024-11-27 23:46:26,410 - 17808 - rag_storage.py-rag_storage:89 - ERROR: Error during entities save: APIStatusError.__init__() missing 2 required keyword-only arguments: 'response' and 'body'

in my case i had to change embedder config to:

embedder_config = {
    "provider": "azure",
    "config": {
        "api_key": os.getenv("AZURE_OPENAI_API_KEY"),
        "api_base": os.getenv("AZURE_OPENAI_ENDPOINT"),
        "api_version": os.getenv("AZURE_API_VERSION"),
        "model_name": 'text-embedding-ada-002',
        "model": os.getenv("AZURE_OPENAI_EMBEDDED_DEPLOYMENT"),
    }
}

So deployment_id was changed to model - name of deployment made on Azure OpenAI.

voytas75 avatar Dec 05 '24 10:12 voytas75

same issue when use the knowledge~

neilzhangpro avatar Dec 18 '24 15:12 neilzhangpro

Same issue when setting memory=True for the Crew

zday123 avatar Dec 19 '24 18:12 zday123

same issue when setting memory=True for the Crew

arnaud0617 avatar Dec 21 '24 17:12 arnaud0617

no fix yet?

imrohankataria avatar Dec 22 '24 03:12 imrohankataria

same issue

xiaoxipanda avatar Dec 23 '24 07:12 xiaoxipanda

Same issue for me too. Anyone got any fix?

akshayb7 avatar Dec 26 '24 11:12 akshayb7

in my case i had to change config parameters as wrote here: https://github.com/crewAIInc/crewAI/issues/1669#issuecomment-2519951743 so, after my case ... check embedder_config

voytas75 avatar Dec 27 '24 18:12 voytas75

I have the same error with memory=True. crewai version 0.86.0 OS: Windows 11 pyhton: 3.12.6

@crew
  def crew(self) -> Crew:
      return Crew(
          agents=self.agents,
          tasks=self.tasks,
          #manager_llm=ChatOpenAI(temperature=0, model="gpt-4o-mini"),
          #process=Process.hierarchical,
          memory=True,
          verbose=True
      )
ERROR:root:Error during short_term save: APIStatusError.__init__() missing 2 required keyword-only arguments: 'response' and 'body'
ERROR:root:Error during entities save: APIStatusError.__init__() missing 2 required keyword-only arguments: 'response' and 'body'
ERROR:root:Error during entities save: APIStatusError.__init__() missing 2 required keyword-only arguments: 'response' and 'body'
ERROR:root:Error during entities save: APIStatusError.__init__() missing 2 required keyword-only arguments: 'response' and 'body'
ERROR:root:Error during short_term search: APIStatusError.__init__() missing 2 required keyword-only arguments: 'response' and 'body'
ERROR:root:Error during entities search: APIStatusError.__init__() missing 2 required keyword-only arguments: 'response' and 'body'

surakshith-suvarna avatar Dec 30 '24 13:12 surakshith-suvarna

Same issue, I have this very simple crew where I activate memory:

self.crew = Crew(
            agents=[self.csa],
            tasks=[self.task],
            verbose=True,
            memory=True
        )

Errors that I see during the processing:

ERROR:root:Error during short_term save: APIStatusError.__init__() missing 2 required keyword-only arguments: 'response' and 'body'
ERROR:root:Error during entities save: APIStatusError.__init__() missing 2 required keyword-only arguments: 'response' and 'body'
ERROR:root:Error during entities save: APIStatusError.__init__() missing 2 required keyword-only arguments: 'response' and 'body'
ERROR:root:Error during entities save: APIStatusError.__init__() missing 2 required keyword-only arguments: 'response' and 'body'

I use:

  • Python 3.12.8
  • Crewai 0.86.0

dumip avatar Jan 04 '25 17:01 dumip

Same issue for me as well

ag_storage.py-rag_storage:90 - ERROR: Error during short_term save: ClientError.__init__() missing 1 required positional argument: 'operation_name'

Yeswanth-gif avatar Jan 05 '25 07:01 Yeswanth-gif

I have tried the latest release 0.95.0, but have the same error as with previous versions 0.86.0

ERROR:root:Error during short_term search: APIStatusError.__init__() missing 2 required keyword-only arguments: 'response' and 'body'
ERROR:root:Error during entities search: APIStatusError.__init__() missing 2 required keyword-only arguments: 'response' and 'body'

surakshith-suvarna avatar Jan 06 '25 02:01 surakshith-suvarna

I have successfully resolved the issue I was encountering.

The resolution involved adding credits to my OpenAI account. Following this, both short-term and entity memory functionalities began to operate as expected.

I was aware Crewai memory, by default, used OpenAI embeddings. However, the documentation did not explicitly state the requirement of OpenAI credits for the memory feature to function correctly.

I am now able to observe data being populated within both my entity and short-term memory.

It would be beneficial if Crewai could return a low credit error more explicitly when this is the root cause of an issue.

surakshith-suvarna avatar Jan 07 '25 11:01 surakshith-suvarna

the same with memory based on Azure OpenAI:

embedder_config = {
    "provider": "azure",
    "config": {
        "api_key": os.getenv("AZURE_OPENAI_API_KEY"),
        "api_base": os.getenv("AZURE_OPENAI_ENDPOINT"),
        "api_version": os.getenv("AZURE_API_VERSION"),
        "model_name": os.getenv("AZURE_OPENAI_EMBEDDED_MODEL"),
        "deployment_id": os.getenv("AZURE_OPENAI_EMBEDDED_DEPLOYMENT"),
    }
}
crew = Crew(
...
embedder=embedder_config
...

error:

2024-11-27 23:46:04,920 - 17808 - rag_storage.py-rag_storage:89 - ERROR: Error during short_term save: APIStatusError.__init__() missing 2 required keyword-only arguments: 'response' and 'body'
2024-11-27 23:46:26,410 - 17808 - rag_storage.py-rag_storage:89 - ERROR: Error during entities save: APIStatusError.__init__() missing 2 required keyword-only arguments: 'response' and 'body'

hey, could you please tell me if it's resolved for you?

amanydv-asc avatar Jan 08 '25 12:01 amanydv-asc

the same with memory based on Azure OpenAI:

embedder_config = {
    "provider": "azure",
    "config": {
        "api_key": os.getenv("AZURE_OPENAI_API_KEY"),
        "api_base": os.getenv("AZURE_OPENAI_ENDPOINT"),
        "api_version": os.getenv("AZURE_API_VERSION"),
        "model_name": os.getenv("AZURE_OPENAI_EMBEDDED_MODEL"),
        "deployment_id": os.getenv("AZURE_OPENAI_EMBEDDED_DEPLOYMENT"),
    }
}
crew = Crew(
...
embedder=embedder_config
...

error:

2024-11-27 23:46:04,920 - 17808 - rag_storage.py-rag_storage:89 - ERROR: Error during short_term save: APIStatusError.__init__() missing 2 required keyword-only arguments: 'response' and 'body'
2024-11-27 23:46:26,410 - 17808 - rag_storage.py-rag_storage:89 - ERROR: Error during entities save: APIStatusError.__init__() missing 2 required keyword-only arguments: 'response' and 'body'

hey, could you please tell me if it's resolved for you?

change deployment_id for model as i wrote here: https://github.com/crewAIInc/crewAI/issues/1669#issuecomment-2519951743

voytas75 avatar Jan 08 '25 20:01 voytas75

I have the same error with memory=True.

akef-malomatia avatar Jan 15 '25 06:01 akef-malomatia

I have the same error but I am still getting an output completely fine but it might be missing something because the error is still within the output.

omarnahdi avatar Jan 17 '25 14:01 omarnahdi

@joaomdmoura @bhancockio I solved this annoying BUG and it took me around 12+ hrs to debug. You can close this issue

Note: this works for Ollama embedding model, so one can use ollama pull nomic-embed-text to pull the model or any other model to solve (RECOMMENDED)

The error was happening due to incorrect configuration of the embedder attribute in the Crew class, just change the model name as per your need just make sure not include any tag with it.

crew = Crew(
    agents=[sales_rep_agent,lead_sales_rep_agent],
    tasks=[lead_profiling_task,personalized_outreach_task],
    verbose=True,
    process=Process.sequential,
    memory=True,
    embedder={
        "provider": "ollama",
        "config": {
            "model": "nomic-embed-text"
        }
    }
)

For Google users, add the api_key attribute and change the model to models/text-embedding-004, note in between you still might face error like:

2025-01-19 00:10:58,441 - 20228 - rag_storage.py-rag_storage:109 - ERROR: Error during short_term save: 400 400 Request payload size exceeds the limit: 10000 bytes. in add.
2025-01-19 00:11:05,404 - 20228 - rag_storage.py-rag_storage:138 - ERROR: Error during short_term search: 400 400 Request payload size exceeds the limit: 10000 bytes. in query.
2025-01-19 00:11:06,654 - 20228 - rag_storage.py-rag_storage:138 - ERROR: Error during entities search: 400 400 Request payload size exceeds the limit: 10000 bytes. in query.

So it is recommended to use Ollama as an embedding provider(or openai). I highly RECOMMEND to use Ollama and ditch google's text-embedding-004 for embedding. I hope this issue will be closed and my comment will be pinned for beginners :)

PROOF of working:

Image

omarnahdi avatar Jan 18 '25 18:01 omarnahdi

@akef-malomatia @dumip @amanydv-asc @Yeswanth-gif @akshayb7 @xiaoxipanda Try my solution, it takes less than 5 minutes to install the ollama and the model :) and tell me if you face any trouble with this approach

omarnahdi avatar Jan 19 '25 10:01 omarnahdi

@joaomdmoura @bhancockio I solved this annoying BUG and it took me around 12+ hrs to debug. You can close this issue

Note: this works for Ollama embedding model, so one can use ollama pull nomic-embed-text to pull the model or any other model to solve (RECOMMENDED)

The error was happening due to incorrect configuration of the embedder attribute in the Crew class, just change the model name as per your need just make sure not include any tag with it.

crew = Crew( agents=[sales_rep_agent,lead_sales_rep_agent], tasks=[lead_profiling_task,personalized_outreach_task], verbose=True, process=Process.sequential, memory=True, embedder={ "provider": "ollama", "config": { "model": "nomic-embed-text" } } )

This worked beautifully. Thank you.

wolffy-au avatar Jan 20 '25 08:01 wolffy-au

anyone able to get it to work with bedrock embedding,

messeiry avatar Jan 21 '25 21:01 messeiry

@messeiry Right now the only solution is to use OpenAI embeddings or the one I did above

omarnahdi avatar Jan 22 '25 06:01 omarnahdi

HI @messeiry for bedrock you need the config like this

` @crew def crew(self) -> Crew: load_dotenv() """Creates the AiTroubleshooter crew"""

    session = boto3.Session( profile_name='default',
        region_name='us-west-2')

    return Crew(
        agents=self.agents, # Automatically created by the @agent decorator
        tasks=self.tasks, # Automatically created by the @task decorator
        # process=Process.hierarchical,
        process=Process.sequential,
        verbose=True,
        manager_agent=self.manager_agent(),
        output_log_file="./troubleshooting.log",
        embedder={
            'provider': 'bedrock',
            'config': {
                'model': 'amazon.titan-embed-text-v1',
                'vector_dimension': 1536,
                'session': session
            }
        }
    ) `

Yeswanth-gif avatar Jan 22 '25 12:01 Yeswanth-gif

Hey @Yeswanth-gif thanks for your reply, this error is gone now.

but after setting the session, this error showed up :)

ERROR:root:Error during short_term save: ClientError.__init__() missing 1 required positional argument: 'operation_name'

here is the session :

session = boto3.Session( profile_name='default', region_name='us-west-2', )

here is my code for the crew

` crew2 = Crew( agents=[finder, explainer], tasks=[find, explain], verbose=True, memory=True, #manager_agent=manager_llm, #process=Process.hierarchical, human_input=True, manager_callbacks=[CustomHandler("Crew Manager")], embedder={ 'provider': 'bedrock', 'config': { 'model': 'amazon.titan-embed-text-v2', 'vector_dimension': 1536, 'session': session } }

) `

messeiry avatar Jan 23 '25 00:01 messeiry

hello, I'm using azure open ai. How can i configure the embedder for azure? (llm: azure/gpt-4o)

pablomitiga avatar Jan 30 '25 08:01 pablomitiga