Git Product home page Git Product logo

promptdefi-ai-parser's Introduction

PromptDeFi Command Parser

This project is a simple web service that accepts user commands related to trading actions on perpetual futures markets and translates these commands into a structured JSON format. The translation is done using the OpenAI GPT model.

Prerequisites

  • Node.js (v14 or newer)
  • NPM (comes with Node.js)
  • Docker (for containerized deployment)

Local Setup

  1. Clone this repository:

    git clone https://github.com/KStasi/ai-parser.git
    
  2. Move into the project directory:

    cd your-repo-name
    
  3. Install dependencies:

    npm install
    
  4. Copy the .env.example file to a new file named .env:

    cp .env.example .env
    
  5. Edit the .env file and add your OpenAI API key:

    OPENAI_API_KEY=your_openai_api_key
    
  6. Run the server:

    node index.js
    

The server is now running at http://localhost:3000.

Usage

Send a POST request to the /parse-prompt endpoint with a JSON body containing the prompt field. For example:

curl -X POST -H "Content-Type: application/json" -d '{"prompt":"Swap 100 USDT to ETH. Wrap 0.1 ETH. Deposit 0.1 WETH to Aave. Borrow 50 USDT from Aave."}' http://localhost:3000/parse-prompt

The service will respond with a JSON representation of the action described in the prompt.

Docker Deployment

  1. Build the Docker image:
docker build -t promptdefi-parser .
  1. Run the Docker container:
docker run -p 3000:3000 -d -e OPENAI_API_KEY=your_openai_api_key promptdefi-parser

The application is now accessible at http://localhost:3000.

promptdefi-ai-parser's People

Contributors

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