correcting the prompt
Browse files
app.py
CHANGED
@@ -16,26 +16,32 @@ client = openai.OpenAI(organization='org-eiNl8e4nk93VLQFDb4EBz9JG')
|
|
16 |
|
17 |
#generates an AI description of your character
|
18 |
def describe(names,wis,char,str,int,dex,con):
|
19 |
-
|
20 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
model='gpt-3.5-turbo-instruct',
|
22 |
-
prompt=
|
23 |
-
max_tokens=
|
24 |
temperature=0.77,
|
25 |
frequency_penalty=0.2,
|
26 |
presence_penalty= 0.25)
|
27 |
|
28 |
-
|
29 |
#print(dict(completion).get('usage'))
|
30 |
|
31 |
|
32 |
#print(completion.model_dump_json(indent=2))
|
33 |
|
34 |
-
|
35 |
-
|
36 |
|
37 |
|
38 |
-
|
39 |
|
40 |
|
41 |
|
|
|
16 |
|
17 |
#generates an AI description of your character
|
18 |
def describe(names,wis,char,str,int,dex,con):
|
19 |
+
print(f"hi{names}")
|
20 |
+
|
21 |
+
prom=f"We're generating Dungeons and Dragons characters for a new campaign, and we need a brief character description, including race"
|
22 |
+
prom+=f" and class. The character's name is {names} with the following stats: Wisdom: {wis},Charisma:{char},Strength:{str},"
|
23 |
+
prom+=f"Intelligence:{int},Dexterity:{dex},Constitution:{con}. Describe the character, and then, separated by $$$ give us the "
|
24 |
+
prom+=f"character's interesting backstory."
|
25 |
+
|
26 |
+
completion = client.completions.create(
|
27 |
model='gpt-3.5-turbo-instruct',
|
28 |
+
prompt=prom,
|
29 |
+
max_tokens=510,
|
30 |
temperature=0.77,
|
31 |
frequency_penalty=0.2,
|
32 |
presence_penalty= 0.25)
|
33 |
|
34 |
+
result =completion.choices[0].text
|
35 |
#print(dict(completion).get('usage'))
|
36 |
|
37 |
|
38 |
#print(completion.model_dump_json(indent=2))
|
39 |
|
40 |
+
if not result :
|
41 |
+
result = "Could you be any more boring?"
|
42 |
|
43 |
|
44 |
+
return result
|
45 |
|
46 |
|
47 |
|