模型用的是text-embedding-ada-002,这个问题依然存在,请问老师有什么思路吗?有没有可能是软件包的版本问题?
代码如下:
@app.post("/add_urls")
def add_urls(URL:str):
loader = WebBaseLoader(URL)
docs = loader.load()
docments = RecursiveCharacterTextSplitter(
chunk_size=800,
chunk_overlap=50,
).split_documents(docs)
#引入向量数据库
qdrant = Qdrant.from_documents(
docments,
OpenAIEmbeddings(model=“text-embedding-ada-002”),
path="./local_qdrand",
collection_name=“yunshi_2024”,
)
print(“向量数据库创建完成”)
return {“ok”: “添加成功!”}
报错如下(截取了有用信息):
File “server.py”, line 218, in add_urls
qdrant = Qdrant.from_documents(
File “/home/ubuntu/.local/lib/python3.8/site-packages/langchain_core/vectorstores.py”, line 635, in from_documents
return cls.from_texts(texts, embedding, metadatas=metadatas, **kwargs)
File “/home/ubuntu/.local/lib/python3.8/site-packages/langchain_community/vectorstores/qdrant.py”, line 1339, in from_texts
qdrant = cls.construct_instance(
File “/home/ubuntu/.local/lib/python3.8/site-packages/langchain_community/vectorstores/qdrant.py”, line 1645, in construct_instance
client, async_client = cls._generate_clients(
File “/home/ubuntu/.local/lib/python3.8/site-packages/langchain_community/vectorstores/qdrant.py”, line 2250, in _generate_clients
sync_client = QdrantClient(
File “/home/ubuntu/.local/lib/python3.8/site-packages/qdrant_client/qdrant_client.py”, line 117, in init
self._client = QdrantLocal(
File “/home/ubuntu/.local/lib/python3.8/site-packages/qdrant_client/local/qdrant_local.py”, line 60, in init
self._load()
File “/home/ubuntu/.local/lib/python3.8/site-packages/qdrant_client/local/qdrant_local.py”, line 100, in _load
self.collections[collection_name] = LocalCollection(
File “/home/ubuntu/.local/lib/python3.8/site-packages/qdrant_client/local/local_collection.py”, line 130, in init
self.load_vectors()
File “/home/ubuntu/.local/lib/python3.8/site-packages/qdrant_client/local/local_collection.py”, line 142, in load_vectors
for idx, point in enumerate(self.storage.load()):
File “/home/ubuntu/.local/lib/python3.8/site-packages/qdrant_client/local/persistence.py”, line 152, in load
yield pickle.loads(row[0])
File “/home/ubuntu/.local/lib/python3.8/site-packages/pydantic/main.py”, line 816, in setstate
_object_setattr(self, ‘pydantic_fields_set’, state[‘pydantic_fields_set’])
KeyError: ‘pydantic_fields_set’