You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: validation.py
+25-20Lines changed: 25 additions & 20 deletions
Original file line number
Diff line number
Diff line change
@@ -41,30 +41,21 @@ def get_similarity_score(
41
41
"""
42
42
43
43
prompt=f"""
44
-
You are an AI performance evaluator. Your task is to compare two text snippets and rate their similarity on a scale of 1 to 10, where 1 is completely dissimilar and 10 is identical or semantically equivalent.
45
-
Provide only the integer score in your response.
44
+
Analyze the semantic similarity between the 'expected_output' and the 'actual_output'.
46
45
47
-
Expected Response:
48
-
---
49
-
{expected_text}
50
-
---
46
+
Your task is to rate their similarity on an integer scale from 1 to 10.
47
+
- A score of 1 means they are completely dissimilar in meaning, topic, and intent.
48
+
- **A score of 7-9 means the actual output contains all the critical information of the expected output, but also includes additional, relevant explanations or details.**
49
+
- A score of 10 means they are semantically identical, conveying the exact same information and intent, even if phrasing differs.
51
50
52
-
Actual Response:
53
-
---
54
-
{actual_text}
55
51
---
56
-
57
-
Similarity Score (1-10):
52
+
"expected_output": "{expected_text}"
53
+
"actual_output": "{actual_text}"
58
54
"""
59
-
60
55
try:
61
56
response=llm_client.chat.completions.create(
62
57
model=llm_model,
63
58
messages=[
64
-
{
65
-
"role": "system",
66
-
"content": "You are a helpful assistant that provides similarity scores.",
0 commit comments