Update app.py
Browse files
app.py
CHANGED
@@ -36,7 +36,7 @@ def respond(
|
|
36 |
max_tokens,
|
37 |
temperature,
|
38 |
top_p,
|
39 |
-
eou_threshold: float = 0.
|
40 |
):
|
41 |
# Keep only the last 4 user inputs and add the current user input
|
42 |
user_history = [msg[0] for msg in history if msg[0]] # Extract user inputs from history
|
@@ -46,7 +46,7 @@ def respond(
|
|
46 |
# Check if the EOU probability is high for the combined history (previous 4 + current input)
|
47 |
chat_ctx = [{"role": "user", "content": msg} for msg in user_history]
|
48 |
eou_probability = get_eou_probability(chat_ctx)
|
49 |
-
|
50 |
# If the EOU probability is higher than the threshold, wait for the user to complete their sentence
|
51 |
if eou_probability > eou_threshold:
|
52 |
return f"EOU probability is high: {eou_probability:.2f}. Please complete your sentence."
|
|
|
36 |
max_tokens,
|
37 |
temperature,
|
38 |
top_p,
|
39 |
+
eou_threshold: float = 0.2 # Probability threshold to stop or transition the conversation
|
40 |
):
|
41 |
# Keep only the last 4 user inputs and add the current user input
|
42 |
user_history = [msg[0] for msg in history if msg[0]] # Extract user inputs from history
|
|
|
46 |
# Check if the EOU probability is high for the combined history (previous 4 + current input)
|
47 |
chat_ctx = [{"role": "user", "content": msg} for msg in user_history]
|
48 |
eou_probability = get_eou_probability(chat_ctx)
|
49 |
+
print(eou_probability)
|
50 |
# If the EOU probability is higher than the threshold, wait for the user to complete their sentence
|
51 |
if eou_probability > eou_threshold:
|
52 |
return f"EOU probability is high: {eou_probability:.2f}. Please complete your sentence."
|