Spaces:
Runtime error
Runtime error
added api_calling function
Browse files
app.py
CHANGED
|
@@ -40,12 +40,18 @@ reflections reveal a change or growth in thinking.
|
|
| 40 |
|
| 41 |
# Function Definitions
|
| 42 |
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 49 |
|
| 50 |
def message_and_history(input, history):
|
| 51 |
history = history or []
|
|
|
|
| 40 |
|
| 41 |
# Function Definitions
|
| 42 |
|
| 43 |
+
def api_calling(prompt):
|
| 44 |
+
completions = openai.Completion.create(
|
| 45 |
+
engine="text-davinci-003",
|
| 46 |
+
prompt=prompt,
|
| 47 |
+
max_tokens=1024,
|
| 48 |
+
n=1,
|
| 49 |
+
stop=None,
|
| 50 |
+
temperature=0.5,
|
| 51 |
+
)
|
| 52 |
+
message = completions.choices[0].text
|
| 53 |
+
return message
|
| 54 |
+
|
| 55 |
|
| 56 |
def message_and_history(input, history):
|
| 57 |
history = history or []
|