Giter Site home page Giter Site logo

kowalewskipawel / rust-gpt3 Goto Github PK

View Code? Open in Web Editor NEW
4.0 1.0 0.0 37 KB

Fullstack application built entirely in Rust, that shows the implementation of both Frontend with yew, as well as Backend in Rocket. Additionally, it shows how to create the connection with the OpenAI API.

Rust 91.51% Shell 0.11% HTML 1.38% CSS 7.00%
gpt3 openai reqwest rocket rust sqlite yew

rust-gpt3's Introduction


Fullstack Rust GPT-3 Project

About The Project

This project is an educational fullstack application written in Rust, using the Yew.rs framework for the frontend and the Rocket framework for the backend. It is designed to allow users to make requests to OpenAI, and have the responses returned to them. The requests are protected by unique keys, which must be added by an admin, and each key has 10 questions associated with it. On the frontend, the user must provide the key and the question to the AI in order for the request to be processed. The entire project was created for educational purposes, and a series of YouTube videos have been recorded to demonstrate the project and its features.

Built With

Prerequisites

Installation

  1. Open backend directory

  2. Create a new Database instance with the following commands

sqlite3 ./keys.db
create table keys (id varchar(255), left int);
.q
   
  1. Create a .env file in the root folder and add the following variables:
   OPENAI_KEY=<OPENAI_API_KEY>
   ADMIN_KEY=<RANDOM_ADMIN_PASSWORD>

Hint: You can get your own OpenAI API key from https://beta.openai.com/

  1. Inside of the backend directory run command cargo run

  2. Open second instance of terminal and go to frontend directory

  3. Run trunk serve command

Adding Question Keys

In order to add new keys for users to use call the following POST request

URL: http://127.0.0.1:8000/api/v1/add_key
BODY: {
    "password": <ADMIN_KEY>
    }

Querying all available keys

In order to see all keys call the following GET request

URL: http://127.0.0.1:8000/api/v1/query_all
BODY: {
    "password": <ADMIN_KEY>
    }

Videos

  1. (https://www.youtube.com/watch?v=DBFZgWI9vME)[https://www.youtube.com/watch?v=DBFZgWI9vME]
  2. (https://www.youtube.com/watch?v=LYNLb_YDDzE)[https://www.youtube.com/watch?v=LYNLb_YDDzE]
  3. (https://www.youtube.com/watch?v=r8s0nbCKQ_g)[https://www.youtube.com/watch?v=r8s0nbCKQ_g]

rust-gpt3's People

Contributors

kowalewskipawel avatar

Stargazers

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