removed dummy
Browse files- app/helpers/exercise_standardizer.py +0 -3
- chains/diagnoser/runner.py +2 -2
- chains/distractors/runner.py +1 -1
- main.py +2 -8
app/helpers/exercise_standardizer.py
CHANGED
|
@@ -1,7 +1,6 @@
|
|
| 1 |
# app/helpers/exercise_standardizer.py
|
| 2 |
from langchain_core.prompts import ChatPromptTemplate
|
| 3 |
from typing import Any
|
| 4 |
-
from app.helpers.update_standardized_markdown import dummy_state
|
| 5 |
from config.format_mappings import FORMAT_MAPPINGS
|
| 6 |
|
| 7 |
|
|
@@ -27,7 +26,5 @@ async def standardize_exercise(user_query: str, exercise_format: str, template:
|
|
| 27 |
response = await llm.ainvoke(std_messages)
|
| 28 |
standardized_exercise = getattr(response, "content", response)
|
| 29 |
|
| 30 |
-
dummy_state.update(value=standardized_exercise)
|
| 31 |
-
|
| 32 |
return standardized_exercise
|
| 33 |
|
|
|
|
| 1 |
# app/helpers/exercise_standardizer.py
|
| 2 |
from langchain_core.prompts import ChatPromptTemplate
|
| 3 |
from typing import Any
|
|
|
|
| 4 |
from config.format_mappings import FORMAT_MAPPINGS
|
| 5 |
|
| 6 |
|
|
|
|
| 26 |
response = await llm.ainvoke(std_messages)
|
| 27 |
standardized_exercise = getattr(response, "content", response)
|
| 28 |
|
|
|
|
|
|
|
| 29 |
return standardized_exercise
|
| 30 |
|
chains/diagnoser/runner.py
CHANGED
|
@@ -60,5 +60,5 @@ async def run_diagnoser(user_query: str, model_choice_diagnose: str, exercise_fo
|
|
| 60 |
# pad up to 10 if needed
|
| 61 |
all_responses = list(responses) + [""] * (10 - len(responses))
|
| 62 |
|
| 63 |
-
# Return a tuple of exactly
|
| 64 |
-
return
|
|
|
|
| 60 |
# pad up to 10 if needed
|
| 61 |
all_responses = list(responses) + [""] * (10 - len(responses))
|
| 62 |
|
| 63 |
+
# Return a tuple of exactly 10 responses, + the standardized exercise.
|
| 64 |
+
return (*all_responses, standardized_exercise)
|
chains/distractors/runner.py
CHANGED
|
@@ -57,4 +57,4 @@ async def run_distractors(
|
|
| 57 |
# 4) Pad up to 10 outputs to correspond to 10 response fields
|
| 58 |
all_responses = list(results) + [""] * (10 - len(results))
|
| 59 |
|
| 60 |
-
return
|
|
|
|
| 57 |
# 4) Pad up to 10 outputs to correspond to 10 response fields
|
| 58 |
all_responses = list(results) + [""] * (10 - len(results))
|
| 59 |
|
| 60 |
+
return (*all_responses, standardized_exercise)
|
main.py
CHANGED
|
@@ -84,16 +84,10 @@ with gr.Blocks() as interface:
|
|
| 84 |
outputs=[login_container, app_container, login_error]
|
| 85 |
)
|
| 86 |
|
| 87 |
-
dummy_state.change(
|
| 88 |
-
fn=update_standardized_markdown,
|
| 89 |
-
inputs=[dummy_state],
|
| 90 |
-
outputs=[standardized_format_display]
|
| 91 |
-
)
|
| 92 |
-
|
| 93 |
diagnoser_button.click(
|
| 94 |
fn=run_diagnoser,
|
| 95 |
inputs=[diagnoser_input, model_choice_diagnose, exercise_format_diagnose, sampling_count_diagnose],
|
| 96 |
-
outputs=diagnoser_responses + [
|
| 97 |
)
|
| 98 |
|
| 99 |
distractors_button.click(
|
|
@@ -108,7 +102,7 @@ with gr.Blocks() as interface:
|
|
| 108 |
intermediate_distractors_specification,
|
| 109 |
final_distractors_specification,
|
| 110 |
],
|
| 111 |
-
outputs=distractors_responses + [
|
| 112 |
)
|
| 113 |
|
| 114 |
# Launch the app.
|
|
|
|
| 84 |
outputs=[login_container, app_container, login_error]
|
| 85 |
)
|
| 86 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 87 |
diagnoser_button.click(
|
| 88 |
fn=run_diagnoser,
|
| 89 |
inputs=[diagnoser_input, model_choice_diagnose, exercise_format_diagnose, sampling_count_diagnose],
|
| 90 |
+
outputs=diagnoser_responses + [standardized_format_display],
|
| 91 |
)
|
| 92 |
|
| 93 |
distractors_button.click(
|
|
|
|
| 102 |
intermediate_distractors_specification,
|
| 103 |
final_distractors_specification,
|
| 104 |
],
|
| 105 |
+
outputs=distractors_responses + [standardized_format_display],
|
| 106 |
)
|
| 107 |
|
| 108 |
# Launch the app.
|