在Azure webapp中搭建 基于chroma的 RAG agent
ChromaDB是一个向量数据库,可以用于RAG。
Agent基于chroma 1.3 和 python3.12 版本搭建,部署到Azure app function的webapp上。遇到连个问题,记录一下:
Opentelemetry报了一系列import问题
解决方案,在项目requirements.txt里加入了 azure-monitor-opentelemetry这个包
Azure webapp sqlite3版本过低
安装兼容的 SQLite 包
bash
pip install pysqlite3-binary在代码顶部添加以下重定向逻辑
python
__import__('pysqlite3') import sys sys.modules['sqlite3'] = sys.modules.pop('pysqlite3')这段代码会将 Python 的
sqlite3模块指向pysqlite3,从而使用你安装的版本而不是系统自带的。继续正常使用 Chroma
python
from chromadb import Client client = Client()
