Code Monkey home page Code Monkey logo

botapi's Introduction

Bot Service README

Overview

This bot service is developed using various Python packages to provide a robust and efficient solution. It utilizes FastAPI as the web framework for creating APIs, UVicorn for serving the FastAPI application, and several other packages for specific functionalities such as interacting with Google Cloud Storage, data manipulation with Pandas, environment variable management with Python-dotenv, and more.

Installation

To install the required packages, you can use pip. Run the following command in your terminal:

python -m venv .venv
.venv\Scripts\activate
pip install -r requirements.txt

Configuration

Before running the service, make sure to set up the necessary configurations. Create a .env file in the root directory of your project and add the required environment variables. Here's an example .env file:

# Example .env file

API_V1_ROUTE="/api/v1"
ENV_STATE=dev
DATABASE_URL="postgresql"
DEV_API_V1_ROUTE="/api/v1"
GOOGLE_API_KEY="KGLKERLK"
GOOGLE_CSE_ID="1"
OPENAI_API_KEY

# Other environment variables...

Usage

To run the bot service, execute the following command:

pip install -r requirements.txt
pip install -r requirements-dev.txt
.venv\Scripts\activate
python -m uvicorn app.main:app --reload

This will start the FastAPI application and make it available on http://localhost:8000.

Packages Used

  • FastAPI: A modern, fast (high-performance), web framework for building APIs with Python 3.7+ based on standard Python type hints.
  • UVicorn: A lightning-fast ASGI server, built on uvloop and httptools, for running asynchronous Python web code.
  • Google Cloud Storage: A fully-managed, highly-durable, and highly available object storage service.
  • Pydantic: Data validation and settings management using Python type annotations.
  • Pandas: A fast, powerful, flexible, and easy-to-use open-source data manipulation and analysis library.
  • Python-dotenv: Reads the key-value pair from .env file and adds them to environment variable.
  • Pydantic-settings: A lightweight settings management library built on top of Pydantic.
  • OpenAI: A leading AI research lab providing state-of-the-art natural language processing models.
  • Langchain: A Python library for creating a chain of language models.
  • Langchain-openai: A plugin for Langchain library to use OpenAI language models.
  • Chromadb: A Python library for working with Chroma database.
  • Langchain_chroma: A plugin for Langchain library to use Chroma database.
  • Html2text: A Python script that converts a page of HTML into clean, easy-to-read plain ASCII text.

Deployment

For deploying the bot service in production, it's recommended to use a production-ready server such as Gunicorn. You can run the service using Gunicorn with the following command:

gunicorn -w 4 -k uvicorn.workers.UvicornWorker app.main:app -b 0.0.0.0:8000

This command starts Gunicorn with 4 worker processes and binds it to port 8000.

botapi's People

Contributors

halfbug avatar sadafgs avatar subhashpatel 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.