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 16, 2024
1 parent 50819cc commit 4c1c483
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions src/promptflow-evals/promptflow/evals/evaluate/_evaluate.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,11 +306,19 @@ def evaluate(
.. code-block:: python
from promptflow.core import AzureOpenAIModelConfiguration
from promptflow.evals.evaluate import evaluate
from promptflow.evals.evaluators import RelevanceEvaluator, CohereEvaluator
coherence_eval = CohereEvaluator()
relevance_eval = RelevanceEvaluator()
model_config = AzureOpenAIModelConfiguration(
azure_endpoint=os.environ.get("AZURE_OPENAI_ENDPOINT"),
api_key=os.environ.get("AZURE_OPENAI_KEY"),
azure_deployment=os.environ.get("AZURE_OPENAI_DEPLOYMENT")
)
coherence_eval = CohereEvaluator(model_config=model_config)
relevance_eval = RelevanceEvaluator(model_config=model_config)
path = "evaluate_test_data.jsonl"
result = evaluate(
Expand All @@ -321,14 +329,14 @@ def evaluate(
},
evaluator_config={
"coherence": {
"answer": "data.answer",
"context": "data.context",
"question": "data.question"
"answer": "${data.answer}",
"context": "${data.context}",
"question": "${data.question}"
},
"relevance": {
"answer": "data.answer",
"context": "data.context",
"question": "data.question"
"answer": "${data.answer}",
"context": "${data.context}",
"question": "${data.question}"
}
}
)
Expand Down

0 comments on commit 4c1c483

Please sign in to comment.