Git Product home page Git Product logo

compage-llm-backend's Introduction

License Pull Request CodeQL Python

Compage LLM Backend

This compage llm backend project is a FastAPI application that provides functionality for code generation, token management, unit test generation for compageGPT

Overview

This project is built using the FastAPI framework in Python. It provides functionality for code generation using langchain and openAI, token management, and more. The project structure is organized as follows:

root
|---- main.py
|---- venv
|---- pkg
|     |---- src
|           |---- routes
|           |---- middlewares
|           |---- configs
|           |---- models
|           |---- schemas
|           |---- store
|           |---- __init__.py
|
| ---- Dockerfile
|---- requirements.txt
|---- Makefile
|----.gitignore
... many more

Features

  • Health: The project provides an API endpoint /api/health that returns a simple "ok" response. This can be used to check if the server is up and running.

  • Validate OpenAI API key: The project provides an API endpoint /api/validate_openai that validates the OpenAI API key. It offers OpenAI Validation, explanation as responses.

  • Unit Test Generation: The project provides an API endpoint /api/unit_test_generate that utilizes LangChain and OpenAI to generate Unit Test Cases. It offers Unit Test Generation, explanation as responses.

  • Documentation Generation: The project provides an API endpoint /api/doc_generate that utilizes LangChain and OpenAI to generate documentation. It offers Documentation Generation, explanation as responses.

Installation

  1. Clone the repository:

    git clone https://github.com/intelops/compage-llm-backend
  2. Navigate to the project directory:

    cd compage-llm-backend
  3. Create a virtual environment (optional but recommended):

    python3.8 -m venv venv
    source venv/bin/activate
  4. Install project dependencies:

    pip install -r requirements.txt
  5. Setup the database:

    # run the database setup using docker
    docker run --name cassandra-backend-llm -p 9042:9042 cassandra:latest
    
    # execute the docker bash
    docker exec -it cassandra-backend-llm bash
    
    # enter the database
    cqlsh
    
    # create the keyspace
    CREATE KEYSPACE IF NOT EXISTS backend_llm WITH REPLICATION = { 'class' : 'SimpleStrategy', 'replication_factor' : 1 };
    

Usage

  1. Run the FastAPI application:

    python main.py
  2. Access the API at http://localhost:8000.

  3. Checkout the swagger documentation at docs.

API Endpoints

  • /api/health: Health check endpoint. Returns a simple "ok" response.
  • /api/unit_test_generate: Generate code using LangChain and OpenAI. Receive unit test flow and explanation as responses.
  • /api/doc_generate: Generate documentation using LangChain and OpenAI. Receive documentation flow and explanation as responses.
  • /api/validate_openai: Validate the OpenAI API key. Receive OpenAI Validation, explanation as responses.

Dockerization

You can use the included Dockerfile to containerize the application. Build the Docker image and run it in a container.

docker build -t backend_llm .
docker run -p 8000:8000 backend_llm

Contributing

Contributions are welcome! If you find any issues or want to enhance the project, feel free to submit a pull request.

compage-llm-backend's People

Contributors

azar-writes-code avatar devopstoday11 avatar deepsource-autofix[bot] avatar deepsource-io[bot] 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.