fix: safely disable mem0 for non-OpenAI models
RA
3mo ago+10+10+01234567890123456789-0-0-0123456789
- Use getattr to safely check for model_name attribute, resolving Pylance type warnings.
- Automatically disable vector memory for non-OpenAI LLMs to prevent API key errors.
- Add assertion to ensure main_llm is initialized before agent creation.
Summary by cubic
Safely disables mem0 vector memory for non-OpenAI models and ensures the LLM is initialized before creating the agent. Prevents OpenAI API key errors and resolves type-check warnings.
- Bug Fixes
- Use getattr to read model_name safely, avoiding Pylance warnings.
- Detect non-OpenAI models using
llm_provider_namewhen available; disable vector memory and log a clear warning. - Assert main_llm is set before agent creation and pass the enable_memory flag to the agent.