A command-line AI assistant that leverages ChatGPT (via OpenAI API) for conversational interaction and safe, on-demand automation. This assistant can generate, save, and run Python scripts based on user requests—with explicit user confirmation for every action. Perfect for developers, power users, and anyone interested in safe, auditable AI-powered task automation on their local machine.
- Conversational AI: Interact with ChatGPT (gpt-4-turbo or gpt-3.5-turbo) from the terminal
- Script Generation: Ask for automations; the assistant will generate Python scripts as needed
- Safety First: User must confirm before any script is saved or executed
- Script Management: Unique filenames, script history, list and rerun any created script
- Memory: Keeps short conversation context for more relevant answers
- No GUI, No Bloat: Minimal dependencies, pure Python experience
- Python 3.8+
- OpenAI API key
openai
Python package:pip install openai
-
Set Your API Key
- Open the script and set your
OPENAI_API_KEY
at the top.
- Open the script and set your
-
Run the Script
python deepseek_asistant.py
-
Start Chatting
- Type your request/question.
- To list all generated scripts, type:
list scripts
- To exit:
exit
orquit
-
Script Creation & Execution
- If your request requires a script ("download all files from a URL", etc.), ChatGPT will generate Python code.
- You will see the code and be asked for confirmation to save and (optionally) run it.
- No script is run or saved without your explicit permission.
User: create a script that lists files in the current directory
Assistant: (shows script code)
Assistant: Do you want to save and run this script? (yes/no)
> yes
Assistant: Script 'script_list_files_xxxxxx.py' created successfully.
Assistant: Do you want to execute this script? (yes/no)
> yes
Assistant: (prints script output)
list scripts
: Show all scripts generated in this sessionexit
/quit
: End the session
- Scripts only run with your explicit approval
- Each script is saved with a unique name, and you can review code before executing
- No scripts are executed automatically
- Model: Change
MODEL_NAME
togpt-4-turbo
orgpt-3.5-turbo
- System Prompt: Adjust the system prompt in
chat_with_gpt()
for custom behavior - History Depth: Edit the number of history items retained (
history[-5:]
)
MIT (c) Emir Baycan
Developed by Emir Baycan