Skip to content

Rust-based CLI application that interacts with a GPT-like API to generate responses based on user input.

Notifications You must be signed in to change notification settings

geekygeeky/rust-gpt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Rust GPT Chat Client

This is a simple Rust-based CLI application that interacts with a GPT-like API to generate responses based on user input. The app communicates with the AIML API using Hyper for HTTP requests, and the dotenv crate is used to manage API keys securely. The app utilizes spinners to provide feedback while waiting for responses from the API.

Features

  • CLI Interface: Type your query and get concise, straight-to-the-point responses from the AI.
  • Customizable: Supports changing parameters such as temperature, max tokens, and model.
  • Spinners: Provides a waiting animation to indicate when the model is processing.
  • Environment Configuration: Uses .env for secure API key management.

Requirements

  • Rust (latest stable version)
  • tokio async runtime
  • .env file containing the API key

Installation

  1. Clone the repository:

    git clone https://github.com/geekygeeky/rust-gpt
    cd rust-gpt
  2. Install dependencies:

    cargo build
  3. Create a .env file in the root directory with your API key:

    API_KEY=your_api_key_here
    

    Get your API key here: https://aimlapi.com/app/keys

  4. Run the application:

    cargo run

Usage

  1. The CLI will prompt you with >.
  2. Type your input and press enter to get a response from the AI.
  3. Type exit to quit the program.

Example

> Hello, how are you?
ID -> some_id
Model -> google/gemini-2.0-flash
Created -> 1674893520
---------Content---------
I am fine, thank you. How can I assist you today?

📷 Preview

Program Output


Feel free to modify the model, temperature, or other parameters by changing the code.

About

Rust-based CLI application that interacts with a GPT-like API to generate responses based on user input.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages