-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpassword-generator.py
31 lines (24 loc) · 1.02 KB
/
password-generator.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import openai
openai.api_key = 'your-api-key'
def get_password(theme, name):
# Call ChatGPT API to get suggestions
responseAI = openai.ChatCompletion.create(
model="text-davinci-003", # Choose the model
messages=[
{"role": "system", "content": name} # You can change "You" to any username you want
],
prompt=f"Generate password for '{theme}' theme:" # Prompt with user's theme
)
suggestions = [message['content'] for message in responseAI['choices'][0]['messages']]
# Generate password based on suggestions
# Add generation logic here
# For now, Ill just return the suggestions
return suggestions
def main():
name = input("Enter a username you would like the chat to use")
theme = input("Enter a theme or description for your password: ")
password = get_password(theme, name)
print("Generated Password:", password)
print ("Make sure to save this AI generated password somewhere safe!")
if __name__ == "__main__":
main()