Skip to content
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
1 change: 1 addition & 0 deletions sdk/ai/azure-ai-projects/apiview-properties.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"azure.ai.projects.models.EntraIDCredentials": "Azure.AI.Projects.EntraIDCredentials",
"azure.ai.projects.models.Evaluation": "Azure.AI.Projects.Evaluation",
"azure.ai.projects.models.EvaluatorConfiguration": "Azure.AI.Projects.EvaluatorConfiguration",
"azure.ai.projects.models.FieldMapping": "Azure.AI.Projects.FieldMapping",
"azure.ai.projects.models.FileDatasetVersion": "Azure.AI.Projects.FileDatasetVersion",
"azure.ai.projects.models.FolderDatasetVersion": "Azure.AI.Projects.FolderDatasetVersion",
"azure.ai.projects.models.InputData": "Azure.AI.Projects.InputData",
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ async def get_azure_openai_client(
connection = await connections.__aiter__().__anext__()
except StopAsyncIteration as exc:
raise ResourceNotFoundError("No default Azure OpenAI connection found.") from exc
connection_name = connection.name

# TODO: if there isn't a default openai connection, we would have to by convention
# use https://{resource-name}.openai.azure.com where {resource-name} is the same as the
Expand Down
2 changes: 2 additions & 0 deletions sdk/ai/azure-ai-projects/azure/ai/projects/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
EntraIDCredentials,
Evaluation,
EvaluatorConfiguration,
FieldMapping,
FileDatasetVersion,
FolderDatasetVersion,
Index,
Expand Down Expand Up @@ -86,6 +87,7 @@
"EntraIDCredentials",
"Evaluation",
"EvaluatorConfiguration",
"FieldMapping",
"FileDatasetVersion",
"FolderDatasetVersion",
"Index",
Expand Down
133 changes: 102 additions & 31 deletions sdk/ai/azure-ai-projects/azure/ai/projects/models/_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,8 @@ class AgentEvaluationResult(_Model):
:ivar evaluator: Evaluator's name. This is the name of the evaluator that was used to evaluate
the agent's completion. Required.
:vartype evaluator: str
:ivar evaluator_id: Identifier of the evaluator. Required.
:vartype evaluator_id: str
:ivar score: Score of the given evaluator. No restriction on range. Required.
:vartype score: float
:ivar status: Status of the evaluator result. Options: Running, Completed, Failed,
Expand All @@ -188,6 +190,8 @@ class AgentEvaluationResult(_Model):
evaluator: str = rest_field(visibility=["read", "create", "update", "delete", "query"])
"""Evaluator's name. This is the name of the evaluator that was used to evaluate the agent's
completion. Required."""
evaluator_id: str = rest_field(name="evaluatorId", visibility=["read", "create", "update", "delete", "query"])
"""Identifier of the evaluator. Required."""
score: float = rest_field(visibility=["read", "create", "update", "delete", "query"])
"""Score of the given evaluator. No restriction on range. Required."""
status: str = rest_field(visibility=["read", "create", "update", "delete", "query"])
Expand All @@ -212,6 +216,7 @@ def __init__(
self,
*,
evaluator: str,
evaluator_id: str,
score: float,
status: str,
run_id: str,
Expand Down Expand Up @@ -445,6 +450,8 @@ class AzureAISearchIndex(Index, discriminator="AzureSearch"):
:vartype connection_name: str
:ivar index_name: Name of index in Azure AI Search resource to attach. Required.
:vartype index_name: str
:ivar field_mapping: Field mapping configuration.
:vartype field_mapping: ~azure.ai.projects.models.FieldMapping
"""

type: Literal[IndexType.AZURE_SEARCH] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore
Expand All @@ -453,6 +460,8 @@ class AzureAISearchIndex(Index, discriminator="AzureSearch"):
"""Name of connection to Azure AI Search. Required."""
index_name: str = rest_field(name="indexName", visibility=["create"])
"""Name of index in Azure AI Search resource to attach. Required."""
field_mapping: Optional["_models.FieldMapping"] = rest_field(name="fieldMapping", visibility=["create"])
"""Field mapping configuration."""

@overload
def __init__(
Expand All @@ -462,6 +471,7 @@ def __init__(
index_name: str,
description: Optional[str] = None,
tags: Optional[Dict[str, str]] = None,
field_mapping: Optional["_models.FieldMapping"] = None,
) -> None: ...

@overload
Expand Down Expand Up @@ -589,8 +599,10 @@ def __init__(self, *args: Any, **kwargs: Any) -> None:
class Connection(_Model):
"""Response from the list and get connections operations.

:ivar name: The name of the resource. Required.
:ivar name: The friendly name of the connection, provided by the user. Required.
:vartype name: str
:ivar id: A unique identifier for the connection, generated by the service. Required.
:vartype id: str
:ivar type: Category of the connection. Required. Known values are: "AzureOpenAI", "AzureBlob",
"AzureStorageAccount", "CognitiveSearch", "CosmosDB", "ApiKey", "AppConfig", "AppInsights", and
"CustomKeys".
Expand All @@ -607,7 +619,9 @@ class Connection(_Model):
"""

name: str = rest_field(visibility=["read"])
"""The name of the resource. Required."""
"""The friendly name of the connection, provided by the user. Required."""
id: str = rest_field(visibility=["read"])
"""A unique identifier for the connection, generated by the service. Required."""
type: Union[str, "_models.ConnectionType"] = rest_field(visibility=["read"])
"""Category of the connection. Required. Known values are: \"AzureOpenAI\", \"AzureBlob\",
\"AzureStorageAccount\", \"CognitiveSearch\", \"CosmosDB\", \"ApiKey\", \"AppConfig\",
Expand Down Expand Up @@ -645,6 +659,8 @@ class CosmosDBIndex(Index, discriminator="CosmosDBNoSqlVectorStore"):
:vartype container_name: str
:ivar embedding_configuration: Embedding model configuration. Required.
:vartype embedding_configuration: ~azure.ai.projects.models.EmbeddingConfiguration
:ivar field_mapping: Field mapping configuration. Required.
:vartype field_mapping: ~azure.ai.projects.models.FieldMapping
"""

type: Literal[IndexType.COSMOS_DB] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore
Expand All @@ -659,6 +675,8 @@ class CosmosDBIndex(Index, discriminator="CosmosDBNoSqlVectorStore"):
name="embeddingConfiguration", visibility=["create"]
)
"""Embedding model configuration. Required."""
field_mapping: "_models.FieldMapping" = rest_field(name="fieldMapping", visibility=["create"])
"""Field mapping configuration. Required."""

@overload
def __init__(
Expand All @@ -668,6 +686,7 @@ def __init__(
database_name: str,
container_name: str,
embedding_configuration: "_models.EmbeddingConfiguration",
field_mapping: "_models.FieldMapping",
description: Optional[str] = None,
tags: Optional[Dict[str, str]] = None,
) -> None: ...
Expand Down Expand Up @@ -988,6 +1007,59 @@ def __init__(self, *args: Any, **kwargs: Any) -> None:
super().__init__(*args, **kwargs)


class FieldMapping(_Model):
"""Field mapping configuration class.

:ivar content_fields: List of fields with text content. Required.
:vartype content_fields: list[str]
:ivar filepath_field: Path of file to be used as a source of text content.
:vartype filepath_field: str
:ivar title_field: Field containing the title of the document.
:vartype title_field: str
:ivar url_field: Field containing the url of the document.
:vartype url_field: str
:ivar vector_fields: List of fields with vector content.
:vartype vector_fields: list[str]
:ivar metadata_fields: List of fields with metadata content.
:vartype metadata_fields: list[str]
"""

content_fields: List[str] = rest_field(name="contentFields", visibility=["create"])
"""List of fields with text content. Required."""
filepath_field: Optional[str] = rest_field(name="filepathField", visibility=["create"])
"""Path of file to be used as a source of text content."""
title_field: Optional[str] = rest_field(name="titleField", visibility=["create"])
"""Field containing the title of the document."""
url_field: Optional[str] = rest_field(name="urlField", visibility=["create"])
"""Field containing the url of the document."""
vector_fields: Optional[List[str]] = rest_field(name="vectorFields", visibility=["create"])
"""List of fields with vector content."""
metadata_fields: Optional[List[str]] = rest_field(name="metadataFields", visibility=["create"])
"""List of fields with metadata content."""

@overload
def __init__(
self,
*,
content_fields: List[str],
filepath_field: Optional[str] = None,
title_field: Optional[str] = None,
url_field: Optional[str] = None,
vector_fields: Optional[List[str]] = None,
metadata_fields: Optional[List[str]] = None,
) -> None: ...

@overload
def __init__(self, mapping: Mapping[str, Any]) -> None:
"""
:param mapping: raw JSON to initialize the model.
:type mapping: Mapping[str, Any]
"""

def __init__(self, *args: Any, **kwargs: Any) -> None:
super().__init__(*args, **kwargs)


class FileDatasetVersion(DatasetVersion, discriminator="uri_file"):
"""FileDatasetVersion Definition.

Expand Down Expand Up @@ -1364,19 +1436,18 @@ def __init__(self, *args: Any, **kwargs: Any) -> None:
class RedTeam(_Model):
"""Red team details.

:ivar name: Identifier of the red team. Required.
:ivar name: Identifier of the red team run. Required.
:vartype name: str
:ivar scan_name: Name of the red-team scan.
:vartype scan_name: str
:ivar num_turns: Number of simulation rounds. Required.
:ivar display_name: Name of the red-team run.
:vartype display_name: str
:ivar num_turns: Number of simulation rounds.
:vartype num_turns: int
:ivar attack_strategies: List of attack strategies or nested lists of attack strategies.
Required.
:vartype attack_strategies: list[str or ~azure.ai.projects.models.AttackStrategy]
:ivar simulation_only: Simulation-only or Simulation + Evaluation. Default false, if true the
scan outputs conversation not evaluation result. Required.
scan outputs conversation not evaluation result.
:vartype simulation_only: bool
:ivar risk_categories: List of risk categories to generate attack objectives for. Required.
:ivar risk_categories: List of risk categories to generate attack objectives for.
:vartype risk_categories: list[str or ~azure.ai.projects.models.RiskCategory]
:ivar application_scenario: Application scenario for the red team operation, to generate
scenario specific attacks.
Expand All @@ -1388,29 +1459,31 @@ class RedTeam(_Model):
:vartype properties: dict[str, str]
:ivar status: Status of the red-team. It is set by service and is read-only.
:vartype status: str
:ivar target_config: Target configuration for the red-team run. Required.
:vartype target_config: ~azure.ai.projects.models.TargetConfig
:ivar target: Target configuration for the red-team run. Required.
:vartype target: ~azure.ai.projects.models.TargetConfig
"""

name: str = rest_field(name="id", visibility=["read"])
"""Identifier of the red team. Required."""
scan_name: Optional[str] = rest_field(name="scanName", visibility=["read", "create", "update", "delete", "query"])
"""Name of the red-team scan."""
num_turns: int = rest_field(name="numTurns", visibility=["read", "create", "update", "delete", "query"])
"""Number of simulation rounds. Required."""
attack_strategies: List[Union[str, "_models.AttackStrategy"]] = rest_field(
"""Identifier of the red team run. Required."""
display_name: Optional[str] = rest_field(
name="displayName", visibility=["read", "create", "update", "delete", "query"]
)
"""Name of the red-team run."""
num_turns: Optional[int] = rest_field(name="numTurns", visibility=["read", "create", "update", "delete", "query"])
"""Number of simulation rounds."""
attack_strategies: Optional[List[Union[str, "_models.AttackStrategy"]]] = rest_field(
name="attackStrategies", visibility=["read", "create", "update", "delete", "query"]
)
"""List of attack strategies or nested lists of attack strategies. Required."""
simulation_only: bool = rest_field(
"""List of attack strategies or nested lists of attack strategies."""
simulation_only: Optional[bool] = rest_field(
name="simulationOnly", visibility=["read", "create", "update", "delete", "query"]
)
"""Simulation-only or Simulation + Evaluation. Default false, if true the scan outputs
conversation not evaluation result. Required."""
risk_categories: List[Union[str, "_models.RiskCategory"]] = rest_field(
conversation not evaluation result."""
risk_categories: Optional[List[Union[str, "_models.RiskCategory"]]] = rest_field(
name="riskCategories", visibility=["read", "create", "update", "delete", "query"]
)
"""List of risk categories to generate attack objectives for. Required."""
"""List of risk categories to generate attack objectives for."""
application_scenario: Optional[str] = rest_field(
name="applicationScenario", visibility=["read", "create", "update", "delete", "query"]
)
Expand All @@ -1422,21 +1495,19 @@ class RedTeam(_Model):
removed."""
status: Optional[str] = rest_field(visibility=["read"])
"""Status of the red-team. It is set by service and is read-only."""
target_config: "_models.TargetConfig" = rest_field(
name="targetConfig", visibility=["read", "create", "update", "delete", "query"]
)
target: "_models.TargetConfig" = rest_field(visibility=["read", "create", "update", "delete", "query"])
"""Target configuration for the red-team run. Required."""

@overload
def __init__(
self,
*,
num_turns: int,
attack_strategies: List[Union[str, "_models.AttackStrategy"]],
simulation_only: bool,
risk_categories: List[Union[str, "_models.RiskCategory"]],
target_config: "_models.TargetConfig",
scan_name: Optional[str] = None,
target: "_models.TargetConfig",
display_name: Optional[str] = None,
num_turns: Optional[int] = None,
attack_strategies: Optional[List[Union[str, "_models.AttackStrategy"]]] = None,
simulation_only: Optional[bool] = None,
risk_categories: Optional[List[Union[str, "_models.RiskCategory"]]] = None,
application_scenario: Optional[str] = None,
tags: Optional[Dict[str, str]] = None,
properties: Optional[Dict[str, str]] = None,
Expand Down
Loading
Loading