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
See the examples below for guidance on how to use specific features supported by the Gen AI SDK client.
28
+
29
+
Gen AI Evaluation
30
+
^^^^^^^^^^^^^^^^^
31
+
32
+
To run evaluation, first generate model responses from a set of prompts.
33
+
34
+
.. code-block:: Python
35
+
36
+
import pandas as pd
37
+
38
+
prompts_df = pd.DataFrame({
39
+
"prompt": [
40
+
"What is the capital of France?",
41
+
"Write a haiku about a cat.",
42
+
"Write a Python function to calculate the factorial of a number.",
43
+
"Translate 'How are you?' to French.",
44
+
],
45
+
46
+
"reference": [
47
+
"Paris",
48
+
"Sunbeam on the floor,\nA furry puddle sleeping,\nTwitching tail tells tales.",
49
+
"def factorial(n):\n if n < 0:\n return 'Factorial does not exist for negative numbers'\n elif n == 0:\n return 1\n else:\n fact = 1\n i = 1\n while i <= n:\n fact *= i\n i += 1\n return fact",
50
+
"Comment ça va ?",
51
+
]
52
+
})
53
+
54
+
inference_results = client.evals.run_inference(
55
+
model="gemini-2.5-flash-preview-05-20",
56
+
src=prompts_df
57
+
)
58
+
59
+
Then run evaluation by providing the inference results and specifying the metric types.
0 commit comments