from fi.evals import Evaluator
from fi.evals.templates import ScoreEval
from fi.testcases import MLLMTestCase
test_case = MLLMTestCase(
input="Score the sunset beach photo's composition and atmosphere",
rule_string="""
Evaluate:
1. Golden hour lighting quality
2. Rule of thirds composition
3. Foreground to background balance
4. Color harmony and mood
"""
)
template = ScoreEval(
config={
"input": {
"type": "rule_string",
"default": ["composition", "lighting", "atmosphere"]
},
"rulePrompt": {
"type": "rule_prompt",
"default": """
Provide a score based on:
- Composition (0-0.25): Rule of thirds, leading lines
- Lighting (0-0.25): Quality of light, shadows, highlights
- Atmosphere (0-0.25): Mood, emotional impact
- Technical (0-0.25): Focus, exposure, clarity
"""
}
}
)
evaluator = Evaluator(
fi_api_key="your_api_key",
fi_secret_key="your_secret_key",
fi_base_url="<https://api.futureagi.com>"
)
result = evaluator.evaluate(eval_templates=[template], inputs=[test_case], model_name="turing_flash")
score = result.eval_results[0].metrics[0].value
reason = result.eval_results[0].reason
print(f"Evaluation Score: {score}")
print(f"Evaluation Reason: {reason}")