Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
5 tasks done
KOBEBRYANTand opened this issue Nov 18, 2024 · 1 comment
Labels
🤖:bug Related to a bug, vulnerability, unexpected error with an existing feature

Comments

@KOBEBRYANTand
Copy link

Checked other resources

  • I added a very descriptive title to this issue.
  • I searched the LangChain documentation with the integrated search.
  • I used the GitHub search to find a similar question and didn't find it.
  • I am sure that this is a bug in LangChain rather than my code.
  • The bug is not resolved by updating to the latest stable version of LangChain (or the specific integration package).

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

@KOBEBRYANTand
Copy link
Author

Is isuue with the llm?

@dosubot dosubot bot added the 🤖:bug Related to a bug, vulnerability, unexpected error with an existing feature label Nov 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤖:bug Related to a bug, vulnerability, unexpected error with an existing feature
Projects
None yet
Development

No branches or pull requests

1 participant