Skip to content
Open
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
2 changes: 1 addition & 1 deletion pyoaev/apis/ai_target.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class AiTargetManager(
"ai_target_model",
"ai_target_modality",
"ai_target_system_prompt",
"ai_target_api_key_variable",
"ai_target_token",
"ai_target_configuration",
),
)
10 changes: 5 additions & 5 deletions pyoaev/apis/endpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@ class Endpoint(RESTObject):
class EndpointManager(RESTManager):
_path = "/endpoints"
_obj_cls = Endpoint
# asset_name is the only required attribute. Everything else - including endpoint_hostname,
# asset_name is the only required attribute. Everything else - including asset_hostname,
# endpoint_platform and endpoint_arch - is optional: agents and collectors typically provide
# the endpoint fields, while category-driven assets (web app, cloud, network, ...) may omit
# them and the backend defaults endpoint_platform / endpoint_arch to "Unknown".
_create_attrs = RequiredOptional(
required=("asset_name",),
optional=(
"endpoint_hostname",
"asset_hostname",
"endpoint_platform",
"endpoint_arch",
"endpoint_ips",
"endpoint_mac_addresses",
"endpoint_url",
"asset_ips",
"asset_mac_addresses",
"asset_url",
"asset_description",
"asset_external_reference",
"asset_tags",
Expand Down
17 changes: 17 additions & 0 deletions pyoaev/contracts/contract_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class ContractFieldType(str, Enum):
Expectation: str = "expectation"
Asset: str = "asset"
AssetGroup: str = "asset-group"
AiTarget: str = "ai-target"
Payload: str = "payload"


Expand Down Expand Up @@ -316,6 +317,22 @@ def get_type(self) -> str:
return ContractFieldType.AssetGroup.value


@dataclass
class ContractAiTarget(ContractCardinalityElement):
"""Selector for a pre-configured AiTarget asset (LLM endpoint / AI agent under test).

Renders in the UI as an entity autocomplete (backed by the platform ``/ai_targets``
options endpoint), analogous to the asset / asset group pickers. The selected value is
the AI target's ``asset_id`` (AI targets are AI_TARGET-category assets, see
``AiTarget._id_attr``), resolved by the executing injector at run time. Unlike
``ContractAsset`` the key is free-form so a contract can name the field as it wishes.
"""

@property
def get_type(self) -> str:
return ContractFieldType.AiTarget.value


@dataclass
class ContractPayload(ContractCardinalityElement):
@property
Expand Down
2 changes: 1 addition & 1 deletion test/apis/endpoint/test_endpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def test_upsert_web_application_without_platform(self, mock_request):
"asset_name": "Filigran website",
"asset_category": AssetCategory.WEB_APPLICATION,
"asset_subcategory": AssetSubCategory.WEBSITE,
"endpoint_url": "https://filigran.io",
"asset_url": "https://filigran.io",
"asset_internet_facing": True,
}

Expand Down
Loading