Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multi modal docstring improvements #38193

Merged
merged 4 commits into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ class ContentSafetyMultimodalEvaluator:
:type parallel: bool

:return: A function that evaluates multimodal chat messages and generates content safety metrics.
:rtype: Callable

**Usage Example**

Expand All @@ -45,7 +44,7 @@ class ContentSafetyMultimodalEvaluator:
"project_name": "<project_name>",
}
eval_fn = ContentSafetyMultimodalEvaluator(azure_ai_project)
result = eval_fn(
result = eval_fn(conversation=
{
"messages": [
{
Expand Down Expand Up @@ -104,8 +103,9 @@ def __init__(self, credential, azure_ai_project, parallel: bool = False):
def __call__(self, *, conversation, **kwargs):
"""
Evaluates content-safety metrics for list of messages.

:keyword conversation: The conversation contains list of messages to be evaluated.
Each message should have "role" and "content" keys.
Each message should have "role" and "content" keys. It supports single turn only.
:paramtype conversation: ~azure.ai.evaluation.Conversation
:return: The evaluation score based on the Content Safety Metrics.
:rtype: Dict[str, Union[float, str]]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class HateUnfairnessMultimodalEvaluator:
"project_name": "<project_name>",
}
eval_fn = HateUnfairnessMultimodalEvaluator(azure_ai_project)
result = eval_fn(
result = eval_fn(conversation=
{
"messages": [
{
Expand Down Expand Up @@ -72,8 +72,9 @@ def __init__(self, credential, azure_ai_project):
def __call__(self, *, conversation, **kwargs):
"""
Evaluates hate unfairness content.

:keyword conversation: The conversation contains list of messages to be evaluated.
Each message should have "role" and "content" keys.
Each message should have "role" and "content" keys. It supports single turn only.
:paramtype conversation: ~azure.ai.evaluation.Conversation
:return: The hate unfairness score.
:rtype: Dict[str, Union[float, str]]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ class ProtectedMaterialMultimodalEvaluator:
:type azure_ai_project: ~azure.ai.evaluation.AzureAIProject

:return: A dictionary containing the evaluation result label and reasoning.
:rtype: Dict[str, str]

**Usage Example**

Expand All @@ -34,7 +33,7 @@ class ProtectedMaterialMultimodalEvaluator:
"project_name": "<project_name>",
}
eval_fn = ProtectedMaterialMultimodalEvaluator(azure_ai_project)
result = eval_fn(
result = eval_fn(conversation=
{
"messages": [
{
Expand Down Expand Up @@ -82,8 +81,9 @@ def __call__(self, *, conversation, **kwargs):
"""
Evaluates protected materials content.

:keyword messages: The messages to be evaluated. Each message should have "role" and "content" keys.
:paramtype messages: ~azure.ai.evaluation.Conversation
:keyword conversation: The conversation contains list of messages to be evaluated.
Each message should have "role" and "content" keys. It supports single turn only.
:paramtype conversation: ~azure.ai.evaluation.Conversation
:return: A dictionary containing a boolean label and reasoning.
:rtype: Dict[str, str]
"""
Expand All @@ -101,8 +101,9 @@ def __init__(self, credential, azure_ai_project):
async def __call__(self, *, conversation, **kwargs):
"""
Evaluates content according to this evaluator's metric.

:keyword conversation: The conversation contains list of messages to be evaluated.
Each message should have "role" and "content" keys.
Each message should have "role" and "content" keys. It supports single turn only.
:paramtype conversation: ~azure.ai.evaluation.Conversation
:return: The evaluation score computation based on the Content Safety metric (self.metric).
:rtype: Any
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class SelfHarmMultimodalEvaluator:
"project_name": "<project_name>",
}
eval_fn = SelfHarmMultimodalEvaluator(azure_ai_project)
result = eval_fn(
result = eval_fn(conversation=
{
"messages": [
{
Expand Down Expand Up @@ -72,8 +72,9 @@ def __init__(self, credential, azure_ai_project):
def __call__(self, *, conversation, **kwargs):
"""
Evaluates self harm content.

:keyword conversation: The conversation contains list of messages to be evaluated.
Each message should have "role" and "content" keys.
Each message should have "role" and "content" keys. It supports single turn only.
:paramtype conversation: ~azure.ai.evaluation.Conversation
:return: The self harm score.
:rtype: Dict[str, Union[float, str]]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class SexualMultimodalEvaluator:
"project_name": "<project_name>",
}
eval_fn = SexualMultimodalEvaluator(azure_ai_project)
result = eval_fn(
result = eval_fn(conversation=
{
"messages": [
{
Expand Down Expand Up @@ -72,8 +72,9 @@ def __init__(self, credential, azure_ai_project):
def __call__(self, *, conversation, **kwargs):
"""
Evaluates sexual content.

:keyword conversation: The conversation contains list of messages to be evaluated.
Each message should have "role" and "content" keys.
Each message should have "role" and "content" keys. It supports single turn only.
:paramtype conversation: ~azure.ai.evaluation.Conversation
:return: The sexual score.
:rtype: Dict[str, Union[float, str]]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class ViolenceMultimodalEvaluator:
"project_name": "<project_name>",
}
eval_fn = ViolenceMultimodalEvaluator(azure_ai_project)
result = eval_fn(
result = eval_fn(conversation=
{
"messages": [
{
Expand Down Expand Up @@ -72,8 +72,9 @@ def __init__(self, credential, azure_ai_project):
def __call__(self, *, conversation, **kwargs):
"""
Evaluates violence content.

:keyword conversation: The conversation contains list of messages to be evaluated.
Each message should have "role" and "content" keys.
Each message should have "role" and "content" keys. It supports single turn only.
:paramtype conversation: ~azure.ai.evaluation.Conversation
:return: The violence score.
:rtype: Dict[str, Union[float, str]]
Expand Down