Coder Social home page Coder Social logo

tomasonjo / langchain2neo4j Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ibiscp/llm-imdb

253.0 5.0 35.0 25.19 MB

Integrating Neo4j database into langchain ecosystem

Home Page: https://towardsdatascience.com/integrating-neo4j-into-the-langchain-ecosystem-df0e988344d2

JavaScript 18.73% Python 51.33% CSS 11.84% HTML 4.94% Dockerfile 2.84% Shell 1.01% Jupyter Notebook 9.32%
chatbot chatgpt gpt-3 gpt-4 langchain langchain-python neo4j nlp

langchain2neo4j's Introduction

Langchain2Neo4j

Cypher search is now part of the official LangChain library, learn more in: https://towardsdatascience.com/langchain-has-added-cypher-search-cb9d821120d5

LangchainNeo4j Demo

The Langchain2Neo4j is a proof of concept application of how to integrate Neo4j into the Langchain ecosystem. This project took heavy inspiration from IMDB-LLM. The IMDB-LLM integrated graph search using networkx library into langchain ecosystem. I borrowed the idea and changed the project to use Neo4j as the source of information for the LLM.

The project now supports three modes of context search:

  • Generating Cypher statements to query the database
  • Full-text search of relevant entities
  • Vector similarity search

Learn more: https://towardsdatascience.com/integrating-neo4j-into-the-langchain-ecosystem-df0e988344d2

Neo4j database

The project uses the Recommendation project that is available as part of the Neo4j Sandbox. If you want a local instance of Neo4j, you can restore a database dump that is available here.

Installation and Setup

  1. Create a .env file and fill-in the environment variables as shown in the env.example

  2. You need to create a full text index and import the movie embeddings:

sh seed_db.sh

If you are using Windows, you can also execute the code in data/database_seed.ipynb notebook to seed the database.

  1. Run the project using docker-compose
docker-compose up
  1. Open the application in your browser at http://localhost:3000

Example questions

# Who played in Top Gun?
MATCH (m:Movie)<-[r:ACTED_IN]-(a)
RETURN {{actor: a.name, role: r.role}} AS result
# What is the plot of the Copycat movie?
MATCH (m:Movie {{title: "Copycat"}})
RETURN {{plot: m.plot}} AS result
# Did Luis Guzmán appear in any other movies?
MATCH (p:Person {{name:"Luis Guzmán"}})-[r:ACTED_IN]->(movie)
RETURN {{movie: movie.title, role: r.role}} AS result
# Do you know of any matrix movies?
MATCH (m:Movie)
WHERE toLower(m.title) CONTAINS toLower("matrix")
RETURN {{movie:m.title}} AS result

langchain2neo4j's People

Contributors

ibiscp avatar tomasonjo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.