Skip to content

Demo web project using the Elixir LangChain library

License

Notifications You must be signed in to change notification settings

brainlid/langchain_demo

Repository files navigation

Logo with chat chain links Elixir LangChain Demo App

This project is a demonstration example using the Elixir LangChain library and Phoenix LiveView.

To start your LangChain Demo project:

  • Run mix setup to install and setup dependencies
  • Setup your export OPENAI_API_KEY=, you can find more here
  • Start Phoenix endpoint with mix phx.server or inside IEx with iex -S mix phx.server

Now you can visit localhost:4400 from your browser.

Conversations

Visit the Conversations page for having a conversation with ChatGPT.

You can cancel a request in flight, delete a message, edit a message, and resubmit the conversation.

Features:

  • Conversations are written to a SQLite database in the project directory.
  • Conversations are performed using the Elixir LangChain library.
  • Uses Phoenix LiveView Async Operations.
  • Use ctrl+enter to submit a message.

Example GIF showing usage with editing and resubmitting

Personal Fitness AI Agent

An Agent can be described as:

Agent: a language model is used as a reasoning engine to determine which actions to take and in which order.

Visit the Personal Fitness Trainer page to meet with your own Personal AI Fitness Trainer.

Suggestion: Ask "how do we start?" to get started and go from there!

For an overview and to see it in action, check out the video:

Youtube demo video

There is a companion blog post about it as well that gives an overview of how it works.

You can create a weekly workout plan to help you reach your goals. Information about you is stored in a local SQLite database. Report on your workouts to your assistant and they will log them for you. The assistant can access your stored information and historical workout logs to answer questions and help you on your personal fitness journey! 💪

Features:

  • Context around how the AI is configured is hidden from the user.
  • Data about the user is written in a structured format by the AI into a local SQLite database.
  • Historical fitness log entries are stored and fetched from the local database.
  • Provides a simple but powerful working example of how to create an AI assistant in Elixir that integrates with your app.