Download topic_agent.py from mgbam/naso: direct link, hf CLI and curl.
- Browser
- Download file 560 Bytes
-
https://huggingface.co/spaces/mgbam/naso/resolve/1b1d401db718d0eb62672475d170205bcd2cd36c/topic_agent.py
- Command line
-
hf download hf://spaces/mgbam/naso@1b1d401db718d0eb62672475d170205bcd2cd36c/topic_agent.py
-
curl -L -o topic_agent.py https://huggingface.co/spaces/mgbam/naso/resolve/1b1d401db718d0eb62672475d170205bcd2cd36c/topic_agent.py
560 Bytes
| # Example for topic_agent.py | |
| import openai | |
| class TopicAgent: | |
| def generate_outline(self, topic, duration, difficulty): | |
| response = openai.ChatCompletion.create( | |
| model="gpt-4", | |
| messages=[ | |
| {"role": "system", "content": "You're an expert corporate trainer creating AI workshop outlines"}, | |
| {"role": "user", "content": f"Create a {duration}-hour {difficulty} workshop outline on {topic} with goals and modules"} | |
| ] | |
| ) | |
| return json.loads(response.choices[0].message.content) |