langchain icon indicating copy to clipboard operation
langchain copied to clipboard

Feature Request - Explicit Creation of Vector Index with Custom Embedding Configuration in Neo4j Graph DB

Open KaifAhmad1 opened this issue 1 year ago • 1 comments

Feature request

Explore these Neo4j resources for enhanced insights:

Indexes for Vector Search Query Tuning and Indexes Neo4j LangChain Vector Index Implementation

Hope you find them helpful!

Motivation

I am always frustrated when

from langchain.graphs import Neo4jGraph

graph = Neo4jGraph(
    url=os.environ["NEO4J_URI"],
    username=os.environ["NEO4J_USERNAME"],
    password=os.environ["NEO4J_PASSWORD"]
)
vector_index = Neo4jVector.from_existing_graph(
    HuggingFaceBgeEmbeddings(),
    url=os.environ["NEO4J_URI"],
    username=os.environ["NEO4J_USERNAME"],
    password=os.environ["NEO4J_PASSWORD"],
    index_name='New_index',
    node_label="Embeddable",
    text_node_properties=['definition', 'term', 'clause'],
    embedding_node_property='embedding',
)

The above code results in a TypeError:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
[<ipython-input-59-e24655343023>](https://localhost:8080/#) in <cell line: 1>()
----> 1 vector_index = Neo4jVector.from_existing_graph(
      2     HuggingFaceBgeEmbeddings(),
      3     url=os.environ["NEO4J_URI"],
      4     username=os.environ["NEO4J_USERNAME"],
      5     password=os.environ["NEO4J_PASSWORD"],

[/usr/local/lib/python3.10/dist-packages/langchain_community/vectorstores/neo4j_vector.py](https://localhost:8080/#) in from_existing_graph(cls, embedding, node_label, embedding_node_property, text_node_properties, keyword_index_name, index_name, search_type, retrieval_query, **kwargs)
    877                 + "} AS metadata, score"
    878             )
--> 879         store = cls(
    880             embedding=embedding,
    881             index_name=index_name,

TypeError: Neo4jVector.__init__() got an unexpected keyword argument 'embedding_dimension'

Your contribution

Eager to contribute! Ready to submit a pull request for this feature enhancement. Will ensure alignment with the project's guidelines by thoroughly reading the Contributing Guide. Open to guidance and collaboration.

Excited to contribute!

KaifAhmad1 avatar Jan 19 '24 13:01 KaifAhmad1

🤖

Excited to hear that you're eager to contribute to LangChain! Your proposed feature enhancement sounds promising, and your willingness to submit a pull request is greatly appreciated. Make sure to thoroughly read the Contributing Guide to ensure alignment with the project's guidelines. If you have any questions or need guidance during the process, feel free to ask for help in the project's communication channels. Looking forward to seeing your contribution!


This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

If you want to continue the conversation, start your reply with @dosu-bot.

dosubot[bot] avatar Jan 19 '24 13:01 dosubot[bot]