agentic_retrieve_stream
¶
agentic_retrieve_stream(
messages: AgenticRetrieveMessages,
retrievers: AgenticRetrievers,
agentic_retrieve_configuration: AgenticRetrieveConfiguration,
*,
config_overrides: Optional[BedrockAgentRuntimeClientConfig] = None,
policy_configuration: Optional[AgenticRetrievePolicyConfiguration] = None,
next_token: Optional[NextToken] = None,
user_context: Optional[UserContext] = None,
memory_configuration: Optional[AgenticRetrieveMemoryConfiguration] = None,
generate_response: Optional[bool] = None,
) -> Generator[AgenticRetrieveStreamResponse]
Retrieves information from one or more knowledge bases using an agentic approach. Agentic retrieval uses a foundation model to intelligently decompose complex queries into sub-queries and iteratively retrieve relevant information from your knowledge bases. This approach improves retrieval accuracy for complex, multi-step questions that a single retrieval pass might not fully address.
The operation returns results through a stream that includes retrieval results, trace events for visibility into the process, and a generated response synthesized from the results by default, which can be turned off.
Parameters:
-
messages(AgenticRetrieveMessages) –The list of messages for the agentic retrieval conversation.
-
retrievers(AgenticRetrievers) –The list of retrievers to use for agentic retrieval.
-
agentic_retrieve_configuration(AgenticRetrieveConfiguration) –Configuration settings for the agentic retrieval operation.
-
policy_configuration(Optional[AgenticRetrievePolicyConfiguration], default:None) –Policy configuration for guardrails and content filtering.
-
next_token(Optional[NextToken], default:None) –Opaque continuation token for paginated results.
-
user_context(Optional[UserContext], default:None) –Contains information about the user making the request. This is used for access control filtering to ensure that retrieval results only include documents the user is authorized to access.
-
memory_configuration(Optional[AgenticRetrieveMemoryConfiguration], default:None) –The configuration for using an Amazon Bedrock AgentCore Memory resource with this retrieval.
-
generate_response(Optional[bool], default:None) –Whether to generate a response based on the retrieved results.
Raises:
-
AccessDeniedException–The request is denied because of missing access permissions. Check your permissions and retry your request.
-
BadGatewayException–There was an issue with a dependency due to a server issue. Retry your request.
-
ConflictException–There was a conflict performing an operation. Resolve the conflict and retry your request.
-
DependencyFailedException–There was an issue with a dependency. Check the resource configurations and retry the request.
-
InternalServerException–An internal server error occurred. Retry your request.
-
ResourceNotFoundException–The specified resource Amazon Resource Name (ARN) was not found. Check the Amazon Resource Name (ARN) and try your request again.
-
ServiceQuotaExceededException–The number of requests exceeds the service quota. Resubmit your request later.
-
ThrottlingException–The number of requests exceeds the limit. Resubmit your request later.
-
ValidationException–Input validation failed. Check your request parameters and retry the request.
-
UnknownServiceError–The service returned an error code this client does not model.
Source code in docs_src/capo_bedrock_agent_runtime/_services/bedrock_agent_runtime.py
367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 | |