Spaces:
Running
on
Zero
Running
on
Zero
# --- Dummy Model Summaries --- | |
# Define functions that simulate model summary generation | |
dummy_models = { | |
"Model Alpha": lambda context, question, answerable: f"Alpha Summary: Based on the context for '{question[:20]}...', it appears the question is {'answerable' if answerable else 'unanswerable'}.", | |
"Model Beta": lambda context, question, answerable: f"Beta Summary: Regarding '{question[:20]}...', the provided documents {'allow' if answerable else 'do not allow'} for a conclusive answer based on the text.", | |
"Model Gamma": lambda context, question, answerable: f"Gamma Summary: For the question '{question[:20]}...', I {'can' if answerable else 'cannot'} provide a specific answer from the given text snippets.", | |
"Model Delta (Refusal Specialist)": lambda context, question, answerable: f"Delta Summary: The context for '{question[:20]}...' is {'sufficient' if answerable else 'insufficient'} to formulate a direct response. Therefore, I must refuse." | |
} | |
# List of model names for easy access | |
model_names = list(dummy_models.keys()) | |
def generate_summaries(example, model_a_name, model_b_name): | |
""" | |
Generates summaries for the given example using the assigned models. | |
""" | |
# Create a plain text version of the contexts for the models | |
context_text = "" | |
if "contexts" in example and example["contexts"]: | |
context_parts = [] | |
for ctx in example["contexts"]: | |
if isinstance(ctx, dict) and "content" in ctx: | |
context_parts.append(ctx["content"]) | |
context_text = "\n---\n".join(context_parts) | |
else: | |
# Fallback to full contexts if highlighted contexts are not available | |
context_parts = [] | |
if "full_contexts" in example: | |
for ctx in example["full_contexts"]: | |
if isinstance(ctx, dict) and "content" in ctx: | |
context_parts.append(ctx["content"]) | |
context_text = "\n---\n".join(context_parts) | |
# Pass 'Answerable' status to models (they might use it) | |
answerable = example.get("Answerable", True) | |
question = example.get("question", "") | |
# Call the dummy model functions | |
summary_a = dummy_models[model_a_name](context_text, question, answerable) | |
summary_b = dummy_models[model_b_name](context_text, question, answerable) | |
return summary_a, summary_b | |