快速结论:这个报错通常出现在运行 AutoGen 的 notebook/agentchat_qdrant_RetrieveChat.ipynb 示例时,FastEmbed 缓存的模型文件下载不完整,导致 Qdrant 检索组件找不到 model.onnx 或 model_optimized.onnx。优先排查 FastEmbed 版本和缓存目录。
适用环境:Issue 中确认的环境包括:AutoGen(pyautogen)、Python 3.12.2、macOS 本机环境(非 Docker),以及后来在 EC2 上复现的部分现象。使用的模型为 gpt-3.5-turbo,依赖包含 qdrant_client[fastembed] 和 fastembed。
最快修复方案:按照 Issue 中维护者的建议,将 FastEmbed 更新到最新版本,例如执行 pip install fastembed==0.2.2;同时在代码中改为 ragproxyagent.initiate_chat(assistant, problem=qa_problem),避免 message_generator 属性报错。完整修复需要升级到 pyautogen v0.2.19 或更高版本。
注意事项:如果本地已经安装 FastEmbed 且提示“Requirement already satisfied”,需要确认实际生效的版本;缓存目录中残留的损坏文件可能需要清理后重新下载。该问题在 pyautogen v0.2.19 发布后已被确认修复。
问题场景
用户在运行 AutoGen 仓库中的 notebook/agentchat_qdrant_RetrieveChat.ipynb 示例时触发问题。用户创建了新的虚拟环境,并按照 notebook 说明安装了 pyautogen[retrievechat]>=0.2.3、flaml[automl] 和 qdrant_client[fastembed],随后在 Qdrant 检索对话流程中遇到报错。
报错原文
AttributeError: 'QdrantRetrieveUserProxyAgent' object has no attribute 'message_generator'
Trying to create collection.
Traceback (most recent call last):
...
locate_model_file
raise ValueError(f"Could not find either of {', '.join(file_names)} in {model_dir}")
ValueError: Could not find either of model.onnx, model_optimized.onnx in /var/folders/zn/0_np64n96r50prt1m5mlm7fr0000gn/T/fastembed_cache/fast-bge-small-en
原因分析
可能原因有两个:
第一,message_generator 属性报错来自 AutoGen 的 API 变更,notebook 中的写法与当前安装的 pyautogen 版本不匹配。Issue 中维护者指出需要发布新版本才能让该 notebook 正常工作。
第二,ValueError: Could not find either of model.onnx, model_optimized.onnx in .../fastembed_cache/fast-bge-small-en 是 FastEmbed 在下载模型文件时中断或缓存不完整导致的。维护者 Anush008 明确说明该错误由下载中断引起,最新版 FastEmbed 已处理该问题。
环境排查
- 确认 Python 版本,Issue 中复现环境为 Python 3.12.2。
- 确认 pyautogen 版本,至少需要 v0.2.19 才能匹配修复后的 notebook 写法。
- 确认 FastEmbed 版本,建议不低于 0.2.2。
- 确认
qdrant_client[fastembed]是否正常安装。 - 确认 FastEmbed 缓存目录,macOS 下示例路径为
/var/folders/zn/0_np64n96r50prt1m5mlm7fr0000gn/T/fastembed_cache/fast-bge-small-en,检查该目录下是否存在model.onnx或model_optimized.onnx。 - 确认运行环境是否为全新虚拟环境,避免旧版本依赖残留。
解决步骤
- 升级 FastEmbed 到 Issue 中提到的版本:
pip install fastembed==0.2.2。如果提示Requirement already satisfied,请先确认当前实际版本,必要时在全新虚拟环境中安装。 - 如果 FastEmbed 缓存目录中已有不完整的模型文件,可先清理该缓存目录,再重新运行,让 FastEmbed 重新下载模型。
- 将 notebook 中的
ragproxyagent.initiate_chat(assistant, message=ragproxyagent.message_generator, problem=qa_problem)改为ragproxyagent.initiate_chat(assistant, problem=qa_problem),以绕过message_generator属性报错。 - 升级 pyautogen 到 v0.2.19 或更高版本。Issue 中维护者明确说明最新 pyautogen 版本 v0.2.19 应可正常工作。
- 在全新虚拟环境中重新安装 notebook 所需依赖,然后重新运行完整流程。
验证方法
重新运行 agentchat_qdrant_RetrieveChat.ipynb notebook,确认不再出现 message_generator 属性错误,且 FastEmbed 能够成功定位模型文件并完成 Qdrant 集合创建与检索流程。Issue 中用户最终在 Mac 上测试最新 notebook,确认一切正常运行。
参考来源
AI 工具推荐
想把多个 AI 模型放在一个入口?
GamsGo AI 集成 ChatGPT、DeepSeek、Gemini、Claude、Midjourney、Veo 等常用模型,适合写作、绘图、视频和日常 AI 工作流。
推广链接:通过此链接购买,我可能获得佣金,不影响你的价格。
这个方案解决了吗?
可以继续搜索完整报错,或查看同一工具的其他排查指南。


