[falcon] big test
Browse files
app.py
CHANGED
@@ -569,7 +569,9 @@ async def falcon(ctx, *, prompt: str):
|
|
569 |
|
570 |
result = falconspace.predict(fn_index=5) # result will be something like = /tmp/tmpjmz7f_9u.json, which will contain []
|
571 |
|
572 |
-
instructions = "The following is a conversation between a highly knowledgeable and intelligent AI assistant, called Falcon, and a human user, called User. In the following interactions, User and Falcon will converse in natural language, and Falcon will answer User's questions. Falcon was built to be respectful, polite and inclusive. Falcon was built by the Technology Innovation Institute in Abu Dhabi. Falcon will never decline to answer a question, and always attempts to give an answer that User would be satisfied with. It knows a lot, and always tells the truth. The conversation begins."
|
|
|
|
|
573 |
|
574 |
#fn 5 -> fn 1
|
575 |
# will give something like = /tmp/tmpklf60u2h.json, which will contain something like [["What day is today?", "Today"]] (prompt, generation)
|
@@ -581,10 +583,32 @@ async def falcon(ctx, *, prompt: str):
|
|
581 |
0.9, # int | float (numeric value between 0.1 and 0.99) in 'p (nucleus sampling)' Slider component
|
582 |
fn_index=1
|
583 |
)
|
|
|
|
|
|
|
|
|
|
|
584 |
|
585 |
-
|
586 |
-
|
587 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
588 |
|
589 |
except Exception as e:
|
590 |
print(f"Error: {e}")
|
|
|
569 |
|
570 |
result = falconspace.predict(fn_index=5) # result will be something like = /tmp/tmpjmz7f_9u.json, which will contain []
|
571 |
|
572 |
+
instructions = "The following is a conversation between a highly knowledgeable and intelligent AI assistant, called Falcon, and a human user, called User. The conversation may begin with a unique UUID, and if it does, the UUID can be ignored. In the following interactions, User and Falcon will converse in natural language, and Falcon will answer User's questions. Falcon was built to be respectful, polite and inclusive. Falcon was built by the Technology Innovation Institute in Abu Dhabi. Falcon will never decline to answer a question, and always attempts to give an answer that User would be satisfied with. It knows a lot, and always tells the truth. The conversation begins."
|
573 |
+
randomuuid = str(uuid.uuid4())
|
574 |
+
prompt = randomuuid + " " + prompt
|
575 |
|
576 |
#fn 5 -> fn 1
|
577 |
# will give something like = /tmp/tmpklf60u2h.json, which will contain something like [["What day is today?", "Today"]] (prompt, generation)
|
|
|
583 |
0.9, # int | float (numeric value between 0.1 and 0.99) in 'p (nucleus sampling)' Slider component
|
584 |
fn_index=1
|
585 |
)
|
586 |
+
|
587 |
+
directory = '/tmp/'
|
588 |
+
|
589 |
+
max_length = 0
|
590 |
+
max_length_file = None
|
591 |
|
592 |
+
for filename in os.listdir(directory):
|
593 |
+
if filename.endswith('.json'):
|
594 |
+
filepath = os.path.join(directory, filename)
|
595 |
+
with open(filepath, 'r') as file:
|
596 |
+
data = json.load(file)
|
597 |
+
for item in data:
|
598 |
+
if randomuuid in item[0]: # uuid should be in first item
|
599 |
+
text = item[1] if len(item) > 1 else '' # if there is no item[1], it won't work
|
600 |
+
length = len(text)
|
601 |
+
if length > max_length:
|
602 |
+
max_length = length
|
603 |
+
max_length_file = filepath
|
604 |
+
|
605 |
+
if max_length_file is not None:
|
606 |
+
print(f"The JSON file '{max_length_file}' contains the largest amount of text after the UUID.")
|
607 |
+
with open(max_length_file, "r") as file:
|
608 |
+
data = json.load(file)
|
609 |
+
await ctx.reply(f"Here's the resulting json file:\n{data}")
|
610 |
+
else:
|
611 |
+
print("No JSON file containing the UUID was found.")
|
612 |
|
613 |
except Exception as e:
|
614 |
print(f"Error: {e}")
|