Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OpenAI Python Script Generator Rust

This Rust program interacts with OpenAI's API to generate a Python script that fetches the latest Bitcoin price from the Gemini API. It then writes the script to a file and executes it automatically.

Features

  • Uses OpenAI's GPT-4 model to generate a Python script dynamically
  • Writes the script to script.py
  • Executes the generated Python script
  • Handles errors gracefully

Prerequisites

  • Rust (with tokio and reqwest dependencies)
  • OpenAI API key
  • Python installed (python or python3 command available)

Installation

  1. Clone the repository:
    git clone https://github.com/RGGH/prompty.git
    cd prompty
  2. Set up the OpenAI API key as an environment variable:
    export OPENAI_API_KEY=your_api_key_here
  3. Build and run the program:
    cargo run

How It Works

  1. Fetches the OpenAI API key from the environment.
  2. Sends a request to OpenAI's API to generate a Python script.
  3. Writes the response to script.py.
  4. Determines whether python or python3 is available.
  5. Executes the script and prints the output.

Example Output

Python script generated: script.py
Python script output: 85000.32

Dependencies

License

This project is licensed under the MIT License.

Todo

Take user input to use as prompt

Contributing

Pull requests are welcome! Feel free to submit issues or feature requests.

Author

RGGH

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages