According to the official example, when creating a knowledge graph using the local large model glm-4-9b-chat, the generated nodes and relationships in the graph are empty. #28182
Labels
🤖:bug
Related to a bug, vulnerability, unexpected error with an existing feature
Checked other resources
Example Code
code:
from langchain_core.prompts import PromptTemplate
from langchain_openai import ChatOpenAI
from langchain.schema import HumanMessage
import os
from langchain_experimental.graph_transformers import LLMGraphTransformer
from langchain_core.documents import Document
from langchain_community.graphs import Neo4jGraph
初始化模型
llm = ChatOpenAI(
streaming=True,
verbose=True,
openai_api_key="none", # 根据实际情况配置
openai_api_base="http://192.168.3.188:8080/v1", # 根据实际情况配置
model_name="glm-4-9b-chat",
)
os.environ["NEO4J_URI"] = "bolt://192.168.3.188:7687"
os.environ["NEO4J_USERNAME"] = "neo4j"
os.environ["NEO4J_PASSWORD"] = "123456"
graph = Neo4jGraph()
llm_transformer = LLMGraphTransformer(llm=llm)
from langchain_core.documents import Document
text = """
Marie Curie, born in 1867, was a Polish and naturalised-French physicist and chemist who conducted pioneering research on radioactivity.
She was the first woman to win a Nobel Prize, the first person to win a Nobel Prize twice, and the only person to win a Nobel Prize in two scientific fields.
Her husband, Pierre Curie, was a co-winner of her first Nobel Prize, making them the first-ever married couple to win the Nobel Prize and launching the Curie family legacy of five Nobel Prizes.
She was, in 1906, the first woman to become a professor at the University of Paris.
"""
documents = [Document(page_content=text)]
graph_documents = llm_transformer.convert_to_graph_documents(documents)
print(f"Nodes:{graph_documents[0].nodes}")
print(f"Relationships:{graph_documents[0].relationships}")
response:
Nodes:[]
Relationships:[]
Error Message and Stack Trace (if applicable)
1
Description
help me! According to the official example, when creating a knowledge graph using the local large model glm-4-9b-chat, the generated nodes and relationships in the graph are empty.
System Info
11
The text was updated successfully, but these errors were encountered: