Giter Club home page Giter Club logo

conversational-agent-langchain's Introduction

conv

Ruff Code style: black

Conversational Agent

This is a Rest-Backend for a Conversational Agent, that allows to embedd Documentes, search for them using Semantic Search, to QA based on Documents and do document processing with Large Language Models.

Recent Updates

  • GPT4ALL Uses Mistral now! If you want to enable it go to config/ai/gpt4all.yaml and change the string. Then you need to restart.
  • Switching for Aleph Alpha to Embeddings with luminous base control. Frontend

If you want to use an Aleph Alpha only backend i would recommend my other backend: https://github.com/mfmezger/aleph-alpha-rag.

Quickstart

To run the complete system with docker use this command:

git clone https://github.com/mfmezger/conversational-agent-langchain.git
cd conversational-agent-langchain

Create a .env file from the .env-template and set the qdrant api key. For tests just set it to test. QDRANT_API_KEY="test"

Then start the system with

  docker compose up -d

Then go to http://127.0.0.1:8001/docs or http://127.0.0.1:8001/redoc to see the API documentation.

Frontend: localhost:8501 Qdrant Dashboard: localhost:6333/dashboard

Project Description

This project is a conversational agent that uses Aleph Alpha and OpenAI Large Language Models to generate responses to user queries. The agent also includes a vector database and a REST API built with FastAPI.

Features

  • Uses Aleph Alpha and OpenAI Large Language Models to generate responses to user queries.
  • Includes a vector database to store and retrieve information.
  • Provides a REST API built with FastAPI for easy integration with other applications.
  • Has a basic gui.

Semantic Search

Semantic Search Architecture

Semantic search is an advanced search technique that aims to understand the meaning and context of a user's query, rather than matching keywords. It involves natural language processing (NLP) and machine learning algorithms to analyze and interpret user intent, synonyms, relationships between words, and the structure of content. By considering these factors, semantic search improves the accuracy and relevance of search results, providing a more intuitive and personalized user experience.

Architecture

Semantic Search Architecture

Components

Langchain is a library for natural language processing and machine learning. FastAPI is a modern, fast (high-performance) web framework for building APIs with Python 3.7+ based on standard Python type hints. A Vectordatabase is a database that stores vectors, which can be used for similarity searches and other machine learning tasks.

Available LLM Backends

Secret Management

Two ways to manage your api keys are available, the easiest approach is to sent the api token in the request as the token. Another possiblity is to create a .env file and add the api token there. If you use OpenAI from Azure or OpenAI directly you need to set the correct parameters in the .env file.

Installation & Development Backend

First install Python Dependencies:

pip install poetry
poetry install

Start the complete system with:

docker compose up -d

To run the Qdrant Database local just run:

docker compose up qdrant

To run the Backend use this command in the root directory:

poetry run uvicorn agent.api:app --reload

To run the tests you can use this command:

poetry run coverage run -m pytest -o log_cli=true -vvv tests

Development Frontend

To run the Frontend use this command in the root directory:

poetry run streamlit run gui.py --theme.base="dark"

Vector Database

Qdrant Dashboard is available at http://127.0.0.1:6333/dashboard. There you need to enter the api key.

Qdrant API Key

To use the Qdrant API you need to set the correct parameters in the .env file. QDRANT_API_KEY is the API key for the Qdrant API. And you need to change it in the qdrant.yaml file in the config folder.

Bulk Ingestion

If you want to ingest large amount of data i would recommend you use the scripts located in agent/ingestion.

Star History

Star History Chart

conversational-agent-langchain's People

Contributors

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