# Failed to convert text into a pydantic model in latest package when only memory=True

**URL:** <https://community.crewai.com/t/failed-to-convert-text-into-a-pydantic-model-in-latest-package-when-only-memory-true/3451>\
**Category:** CrewAI Community Support\
**Created:** [February 2, 2025, 8:56am UTC](https://community.crewai.com/t/failed-to-convert-text-into-a-pydantic-model-in-latest-package-when-only-memory-true/3451 "2025-02-02T08:56:46Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kxusjsjaia](https://sea1.discourse-cdn.com/flex025/user_avatar/community.crewai.com/kxusjsjaia/32/2375_2.png) [@kxusjsjaia](https://community.crewai.com/u/kxusjsjaia)\
**Post date:** [February 2, 2025, 8:56am UTC](https://community.crewai.com/t/failed-to-convert-text-into-a-pydantic-model-in-latest-package-when-only-memory-true/3451/1 "2025-02-02T08:56:46Z")

</div>

I am struggling with exactly same error posted here: [Failed to convert text into a Pydantic model due to the following error: litellm.APIConnectionError: 'name'](https://community.crewai.com/t/failed-to-convert-text-into-a-pydantic-model-due-to-the-following-error-litellm-apiconnectionerror-name/1629).

Actually, it didn’t raise the exact reason of error like ‘LiteLLM.Info: If you need to debug this error, use `litellm.set\_verbose=True’, so I just debugged manually for four hours and found the reason.

Via Ollama docker, I am using

```
ollama_model = LLM(
    base_url='http://ollama:11434'
    api_key='ollama',
    model="ollama/deepseek-r1:14b"
)

```

When I set memory=False for Crew, it perfectly works.

```
crew = Crew(
  agents=[support_agent, support_quality_assurance_agent],
  tasks=[inquiry_resolution, quality_assurance_review],
  verbose=True
)

```

The problem occurs when only I set memory=True (and then kickoff):

```
crew = Crew(
  agents=[support_agent, support_quality_assurance_agent],
  tasks=[inquiry_resolution, quality_assurance_review],
  verbose=True,
  memory=True, 
  embedder={ "provider": "ollama", "config": {"model": 'deepseek-r1:14b', "url":"http://ollama:11434/api/embeddings"} }
)

```

As the image below, you can observe that format of function\_call in some cases (as I guess, dealing with memory) is different from that in normal case. That’s why the function\_call causes the error that says ‘we don’t have key ‘name’!’ How can I resolve this bug??

 ![image](https://us1.discourse-cdn.com/flex025/uploads/crewai/original/2X/2/220451f0cee00b814dc398796fc52b0dcf120887.png)

---

<div class="post-metadata">

**Author:** ![kxusjsjaia](https://sea1.discourse-cdn.com/flex025/user_avatar/community.crewai.com/kxusjsjaia/32/2375_2.png) [@kxusjsjaia](https://community.crewai.com/u/kxusjsjaia)\
**Post date:** [February 2, 2025, 10:11am UTC](https://community.crewai.com/t/failed-to-convert-text-into-a-pydantic-model-in-latest-package-when-only-memory-true/3451/2 "2025-02-02T10:11:15Z")

</div>

Temporary solution

```
if request_data.get("format", "") == "json":
            function_call = json.loads(response_json["response"])
            if function_call.get('name') is None:
                function_call = {'name': list(function_call.keys())[0], 'arguments': function_call[list(function_call.keys())[0]]}

```

---

<div class="post-metadata">

**Author:** ![pedrosimao](https://sea1.discourse-cdn.com/flex025/user_avatar/community.crewai.com/pedrosimao/32/2621_2.png) [@pedrosimao](https://community.crewai.com/u/pedrosimao)\
**Post date:** [February 17, 2025, 2:02pm UTC](https://community.crewai.com/t/failed-to-convert-text-into-a-pydantic-model-in-latest-package-when-only-memory-true/3451/3 "2025-02-17T14:02:19Z")

</div>

Where do you implement this solution?  
I am facing the same issue…
