(no commit message)

This commit is contained in:
2025-10-29 18:24:50 -04:00
parent 6475810170
commit e26020f40c
4 changed files with 91 additions and 4 deletions

31
agent/metrics.py Normal file
View File

@@ -0,0 +1,31 @@
import dspy
def validate_signature_with_feedback(
args, pred, feedback=None, satisfied_with_score=True
):
"""Validation function for dspy.Refine that asks user for feedback"""
# Display the generated signature
print("\n" + "=" * 60)
print("🔍 Review Generated Signature")
print("=" * 60)
# Show the signature name and description
print(f"Signature Name: {pred.signature_name}")
print(f"Description: {pred.task_description}")
# Show the fields in a simple format
print(f"\nFields ({len(pred.signature_fields)}):")
for i, field in enumerate(pred.signature_fields, 1):
role_emoji = "📥" if field.role.value == "input" else "📤"
print(
f" {i}. {role_emoji} {field.name} ({field.type.value}) - {field.description}"
)
if satisfied_with_score:
print("✓ Signature approved!")
return 1.0
else:
print(f"📝 Feedback recorded: {feedback}")
return dspy.Prediction(score=0.0, feedback=feedback)