diff --git a/pyoaev/apis/ai_target.py b/pyoaev/apis/ai_target.py index fb86676..c1dfdf9 100644 --- a/pyoaev/apis/ai_target.py +++ b/pyoaev/apis/ai_target.py @@ -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", ), ) diff --git a/pyoaev/apis/endpoint.py b/pyoaev/apis/endpoint.py index 6793c3d..543ccb1 100644 --- a/pyoaev/apis/endpoint.py +++ b/pyoaev/apis/endpoint.py @@ -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", diff --git a/pyoaev/contracts/contract_config.py b/pyoaev/contracts/contract_config.py index 3cba107..0fa59f5 100644 --- a/pyoaev/contracts/contract_config.py +++ b/pyoaev/contracts/contract_config.py @@ -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" @@ -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 diff --git a/test/apis/endpoint/test_endpoint.py b/test/apis/endpoint/test_endpoint.py index 8755359..9bb5e9a 100644 --- a/test/apis/endpoint/test_endpoint.py +++ b/test/apis/endpoint/test_endpoint.py @@ -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, }