search_agent_context
¶
search_agent_context(
agent_context_id: AgentContextIdentifier,
query: SearchQuery,
search_type: SearchAgentContextType,
*,
config_overrides: Optional[ContextClientConfig] = None,
max_results: Optional[int] = None,
next_token: Optional[str] = None,
filter: Optional[SearchFilter] = None,
) -> SearchAgentContextResponse
Searches an agent context for entities matching a query. Returns ranked entities with relevance scores and metadata. To see the edges around a result node, pass its node ID to TraverseAgentContext.
Parameters:
-
max_results(Optional[int], default:None) –Maximum number of results to return per page.
-
next_token(Optional[str], default:None) –Opaque continuation token from a prior response. Omit on the first page.
-
agent_context_id(AgentContextIdentifier) –The agent context to search, by ID or full Amazon Resource Name (ARN).
-
query(SearchQuery) –The natural-language query or keywords to search for in the agent context. AWS Context interprets it based on
searchType: as literal text forKEYWORD, as a semantic concept forSEMANTIC, or as both forAUTO. -
filter(Optional[SearchFilter], default:None) –Optional filter on node attributes: a single comparison, or
andAllof comparisons that must all match. -
search_type(SearchAgentContextType) –The search strategy to use. Valid values:
-
KEYWORD- Full-text keyword matching (BM25). -
SEMANTIC- Vector similarity of embeddings. -
AUTO- Keyword matches first, then semantic matches for the remaining results.
-
Raises:
-
AccessDeniedException–You don't have sufficient access to perform this operation. Verify that you have permission to perform the operation on the resource.
-
InternalServerException–The request failed because of an internal error. Retry the request.
-
ThrottlingException–The request was denied because it exceeded a request rate quota. Wait, then retry the request.
-
ValidationException–The input fails to satisfy the constraints of the operation. Correct the input before you retry the request.
-
ConflictException–The request conflicts with the current state of the resource. Check the resource's current state before you retry the request.
-
ResourceNotFoundException–The specified resource was not found. Check that the ID is correct and that the resource exists in your account and Region.
-
UnknownServiceError–The service returned an error code this client does not model.
Examples:
Search an agent context The following example runs a semantic search for customer orders and returns the two best-matching nodes, an AWS Glue table and one of its columns.
>>> client.search_agent_context(agent_context_id='ac-0123456789abcdef0123456789abcdef', query='customer orders', search_type='SEMANTIC', max_results=5)
Source code in docs_src/capo_context/_services/context.py
3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 | |