You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In a project with Neo4J and Langchain, I'm unable to see any difference with the "additional_instructions" parameter to the LLMGraphTransformer as I want to pass in new info to the LLM when generating the graph documents for the Neo4J database. I tested it with simple instructions but it looks like it isn't doing anything.
I'm wondering if it's no longer supported or if I'm setting something up wrong.
Imports:
from langchain_experimental.graph_transformers import LLMGraphTransformer
from langchain_openai import ChatOpenAI
Simple instruction I want to add in
llm = ChatOpenAI(temperature=0, model_name="gpt-3.5-turbo")
graph_transformer_prompt = """
When creating nodes, capitalize the id.
For instance Apple becomes APPLE.
"""
llm_transformer = LLMGraphTransformer(llm=llm, additional_instructions=graph_transformer_prompt)
Converting a document into graph documents
from langchain_core.documents import Document
with open('apple_document.txt', 'r') as file:
text = file.read()
doc = [Document(page_content=text)]
graph_doc = await llm_transformer.aconvert_to_graph_documents(doc)
graph.add_graph_documents(graph_doc, include_source=True, baseEntityLabel=True)
print(graph_doc)
Output:
[GraphDocument(nodes=[Node(id='Bananas', type='Fruit', properties={}), Node(id='Apples', type='Code word', properties={}), Node(id='Red Trucks', type='Code word', properties={})], relationships=[Relationship(source=Node(id='Bananas', type='Fruit', properties={}), target=Node(id='Apples', type='Code word', properties={}), type='CODE_WORD_FOR', properties={}), Relationship(source=Node(id='Apples', type='Code word', properties={}), target=Node(id='Red Trucks', type='Code word', properties={}), type='CODE_WORD_FOR', properties={})], source=Document(metadata={'id': '83b84d36a24f3f060e3107fa7bc0d748'}, page_content='Bananas are bright yellow fruits.\nApples in this context are a code word for Red trucks.'))]
As it is visible it isn't capitalizing the nodes.
I'm wondering if I'm setting it up wrong, thank you!
The text was updated successfully, but these errors were encountered:
Hi there,
In a project with Neo4J and Langchain, I'm unable to see any difference with the "additional_instructions" parameter to the LLMGraphTransformer as I want to pass in new info to the LLM when generating the graph documents for the Neo4J database. I tested it with simple instructions but it looks like it isn't doing anything.
I'm wondering if it's no longer supported or if I'm setting something up wrong.
Imports:
Simple instruction I want to add in
Converting a document into graph documents
Output:
As it is visible it isn't capitalizing the nodes.
I'm wondering if I'm setting it up wrong, thank you!
The text was updated successfully, but these errors were encountered: