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/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
* New `.beta.datasets` sub-client with data generation job operations: `create_generation_job`, `get_generation_job`, `list_generation_jobs`, `cancel_generation_job`, `delete_generation_job`.
* New read-only property `content_hash` on `CodeConfiguration`, returning the SHA-256 hex digest of the uploaded code zip.
* New evaluator generation job operations on `.beta.evaluators`: `create_generation_job`, `get_generation_job`, `list_generation_jobs`, `cancel_generation_job`, `delete_generation_job`.
* New methods on `.beta.agents` sub-client for code-based hosted agents: `update_agent_from_code()`, `create_agent_version_from_code()`, `download_agent_version_code()`, `download_agent_code()`.

### Breaking Changes

Expand Down
4 changes: 3 additions & 1 deletion sdk/ai/azure-ai-projects/apiview-properties.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@
"azure.ai.projects.models.EvaluationRuleAction": "Azure.AI.Projects.EvaluationRuleAction",
"azure.ai.projects.models.ContinuousEvaluationRuleAction": "Azure.AI.Projects.ContinuousEvaluationRuleAction",
"azure.ai.projects.models.CosmosDBIndex": "Azure.AI.Projects.CosmosDBIndex",
"azure.ai.projects.models.CreateAgentVersionFromCodeContent": "Azure.AI.Projects.CreateAgentVersionFromCodeContent",
"azure.ai.projects.models.CreateAgentVersionFromCodeRequest": "Azure.AI.Projects.CreateAgentVersionFromCodeRequest",
"azure.ai.projects.models.Trigger": "Azure.AI.Projects.Trigger",
"azure.ai.projects.models.CronTrigger": "Azure.AI.Projects.CronTrigger",
"azure.ai.projects.models.CustomCredential": "Azure.AI.Projects.CustomCredential",
Expand Down Expand Up @@ -239,7 +241,6 @@
"azure.ai.projects.models.SpecificFunctionShellParam": "OpenAI.SpecificFunctionShellParam",
"azure.ai.projects.models.StructuredInputDefinition": "Azure.AI.Projects.StructuredInputDefinition",
"azure.ai.projects.models.StructuredOutputDefinition": "Azure.AI.Projects.StructuredOutputDefinition",
"azure.ai.projects.models.TaskDataGenerationJobOptions": "Azure.AI.Projects.TaskDataGenerationJobOptions",
"azure.ai.projects.models.TaxonomyCategory": "Azure.AI.Projects.TaxonomyCategory",
"azure.ai.projects.models.TaxonomySubCategory": "Azure.AI.Projects.TaxonomySubCategory",
"azure.ai.projects.models.TelemetryConfig": "Azure.AI.Projects.TelemetryConfig",
Expand Down Expand Up @@ -298,6 +299,7 @@
"azure.ai.projects.models.ContainerSkillType": "OpenAI.ContainerSkillType",
"azure.ai.projects.models.SearchContextSize": "OpenAI.SearchContextSize",
"azure.ai.projects.models.AgentProtocol": "Azure.AI.Projects.AgentProtocol",
"azure.ai.projects.models.CodeDependencyResolution": "Azure.AI.Projects.CodeDependencyResolution",
"azure.ai.projects.models.TelemetryEndpointKind": "Azure.AI.Projects.TelemetryEndpointKind",
"azure.ai.projects.models.TelemetryDataKind": "Azure.AI.Projects.TelemetryDataKind",
"azure.ai.projects.models.TelemetryEndpointAuthType": "Azure.AI.Projects.TelemetryEndpointAuthType",
Expand Down
2 changes: 1 addition & 1 deletion sdk/ai/azure-ai-projects/assets.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"AssetsRepo": "Azure/azure-sdk-assets",
"AssetsRepoPrefixPath": "python",
"TagPrefix": "python/ai/azure-ai-projects",
"Tag": "python/ai/azure-ai-projects_33354b389b"
"Tag": "python/ai/azure-ai-projects_f15b61b44c"
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

from .._utils.model_base import Model, SdkJSONEncoder


# file-like tuple could be `(filename, IO (or bytes))` or `(filename, IO (or bytes), content_type)`
FileContent = Union[str, bytes, IO[str], IO[bytes]]

Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class BetaOperations(GeneratedBetaOperations):
skills: BetaSkillsOperations
""":class:`~azure.ai.projects.aio.operations.BetaSkillsOperations` operations"""
datasets: BetaDatasetsOperations
""":class:`~azure.ai.projects.aio.operations.BetaDatasetsOperations` operations"""
""":class:`~azure.ai.projects.aio.operations.BetaDatasetsOperations` operations"""

def __init__(self, *args: Any, **kwargs: Any) -> None:
super().__init__(*args, **kwargs)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@
ContainerSkill,
ContinuousEvaluationRuleAction,
CosmosDBIndex,
CreateAgentVersionFromCodeContent,
CreateAgentVersionFromCodeRequest,
CronTrigger,
CustomCredential,
CustomGrammarFormatParam,
Expand Down Expand Up @@ -246,7 +248,6 @@
StructuredOutputDefinition,
Target,
TargetConfig,
TaskDataGenerationJobOptions,
TaxonomyCategory,
TaxonomySubCategory,
TelemetryConfig,
Expand Down Expand Up @@ -307,6 +308,7 @@
AgentVersionStatus,
AttackStrategy,
AzureAISearchQueryType,
CodeDependencyResolution,
ComputerEnvironment,
ConnectionType,
ContainerMemoryLimit,
Expand Down Expand Up @@ -443,6 +445,8 @@
"ContainerSkill",
"ContinuousEvaluationRuleAction",
"CosmosDBIndex",
"CreateAgentVersionFromCodeContent",
"CreateAgentVersionFromCodeRequest",
"CronTrigger",
"CustomCredential",
"CustomGrammarFormatParam",
Expand Down Expand Up @@ -604,7 +608,6 @@
"StructuredOutputDefinition",
"Target",
"TargetConfig",
"TaskDataGenerationJobOptions",
"TaxonomyCategory",
"TaxonomySubCategory",
"TelemetryConfig",
Expand Down Expand Up @@ -662,6 +665,7 @@
"AgentVersionStatus",
"AttackStrategy",
"AzureAISearchQueryType",
"CodeDependencyResolution",
"ComputerEnvironment",
"ConnectionType",
"ContainerMemoryLimit",
Expand Down
15 changes: 12 additions & 3 deletions sdk/ai/azure-ai-projects/azure/ai/projects/models/_enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ class _AgentDefinitionOptInKeys(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""CONTAINER_AGENTS_V1_PREVIEW."""
AGENT_ENDPOINT_V1_PREVIEW = "AgentEndpoints=V1Preview"
"""AGENT_ENDPOINT_V1_PREVIEW."""
CODE_AGENTS_V1_PREVIEW = "CodeAgents=V1Preview"
"""CODE_AGENTS_V1_PREVIEW."""


class _FoundryFeaturesOptInKeys(str, Enum, metaclass=CaseInsensitiveEnumMeta):
Expand Down Expand Up @@ -234,6 +236,16 @@ class AzureAISearchQueryType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Query type ``vector_semantic_hybrid``."""


class CodeDependencyResolution(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""How package dependencies are resolved at deployment time for a code-based hosted agent."""

BUNDLED = "bundled"
"""The caller has bundled all dependencies into the uploaded zip; the service performs no remote
build."""
REMOTE_BUILD = "remote_build"
"""The service builds dependencies remotely from the manifest included in the uploaded zip."""


class ComputerEnvironment(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Type of ComputerEnvironment."""

Expand Down Expand Up @@ -375,9 +387,6 @@ class DataGenerationJobType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
"""Single turn query and response from agent traces."""
TOOL_USE = "tool_use"
"""Tool calling conversation between user and agent."""
TASK = "task"
"""Task helps in providing a scenario description for generating multi turn conversation between
user and agent."""


class DatasetType(str, Enum, metaclass=CaseInsensitiveEnumMeta):
Expand Down
174 changes: 120 additions & 54 deletions sdk/ai/azure-ai-projects/azure/ai/projects/models/_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from typing import Any, Literal, Mapping, Optional, TYPE_CHECKING, Union, overload

from .._utils.model_base import Model as _Model, rest_discriminator, rest_field
from .._utils.utils import FileType
from ._enums import (
AgentBlueprintReferenceType,
AgentEndpointAuthorizationSchemeType,
Expand Down Expand Up @@ -2926,6 +2927,12 @@ class CodeConfiguration(_Model):
:vartype runtime: str
:ivar entry_point: The entry point command and arguments for the code execution. Required.
:vartype entry_point: list[str]
:ivar dependency_resolution: How package dependencies are resolved at deployment time. Defaults
to ``bundled``, where the caller bundles all dependencies into the uploaded zip and the service
performs no remote build. ``remote_build`` instructs the service to build dependencies remotely
from the manifest included in the uploaded zip. Required. Known values are: "bundled" and
"remote_build".
:vartype dependency_resolution: str or ~azure.ai.projects.models.CodeDependencyResolution
:ivar content_hash: The SHA-256 hex digest of the uploaded code zip. Set by the service from
the ``x-ms-code-zip-sha256`` request header; read-only in responses and never accepted in
request payloads.
Expand All @@ -2937,6 +2944,13 @@ class CodeConfiguration(_Model):
Required."""
entry_point: list[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
"""The entry point command and arguments for the code execution. Required."""
dependency_resolution: Union[str, "_models.CodeDependencyResolution"] = rest_field(
visibility=["read", "create", "update", "delete", "query"]
)
"""How package dependencies are resolved at deployment time. Defaults to ``bundled``, where the
caller bundles all dependencies into the uploaded zip and the service performs no remote build.
``remote_build`` instructs the service to build dependencies remotely from the manifest
included in the uploaded zip. Required. Known values are: \"bundled\" and \"remote_build\"."""
content_hash: Optional[str] = rest_field(visibility=["read"])
"""The SHA-256 hex digest of the uploaded code zip. Set by the service from the
``x-ms-code-zip-sha256`` request header; read-only in responses and never accepted in request
Expand All @@ -2948,6 +2962,7 @@ def __init__(
*,
runtime: str,
entry_point: list[str],
dependency_resolution: Union[str, "_models.CodeDependencyResolution"],
) -> None: ...

@overload
Expand Down Expand Up @@ -3633,6 +3648,97 @@ def __init__(self, *args: Any, **kwargs: Any) -> None:
self.type = IndexType.COSMOS_DB # type: ignore


class CreateAgentVersionFromCodeContent(_Model):
"""Multipart request body for updating or versioning a code-based agent (POST /agents/{name} and
POST /agents/{name}/versions).

:ivar metadata: JSON metadata including description and hosted definition. Required.
:vartype metadata: ~azure.ai.projects.models.CreateAgentVersionFromCodeRequest
:ivar code: The code zip file (max 250 MB). Required.
:vartype code: ~azure.ai.projects._utils.utils.FileType
"""

metadata: "_models.CreateAgentVersionFromCodeRequest" = rest_field(
visibility=["read", "create", "update", "delete", "query"]
)
"""JSON metadata including description and hosted definition. Required."""
code: FileType = rest_field(
visibility=["read", "create", "update", "delete", "query"], is_multipart_file_input=True
)
"""The code zip file (max 250 MB). Required."""

@overload
def __init__(
self,
*,
metadata: "_models.CreateAgentVersionFromCodeRequest",
code: FileType,
) -> 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 CreateAgentVersionFromCodeRequest(_Model):
"""JSON metadata for code-based agent operations (create, update, create version). The agent name
comes from the URL path parameter or the ``x-ms-agent-name`` header, so it is not included in
this model. The content hash (SHA-256 of the zip) is carried in the ``x-ms-code-zip-sha256``
header.

:ivar description: A human-readable description of the agent.
:vartype description: str
:ivar metadata: Set of 16 key-value pairs that can be attached to an object. This can be
useful for storing additional information about the object in a structured
format, and querying for objects via API or the dashboard.

Keys are strings with a maximum length of 64 characters. Values are strings
with a maximum length of 512 characters.
:vartype metadata: dict[str, str]
:ivar definition: The hosted agent definition including code_configuration (runtime,
entry_point), cpu, memory, and protocol_versions. Required.
:vartype definition: ~azure.ai.projects.models.HostedAgentDefinition
"""

description: Optional[str] = rest_field(visibility=["read", "create", "update", "delete", "query"])
"""A human-readable description of the agent."""
metadata: Optional[dict[str, str]] = rest_field(visibility=["read", "create", "update", "delete", "query"])
"""Set of 16 key-value pairs that can be attached to an object. This can be
useful for storing additional information about the object in a structured
format, and querying for objects via API or the dashboard.

Keys are strings with a maximum length of 64 characters. Values are strings
with a maximum length of 512 characters."""
definition: "_models.HostedAgentDefinition" = rest_field(visibility=["read", "create", "update", "delete", "query"])
"""The hosted agent definition including code_configuration (runtime, entry_point), cpu, memory,
and protocol_versions. Required."""

@overload
def __init__(
self,
*,
definition: "_models.HostedAgentDefinition",
description: Optional[str] = None,
metadata: Optional[dict[str, 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 Trigger(_Model):
"""Base model for Trigger of the schedule.

Expand Down Expand Up @@ -4073,11 +4179,11 @@ class DataGenerationJobOptions(_Model):
"""Options for managing data generation jobs.

You probably want to use the sub-classes and not this class directly. Known sub-classes are:
SimpleQnADataGenerationJobOptions, TaskDataGenerationJobOptions,
ToolUseFineTuningDataGenerationJobOptions, TracesDataGenerationJobOptions
SimpleQnADataGenerationJobOptions, ToolUseFineTuningDataGenerationJobOptions,
TracesDataGenerationJobOptions

:ivar type: The data generation job type. Required. Known values are: "simple_qna", "traces",
"tool_use", and "task".
and "tool_use".
:vartype type: str or ~azure.ai.projects.models.DataGenerationJobType
:ivar max_samples: Maximum number of samples to generate. Required.
:vartype max_samples: int
Expand All @@ -4090,8 +4196,8 @@ class DataGenerationJobOptions(_Model):

__mapping__: dict[str, _Model] = {}
type: str = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"])
"""The data generation job type. Required. Known values are: \"simple_qna\", \"traces\",
\"tool_use\", and \"task\"."""
"""The data generation job type. Required. Known values are: \"simple_qna\", \"traces\", and
\"tool_use\"."""
max_samples: int = rest_field(visibility=["read", "create", "update", "delete", "query"])
"""Maximum number of samples to generate. Required."""
train_split: Optional[float] = rest_field(visibility=["read", "create", "update", "delete", "query"])
Expand Down Expand Up @@ -4229,20 +4335,20 @@ def __init__(self, *args: Any, **kwargs: Any) -> None:
class DataGenerationTokenUsage(_Model):
"""Token usage information for a data generation job.

:ivar prompt_tokens: The number of prompt tokens used.
:ivar prompt_tokens: The number of prompt tokens used. Required.
:vartype prompt_tokens: int
:ivar completion_tokens: The number of completion tokens generated.
:ivar completion_tokens: The number of completion tokens generated. Required.
:vartype completion_tokens: int
:ivar total_tokens: Total number of tokens used.
:ivar total_tokens: Total number of tokens used. Required.
:vartype total_tokens: int
"""

prompt_tokens: Optional[int] = rest_field(visibility=["read"])
"""The number of prompt tokens used."""
completion_tokens: Optional[int] = rest_field(visibility=["read"])
"""The number of completion tokens generated."""
total_tokens: Optional[int] = rest_field(visibility=["read"])
"""Total number of tokens used."""
prompt_tokens: int = rest_field(visibility=["read"])
"""The number of prompt tokens used. Required."""
completion_tokens: int = rest_field(visibility=["read"])
"""The number of completion tokens generated. Required."""
total_tokens: int = rest_field(visibility=["read"])
"""Total number of tokens used. Required."""


class DatasetCredential(_Model):
Expand Down Expand Up @@ -10571,46 +10677,6 @@ def __init__(self, *args: Any, **kwargs: Any) -> None:
super().__init__(*args, **kwargs)


class TaskDataGenerationJobOptions(DataGenerationJobOptions, discriminator="task"):
"""The options for a data generation job with Task type.

:ivar max_samples: Maximum number of samples to generate. Required.
:vartype max_samples: int
:ivar train_split: The proportion of the generated data to be used for training when the data
is used for fine-tuning. The rest will be used for validation. Value should be between 0 and 1.
:vartype train_split: float
:ivar model_options: The LLM model options.
:vartype model_options: ~azure.ai.projects.models.DataGenerationModelOptions
:ivar type: The data generation job type, which is Task for this model. Required. Task helps in
providing a scenario description for generating multi turn conversation between user and agent.
:vartype type: str or ~azure.ai.projects.models.TASK
"""

type: Literal[DataGenerationJobType.TASK] = rest_discriminator(name="type", visibility=["read", "create", "update", "delete", "query"]) # type: ignore
"""The data generation job type, which is Task for this model. Required. Task helps in providing a
scenario description for generating multi turn conversation between user and agent."""

@overload
def __init__(
self,
*,
max_samples: int,
train_split: Optional[float] = None,
model_options: Optional["_models.DataGenerationModelOptions"] = 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)
self.type = DataGenerationJobType.TASK # type: ignore


class TaxonomyCategory(_Model):
"""Taxonomy category definition.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
[
_AgentDefinitionOptInKeys.HOSTED_AGENTS_V1_PREVIEW.value,
_AgentDefinitionOptInKeys.AGENT_ENDPOINT_V1_PREVIEW.value,
_AgentDefinitionOptInKeys.CODE_AGENTS_V1_PREVIEW.value,
]
),
}
Expand Down
Loading