Spaces:
Running
Running
Zekun Wu
commited on
Commit
•
159dda8
1
Parent(s):
b3d7148
update
Browse files- util/injection.py +3 -1
util/injection.py
CHANGED
@@ -62,7 +62,7 @@ def create_summary(group_name, label, occupation, additional_charateristics):
|
|
62 |
return "\n".join(summary)
|
63 |
|
64 |
|
65 |
-
def invoke_retry(prompt, agent, parameters):
|
66 |
attempts = 0
|
67 |
delay = 2 # Initial delay in seconds
|
68 |
max_attempts = 20 # Maximum number of retry attempts
|
@@ -72,6 +72,8 @@ def invoke_retry(prompt, agent, parameters):
|
|
72 |
score_text = agent.invoke(prompt, **parameters)
|
73 |
print(f"Score text: {score_text}")
|
74 |
print("=============================================================")
|
|
|
|
|
75 |
score = re.search(r'\d+', score_text)
|
76 |
return int(score.group()) if score else -1
|
77 |
except Exception as e:
|
|
|
62 |
return "\n".join(summary)
|
63 |
|
64 |
|
65 |
+
def invoke_retry(prompt, agent, parameters,string_input=False):
|
66 |
attempts = 0
|
67 |
delay = 2 # Initial delay in seconds
|
68 |
max_attempts = 20 # Maximum number of retry attempts
|
|
|
72 |
score_text = agent.invoke(prompt, **parameters)
|
73 |
print(f"Score text: {score_text}")
|
74 |
print("=============================================================")
|
75 |
+
if string_input:
|
76 |
+
return score_text
|
77 |
score = re.search(r'\d+', score_text)
|
78 |
return int(score.group()) if score else -1
|
79 |
except Exception as e:
|