当前位置: 首页 > news >正文

使用ollama取代openai的api进行graphRAG失败记录

pip install ollama

pip install langchain_ollama

graph_documents = llm_transformer.convert_to_graph_documents(split_documents)
print(graph_documents)

偶尔会成功,但是大部分是失败的:

报错记录如下,暂时没想到好的办法:

---------------------------------------------------------------------------
ValidationError                           Traceback (most recent call last)
Cell In[64], line 21 # Transform documents to graph documents
----> 2 graph_documents = llm_transformer.convert_to_graph_documents(split_documents)3 print(graph_documents)File D:\anaconda3\envs\graphRAG\lib\site-packages\langchain_experimental\graph_transformers\llm.py:762, in LLMGraphTransformer.convert_to_graph_documents(self, documents)750 def convert_to_graph_documents(751     self, documents: Sequence[Document]752 ) -> List[GraphDocument]:753     """Convert a sequence of documents into graph documents.754 755     Args:(...)760         Sequence[GraphDocument]: The transformed documents as graphs.761     """
--> 762     return [self.process_response(document) for document in documents]File D:\anaconda3\envs\graphRAG\lib\site-packages\langchain_experimental\graph_transformers\llm.py:762, in <listcomp>(.0)750 def convert_to_graph_documents(751     self, documents: Sequence[Document]752 ) -> List[GraphDocument]:753     """Convert a sequence of documents into graph documents.754 755     Args:(...)760         Sequence[GraphDocument]: The transformed documents as graphs.761     """
--> 762     return [self.process_response(document) for document in documents]File D:\anaconda3\envs\graphRAG\lib\site-packages\langchain_experimental\graph_transformers\llm.py:718, in LLMGraphTransformer.process_response(self, document)715     nodes_set.add((rel["tail"], rel["tail_type"]))717     source_node = Node(id=rel["head"], type=rel["head_type"])
--> 718     target_node = Node(id=rel["tail"], type=rel["tail_type"])719     relationships.append(720         Relationship(721             source=source_node, target=target_node, type=rel["relation"]722         )723     )724 # Create nodes listFile D:\anaconda3\envs\graphRAG\lib\site-packages\pydantic\v1\main.py:341, in BaseModel.__init__(__pydantic_self__, **data)339 values, fields_set, validation_error = validate_model(__pydantic_self__.__class__, data)340 if validation_error:
--> 341     raise validation_error342 try:343     object_setattr(__pydantic_self__, '__dict__', values)ValidationError: 2 validation errors for Node
idnone is not an allowed value (type=type_error.none.not_allowed)
typenone is not an allowed value (type=type_error.none.not_allowed)

http://www.lryc.cn/news/420299.html

相关文章:

  • MyBatis 配置与测试方式
  • C#实现代理服务器
  • react的路由实战使用
  • python 字典转成类 构建类
  • springboot 过滤器
  • 【C语言篇】深入理解指针1
  • IAP程序升级 与 电脑BIOS 的关系
  • Java使用MQTT协议
  • 等级+时间的优先级算法
  • 物流仓库安全视频智能管理方案:构建全方位、高效能的防护体系
  • jackson反序列化漏洞
  • Java | Leetcode Java题解之第328题奇偶链表
  • 100 Exercises To Learn Rust 挑战!准备篇
  • 瑞_RabbitMQ_初识MQ
  • 系统内存管理:虚拟内存、内存分段与分页、页表缓存TLB以及Linux内存管理
  • Java每日一练_模拟面试题5(堆和栈的区别)
  • 传感器校正和测试
  • Eclipse 悬浮提示:提高编程效率的利器
  • Vault系列之:创建令牌
  • 如何在 Windows 10 环境下安装和配置 MySQL:初学者指南
  • Ubuntu 24.04上报:Error: could not connect to ollama app, is it running?的解决方法
  • 字典树查重(到底要开多大的空间啊)
  • 财务会计与管理会计(二)
  • 技术周总结 08.05-08.11周日
  • B树和B+树的插入、删除
  • Axios网络请求总结
  • 立仪科技光谱共焦应用之金属隔膜静态重复性测量
  • vue3实现video视频+弹幕评论
  • STM32-OTA升级
  • 一种JSON多态表示法