Spaces:
Runtime error
Runtime error
Download utils/openai_client.py from nsgupta1/MockInterviewBot: direct link, hf CLI and curl.
- Browser
- Download file 303 Bytes
-
https://huggingface.co/spaces/nsgupta1/MockInterviewBot/resolve/main/utils/openai_client.py
- Command line
-
hf download hf://spaces/nsgupta1/MockInterviewBot/utils/openai_client.py
-
curl -L -o openai_client.py https://huggingface.co/spaces/nsgupta1/MockInterviewBot/resolve/main/utils/openai_client.py
303 Bytes
| from openai import OpenAI | |
| import os | |
| def generate_response(prompt): | |
| client = OpenAI(api_key=os.getenv("OPENAI_API_KEY")) | |
| response = client.chat.completions.create( | |
| model="gpt-4", | |
| messages=[{"role": "user", "content": prompt}] | |
| ) | |
| return response.choices[0].message.content | |