Git Product home page Git Product logo

riolaf05 / langchain-rag-agent-chatbot Goto Github PK

View Code? Open in Web Editor NEW
2.0 1.0 0.0 78 KB

An Agentic RAG implementation using Langchain and a telegram client to send/receive messages from the chatbot

Python 42.28% Dockerfile 0.22% Jupyter Notebook 57.50%
actions agent agents artificial-intelligence aws chatbot lambda lambda-functions langchain langchain-python large-language-models machine-learning rag react retrieval-augmented-generation telegram-bot

langchain-rag-agent-chatbot's Introduction

LangChain Agent types

LangChain categorizes agents based on several dimensions:

  • model type;

  • support for chat history;

  • multi-input tools;

  • parallel function calling;

  • required model parameters.

It is important to choose the option that fits to your use case:

  1. OpenAI functions

There are certain models fine-tuned where input is a bit different than usual. There are special functions that can be called and the role of this agent is to determine when it should be invoked. This agent is designed to work with this kind of OpenAI model. It supports chat history.

  1. OpenAI tools

This agent is designed to work with OpenAI tools, so its role is to interact and determine whether to use e.g. image generation tool or another built-in one. The main difference between OpenAI function is the fact that the function is trying to find the best fitting algorithm/part of an algorithm to do better reasoning, while OpenAI tool is about built-in tools like image generation, and executing code. It supports chat history.

  1. XML Agent

There are models, where reasoning/writing XML is on a very advanced level (a good example is Anthropic Claude's model). If you're operating on XML files, that might be the right one to be considered. It supports chat history.

  1. JSON Chat Agent

Several LLMs available in the market are particularly handy when it comes to reading JSON. JSON is also a very common standard of some e.g. entity representation. If you're building some kind of integration that operates on JSON files and the model is supporting it, you can try to use this agent. It supports chat history.

  1. Structured chat

Intended for multi-input tools. It supports chat history.

  1. ReAct agent

Made for simple models (LLM - not conversational). It supports chat history.

  1. Self-ask with search

This kind of agent supports only one tool as an input. The main goal is to divide your query into smaller ones, use tools to get the answer, and then combine it into a full answer to your question. This kind of agent doesn’t support chat history.

Setup

In this project ReAct agent has been used.

To launch the project:

  1. clone project
git clone https://github.com/riolaf05/langchain-rag-agent-chatbot.git
  1. populate .env

  2. setup

py -m .venv/rag
source .venv/rag/bin/activate
pip install -r requirements.txt
python telegram.py

References

langchain-rag-agent-chatbot's People

Contributors

riolaf05 avatar

Stargazers

aromal_tr avatar  avatar

Watchers

 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.