Code Monkey home page Code Monkey logo

llm-movieagent's Introduction

llm-movieagent

This project is designed to implement an agent capable of interacting with a graph database like Neo4j through a semantic layer using OpenAI function calling. The semantic layer equips the agent with a suite of robust tools, allowing it to interact with the graph database based on the user's intent. Read more in the blog post.

Workflow diagram

To start the project, run the following command:

docker-compose up

Open http://localhost:8501 in your browser to interact with the agent.

Tools

The agent utilizes several tools to interact with the Neo4j graph database effectively:

  1. Information tool:
    • Retrieves data about movies or individuals, ensuring the agent has access to the latest and most relevant information.
  2. Recommendation Tool:
    • Provides movie recommendations based upon user preferences and input.
  3. Memory Tool:
    • Stores information about user preferences in the knowledge graph, allowing for a personalized experience over multiple interactions.

Environment Setup

You need to define the following environment variables in the .env file.

OPENAI_API_KEY=<YOUR_OPENAI_API_KEY>
NEO4J_URI=<YOUR_NEO4J_URI>
NEO4J_USERNAME=<YOUR_NEO4J_USERNAME>
NEO4J_PASSWORD=<YOUR_NEO4J_PASSWORD>

Docker containers

This project contains the following services wrapped as docker containers

  1. Neo4j:
    • Neo4j, a graph database, is used to store the information about actors, movies, and their ratings.
  2. API:
    • Uses LangChain's neo4j-semantic-layer template to implement the OpenAI LLM and function calling capabilities.
  3. UI:
    • Simple streamlit chat user interface. Available on localhost:8501.

Populating with data

If you want to populate the DB with an example movie dataset, you can run python ingest.py. The script import information about movies and their rating by users. Additionally, the script creates two fulltext indices, which are used to map information from user input to the database. The dataset is based on the MovieLens dataset, which is also available as the Recommendation project in Neo4j Sandbox.

Contributions

Contributions are welcomed!

llm-movieagent's People

Contributors

tomasonjo 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.