Skip to content

Commit

Permalink
Adding example to doc string
Browse files Browse the repository at this point in the history
  • Loading branch information
singankit committed May 15, 2024
1 parent ab37789 commit 50819cc
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions src/promptflow-evals/promptflow/evals/evaluate/_evaluate.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,40 @@ def evaluate(
:paramtype azure_ai_project: Optional[Dict]
:return: Evaluation results.
:rtype: dict
:Example:
Evaluate API can be used as follows:
.. code-block:: python
from promptflow.evals.evaluate import evaluate
from promptflow.evals.evaluators import RelevanceEvaluator, CohereEvaluator
coherence_eval = CohereEvaluator()
relevance_eval = RelevanceEvaluator()
path = "evaluate_test_data.jsonl"
result = evaluate(
data=path,
evaluators={
"coherence": coherence_eval,
"relevance": relevance_eval,
},
evaluator_config={
"coherence": {
"answer": "data.answer",
"context": "data.context",
"question": "data.question"
},
"relevance": {
"answer": "data.answer",
"context": "data.context",
"question": "data.question"
}
}
)
"""

trace_destination = _trace_destination_from_project_scope(azure_ai_project) if azure_ai_project else None
Expand Down

0 comments on commit 50819cc

Please sign in to comment.