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.
- 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
- Rust (with
tokioandreqwestdependencies) - OpenAI API key
- Python installed (
pythonorpython3command available)
- Clone the repository:
git clone https://github.com/RGGH/prompty.git cd prompty - Set up the OpenAI API key as an environment variable:
export OPENAI_API_KEY=your_api_key_here - Build and run the program:
cargo run
- Fetches the OpenAI API key from the environment.
- Sends a request to OpenAI's API to generate a Python script.
- Writes the response to
script.py. - Determines whether
pythonorpython3is available. - Executes the script and prints the output.
Python script generated: script.py
Python script output: 85000.32This project is licensed under the MIT License.
Take user input to use as prompt
Pull requests are welcome! Feel free to submit issues or feature requests.