Update falcon.py
Browse files
falcon.py
CHANGED
|
@@ -33,26 +33,28 @@ def falcon_initial_generation(prompt, instructions, thread):
|
|
| 33 |
job = falcon_client.submit(
|
| 34 |
prompt, chathistory, instructions, temperature, p_nucleus_sampling, fn_index=1
|
| 35 |
)
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
|
|
|
|
|
|
| 56 |
|
| 57 |
|
| 58 |
async def try_falcon(interaction, prompt):
|
|
|
|
| 33 |
job = falcon_client.submit(
|
| 34 |
prompt, chathistory, instructions, temperature, p_nucleus_sampling, fn_index=1
|
| 35 |
)
|
| 36 |
+
while job.done() is False:
|
| 37 |
+
pass
|
| 38 |
+
else:
|
| 39 |
+
if os.environ.get("TEST_ENV") == "True":
|
| 40 |
+
print("falcon text gen job done")
|
| 41 |
+
file_paths = job.outputs()
|
| 42 |
+
print(file_paths)
|
| 43 |
+
full_generation = file_paths[-1]
|
| 44 |
+
print(full_generation)
|
| 45 |
+
with open(full_generation, "r") as file:
|
| 46 |
+
data = json.load(file)
|
| 47 |
+
print(data)
|
| 48 |
+
output_text = data[-1][-1]
|
| 49 |
+
threadid_conversation[thread.id] = full_generation
|
| 50 |
+
if len(output_text) > 1300:
|
| 51 |
+
output_text = (
|
| 52 |
+
output_text[:1300]
|
| 53 |
+
+ "...\nTruncating response to 2000 characters due to discord api limits."
|
| 54 |
+
)
|
| 55 |
+
if os.environ.get("TEST_ENV") == "True":
|
| 56 |
+
print(output_text)
|
| 57 |
+
return output_text
|
| 58 |
|
| 59 |
|
| 60 |
async def try_falcon(interaction, prompt):
|