GithubHelp home page GithubHelp logo

africhain's Introduction

LangChain Agent

This project implements a Python-based LangChain agent that utilizes various tools to provide information based on natural language queries. The agent is exposed over a single FastAPI endpoint and can be interacted with using Postman.

Features

  • Query Database: Queries the Northwind database.
  • Search Internet: Performs general internet searches.
  • Get Weather: Retrieves weather information.
  • Get IP Info: Obtains IP-related information.
  • Get Pokémon Info: Fetches details about Pokémon.
  • Get Movie Info: Retrieves movie information.

Tools Integrated

  1. query_db: Queries the Northwind database.
  2. search_internet: Performs general internet searches.
  3. get_weather: Retrieves weather information.
  4. get_ip_info: Obtains IP-related information.
  5. get_pokemon_info: Fetches details about Pokémon.
  6. get_movie_info: Retrieves movie information.

FastAPI Endpoint

The agent is exposed over a single FastAPI endpoint where you can input a natural language query using Postman. The agent automatically selects the appropriate tool based on the query and responds with accurate information.

Endpoint

POST /query

Request

Body:

{
  "query": "Your natural language query here"
}

Response

Body:

{
  "response": "The agent's response based on your query"
}

Setup and Installation

  1. Clone the repository:

    git clone https://github.com/Theedon/AfriChain.git
    cd AfriChain
  2. Install dependencies: Ensure you have Poetry installed.

    poetry install
  3. Set environment variables: Create a .env file in the root of your project and add the necessary environment variables:

     OPENAI_API_KEY=your_openai_api_key
     GOOGLE_API_KEY=your_google_api_key
     HUGGINGFACEHUB_API_TOKEN=your_huggingfacehub_api_token
     HF_TOKEN=your_hf_token
     LANGCHAIN_API_KEY=your_langchain_api_key
     MISTRAL_API_KEY=your_mistral_api_key
     TOGETHER_API_KEY=your_together_api_key
     ANTHROPIC_API_KEY=your_anthropic_api_key
     OPENWEATHERMAP_API_KEY=your_openweathermap_api_key
     OMDB_API_KEY=your_omdb_api_key
     TMDB_API_KEY=your_tmdb_api_key
     TAVILY_API_KEY=your_tavily_api_key
    
  4. Run the application: Use Poetry to run the FastAPI application with Uvicorn, enabling hot reloading.

    poetry run africhain

Usage

You can interact with the agent using Postman. Send a POST request to http://0.0.0.0:8000/query with a JSON body containing your query.

Deployment

The project is deployed on render as a service at this url

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.