This is a simple Python script that uses the OpenAI API to generate discussion posts based on a theme or question.
- Install dependencies:
pip install openai python-dotenv- Configuration:
- Create a
.envfile with your OpenAI API key (reference line 1 of sample_env.txt) - Modify
config.jsonfile with the desired settings
No UI
python main.pyUI
streamlit run app.py| Section | Key | Description |
|---|---|---|
| ai_settings | model | OpenAI model (e.g., gpt-4, gpt-3.5-turbo) |
| max_tokens | Maximum response length (50-4000) | |
| temperature | Creativity level (0.0-2.0) | |
| file_paths | posts | Path to discussion posts file |
main.py: Main script for generating discussion postsconfig.json: Configuration filediscussion_posts.txt: File containing discussion posts (input).env: Environment file with OpenAI API key
- python-dotenv==1.0.0
- openai>=1.0.0
- streamlit>=1.30.0
python main.pystreamlit run app.py