Searches for content in a specified knowledge base. Can be used to get a specific content resource by its name.
Parameters:
-
next_token
(Optional[NextToken], default:
None
)
–
The token for the next set of results. Use the value returned in the previous response in the next request to retrieve the next set of results.
-
max_results
(Optional[MaxResults], default:
None
)
–
The maximum number of results to return per page.
-
knowledge_base_id
(UuidOrArn)
–
The identifier of the knowledge base. This should not be a QUICK_RESPONSES type knowledge base if you're storing Wisdom Content resource to it. Can be either the ID or the ARN. URLs cannot contain the ARN.
-
search_expression
(SearchExpression)
–
The search expression to filter results.
Raises:
Source code in docs_src/capo_wisdom/_services/wisdom.py
| def search_content(
self,
knowledge_base_id: "capo_wisdom.types.uuid_or_arn.UuidOrArn",
search_expression: "capo_wisdom.types.search_expression.SearchExpression",
*,
config_overrides: Optional[WisdomClientConfig] = None,
next_token: Optional["capo_wisdom.types.next_token.NextToken"] = None,
max_results: Optional["capo_wisdom.types.max_results.MaxResults"] = None,
) -> "capo_wisdom.types.search_content_response.SearchContentResponse":
"""<p>Searches for content in a specified knowledge base. Can be used to get a specific content resource by its name.</p>
Args:
next_token: <p>The token for the next set of results. Use the value returned in the previous response in the next request to retrieve the next set of results.</p>
max_results: <p>The maximum number of results to return per page.</p>
knowledge_base_id: <p>The identifier of the knowledge base. This should not be a QUICK_RESPONSES type knowledge base if you're storing Wisdom Content resource to it. Can be either the ID or the ARN. URLs cannot contain the ARN.</p>
search_expression: <p>The search expression to filter results.</p>
Raises:
capo_wisdom.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient access to perform this action.</p>
capo_wisdom.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource does not exist.</p>
capo_wisdom.errors.validation_exception.ValidationException: <p>The input fails to satisfy the constraints specified by a service.</p>
capo_wisdom.errors.UnknownServiceError: The service returned an error code this client does not model.
"""
def _handler(
req: "OperationRequest[capo_wisdom.types.search_content_request.SearchContentRequest]",
) -> OperationResponse[
"capo_wisdom.types.search_content_response.SearchContentResponse"
]:
import capo_wisdom._operations.wisdom_service.search_content
output, http_response = (
capo_wisdom._operations.wisdom_service.search_content.search_content(
req.options, req.input
)
)
return OperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("SearchContent")
)
input_: capo_wisdom.types.search_content_request.SearchContentRequest = {
"knowledge_base_id": knowledge_base_id,
"search_expression": search_expression,
}
if next_token is not None:
input_["next_token"] = next_token
if max_results is not None:
input_["max_results"] = max_results
response = execute_pipeline(
OperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
response.response.close()
return response.output
|