run-llama / llama_index

LlamaIndex is a data framework for your LLM applications
https://docs.llamaindex.ai
MIT License
33.39k stars 4.67k forks source link

[Bug]: Getting deprecation message for Neo4jPropertyGraphStore #14093

Open rajib76 opened 3 weeks ago

rajib76 commented 3 weeks ago

Bug Description

getting the below deprecation message

Received notification from DBMS server: {severity: WARNING} {code: Neo.ClientNotification.Statement.FeatureDeprecationWarning} {category: DEPRECATION} {title: This feature is deprecated and will be removed in future versions.} {description: The procedure has a deprecated field. ('config' used by 'apoc.meta.graphSample' is deprecated.)} {position: line: 1, column: 1, offset: 0} for query: "CALL apoc.meta.graphSample() YIELD nodes, relationships RETURN nodes, [rel in relationships | {name:apoc.any.property(rel, 'type'), count: apoc.any.property(rel, 'count')}] AS relationships"

Version

latest

Steps to Reproduce

Run the below code `import os

from dotenv import load_dotenv from llama_index.core import SimpleDirectoryReader, PropertyGraphIndex from typing import Literal from llama_index.core.indices.property_graph import SchemaLLMPathExtractor from llama_index.graph_stores.neo4j import Neo4jPropertyGraphStore from llama_index.legacy.embeddings import HuggingFaceEmbedding from llama_index.llms.openai import OpenAI

load_dotenv() OPENAI_API_KEY = os.environ.get('OPENAI_API_KEY') NEO4J_URI = os.environ.get('NEO4J_URI') NEO4J_USERNAME = os.environ.get("NEO4J_USERNAME") NEO4J_PASSWORD = os.environ.get("NEO4J_PASSWORD") documents = SimpleDirectoryReader("/Users/joyeed/langmodel/langmodel/data").load_data()

best practice to use upper-case

entities = Literal["PERSON", "SKILL", "EMPLOYER","ADDRESS","PROFILE","PHONE"] relations = Literal["HAS", "PART_OF", "EMPLOYED","BELONGS_TO","WORKED_FOR","WORKED_FROM","WORKED_TILL"]

define which entities can have which relations

validation_schema = { "PERSON": ["HAS", "PART_OF","WORKED_FOR","WORKED_FROM","WORKED_TILL"], "ADDRESS":["BELONGS_TO"], "PROFILE":["HAS"], "PHONE":["BELONGS_TO"], "SKILL": ["HAS","BELONGS_TO"], "EMPLOYER": ["EMPLOYED"], }

kg_extractor = SchemaLLMPathExtractor( llm=OpenAI(), possible_entities=entities, possible_relations=relations, kg_validation_schema=validation_schema,

if false, allows for values outside of the schema

# useful for using the schema as a suggestion
strict=True,

) graph_store = Neo4jPropertyGraphStore( username=NEO4J_USERNAME, password=NEO4J_PASSWORD, url=NEO4J_URI, ) vec_store = None index = PropertyGraphIndex.from_documents( documents, kg_extractors=[kg_extractor], embed_model=HuggingFaceEmbedding(model_name="BAAI/bge-small-en-v1.5"), property_graph_store=graph_store, vector_store=vec_store, show_progress=True, )`

Relevant Logs/Tracbacks

No response

rajib76 commented 3 weeks ago

Also getting the below message. Does Llamaindex use langchain /Users/joyeed/langmodel/langmodel/venv/lib/python3.11/site-packages/langchain/_api/module_import.py:92: LangChainDeprecationWarning: Importing ChatMessageHistory from langchain.memory is deprecated. Please replace deprecated imports:

logan-markewich commented 3 weeks ago

LlamaIndex does not use langchain by default, but you can use langchain llms/embeddings with llamaindex.

(Just uninstall it if you aren't using it)

rajib76 commented 3 weeks ago

Thanks the fresh install removed the langchain deprecation error, but the NEO4J deprecation message is still there

rajib76 commented 3 weeks ago

Also noticed that lot of hallucination happening while creating the nodes using gpt-3.5. if I use GPT-4, it does not create any relation only nodes. I think the prompt may not be tuned