Skip to content

AzureOpenAIStructuredLLM missing _parse_response method #4164

@trinanjan12

Description

@trinanjan12

🐛 Describe the bug

Description
AzureOpenAIStructuredLLM in mem0/llms/azure_openai_structured.py calls self._parse_response(response, tools) on line 91 of generate_response(), but the method is never defined in the class or in LLMBase.

This causes AttributeError: 'AzureOpenAIStructuredLLM' object has no attribute '_parse_response' every time generate_response() is called.

Steps to reproduce
python
from mem0.configs.llms.azure import AzureOpenAIConfig
from mem0.llms.azure_openai_structured import AzureOpenAIStructuredLLM

config = AzureOpenAIConfig(model="gpt-4o", azure_kwargs={...})
llm = AzureOpenAIStructuredLLM(config=config)
llm.generate_response(messages=[{"role": "user", "content": "hello"}])

Expected behavior
Should return the LLM response.

Actual behavior
AttributeError: 'AzureOpenAIStructuredLLM' object has no attribute '_parse_response'

Note
AzureOpenAILLM in azure_openai.py has _parse_response defined correctly. It appears to have been missed when creating the structured variant.

Additional issue
There's also a duplicate if tools: block in generate_response() (lines 84-88)

Raise a PR #4165

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions