Skip to content

search_discoverable_registry_records

search_discoverable_registry_records(
    search_query: SearchQuery,
    registry_ids: RegistryIdList,
    *,
    config_overrides: Optional[AgentRegistryClientConfig] = None,
    max_results: Optional[int] = None,
    filters: Optional[MetadataFilterExpression] = None,
) -> SearchDiscoverableRegistryRecordsResponse

Searches the discoverable registry records in a registry using a natural language query. Returns metadata for the matching records ordered by relevance.

Parameters:

  • search_query (SearchQuery) –

    The natural language query to search for matching registry records.

  • registry_ids (RegistryIdList) –

    The registry identifiers to search within. Currently, you must specify exactly one registry identifier. You can provide either the full Amazon Web Services Resource Name (ARN) or the registry ID.

  • max_results (Optional[int], default: None ) –

    The maximum number of results to return. Valid values are 1 through 20. The default value is 10.

  • filters (Optional[MetadataFilterExpression], default: None ) –

    An optional structured JSON metadata filter that narrows the search results. Supports the field-level operators $eq, $ne, and $in, and the logical operators $and and $or on filterable fields.

    Specifies additional filtering on custom metadata fields using the customMetadata.{key} prefix. For example, to filter by a custom metadata field: {"customMetadata.environment": {"$eq": "production"}}. For a Boolean field, you can also use a native JSON boolean value, for example: {"customMetadata.requiresApproval": {"$eq": true}}.

Raises:

Source code in docs_src/capo_agent_registry/_services/agent_registry.py
def search_discoverable_registry_records(
    self,
    search_query: "capo_agent_registry.types.search_query.SearchQuery",
    registry_ids: "capo_agent_registry.types.registry_id_list.RegistryIdList",
    *,
    config_overrides: Optional[AgentRegistryClientConfig] = None,
    max_results: Optional[int] = None,
    filters: Optional[
        "capo_agent_registry.types.metadata_filter_expression.MetadataFilterExpression"
    ] = None,
) -> "capo_agent_registry.types.search_discoverable_registry_records_response.SearchDiscoverableRegistryRecordsResponse":
    """<p> Searches the discoverable registry records in a registry using a natural language query. Returns metadata for the matching records ordered by relevance.</p>

    Args:
        search_query: <p> The natural language query to search for matching registry records.</p>
        registry_ids: <p> The registry identifiers to search within. Currently, you must specify exactly one registry identifier. You can provide either the full Amazon Web Services Resource Name (ARN) or the registry ID.</p>
        max_results: <p> The maximum number of results to return. Valid values are 1 through 20. The default value is 10.</p>
        filters: <p> An optional structured JSON metadata filter that narrows the search results. Supports the field-level operators <code>$eq</code>, <code>$ne</code>, and <code>$in</code>, and the logical operators <code>$and</code> and <code>$or</code> on filterable fields.</p> <p> Specifies additional filtering on custom metadata fields using the <code>customMetadata.{key}</code> prefix. For example, to filter by a custom metadata field: <code>{"customMetadata.environment": {"$eq": "production"}}</code>. For a Boolean field, you can also use a native JSON boolean value, for example: <code>{"customMetadata.requiresApproval": {"$eq": true}}</code>.</p>

    Raises:
        capo_agent_registry.errors.access_denied_exception.AccessDeniedException: <p>The caller is not authorized to perform the requested action.</p>
        capo_agent_registry.errors.internal_server_exception.InternalServerException: <p>The request failed due to an unexpected internal error; the caller may retry.</p>
        capo_agent_registry.errors.resource_not_found_exception.ResourceNotFoundException: <p>The requested resource was not found.</p>
        capo_agent_registry.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling; the caller may retry after a delay.</p>
        capo_agent_registry.errors.unauthorized_exception.UnauthorizedException: <p>The request could not be authenticated.</p>
        capo_agent_registry.errors.validation_exception.ValidationException: <p>The request failed validation of one or more input fields.</p>
        capo_agent_registry.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_agent_registry.types.search_discoverable_registry_records_request.SearchDiscoverableRegistryRecordsRequest]",
    ) -> OperationResponse[
        "capo_agent_registry.types.search_discoverable_registry_records_response.SearchDiscoverableRegistryRecordsResponse"
    ]:
        import capo_agent_registry._operations.agent_registry.search_discoverable_registry_records

        output, http_response = (
            capo_agent_registry._operations.agent_registry.search_discoverable_registry_records.search_discoverable_registry_records(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_agent_registry.types.search_discoverable_registry_records_request.SearchDiscoverableRegistryRecordsRequest",
    ) -> dict[str, Any]:
        import capo_agent_registry.types.search_discoverable_registry_records_request

        return capo_agent_registry.types.search_discoverable_registry_records_request.redact_sensitive(
            input_
        )

    def _redact_output(
        output: "capo_agent_registry.types.search_discoverable_registry_records_response.SearchDiscoverableRegistryRecordsResponse",
    ) -> dict[str, Any]:
        import capo_agent_registry.types.search_discoverable_registry_records_response

        return capo_agent_registry.types.search_discoverable_registry_records_response.redact_sensitive(
            output
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging(
            "SearchDiscoverableRegistryRecords",
            redact_input=_redact_input,
            redact_output=_redact_output,
        ),
    )
    input_: capo_agent_registry.types.search_discoverable_registry_records_request.SearchDiscoverableRegistryRecordsRequest = {
        "search_query": search_query,
        "registry_ids": registry_ids,
    }
    if max_results is not None:
        input_["max_results"] = max_results
    if filters is not None:
        input_["filters"] = filters

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output