View Source AWS.BedrockAgentRuntime (aws-elixir v1.0.6)
Contains APIs related to model invocation and querying of knowledge bases.
Link to this section Summary
Functions
Creates a new invocation within a session.
Creates a session to temporarily store conversations for generative AI (GenAI) applications built with open-source frameworks such as LangGraph and LlamaIndex.
Deletes memory from the specified memory identifier.
Deletes a session that you ended.
Ends the session.
Generates an SQL query from a natural language query.
Gets the sessions stored in the memory of the agent.
Retrieves the details of a specific invocation step within an invocation in a session.
Retrieves details about a specific session.
Sends a prompt for the agent to process and respond to.
Invokes an alias of a flow to run the inputs that you specify and return the output of each node as a stream.
Invokes an inline Amazon Bedrock agent using the configurations you provide with the request.
Lists all invocation steps associated with a session and optionally, an invocation within the session.
Lists all invocations associated with a specific session.
Lists all sessions in your Amazon Web Services account.
List all the tags for the resource you specify.
Optimizes a prompt for the task that you specify.
Add an invocation step to an invocation in a session.
Reranks the relevance of sources based on queries.
Queries a knowledge base and retrieves information from it.
Queries a knowledge base and generates responses based on the retrieved results and using the specified foundation model or inference profile.
Queries a knowledge base and generates responses based on the retrieved results, with output in streaming format.
Associate tags with a resource.
Remove tags from a resource.
Updates the metadata or encryption settings of a session.
Link to this section Functions
create_invocation(client, session_identifier, input, options \\ [])
View SourceCreates a new invocation within a session.
An invocation groups the related invocation steps that store the content from a conversation. For more information about sessions, see Store and retrieve conversation history and context with Amazon Bedrock sessions.
Related APIs
*
*
*
Creates a session to temporarily store conversations for generative AI (GenAI) applications built with open-source frameworks such as LangGraph and LlamaIndex.
Sessions enable you to save the state of conversations at checkpoints, with the added security and infrastructure of Amazon Web Services. For more information, see Store and retrieve conversation history and context with Amazon Bedrock sessions.
By default, Amazon Bedrock uses Amazon Web Services-managed keys for session encryption, including session metadata, or you can use your own KMS key. For more information, see Amazon Bedrock session encryption.
You use a session to store state and conversation history for generative AI applications built with open-source frameworks. For Amazon Bedrock Agents, the service automatically manages conversation context and associates them with the agent-specific sessionId you specify in the InvokeAgent API operation.
Related APIs:
*
*
*
*
delete_agent_memory(client, agent_alias_id, agent_id, input, options \\ [])
View SourceDeletes memory from the specified memory identifier.
Deletes a session that you ended.
You can't delete a session with an ACTIVE
status. To delete an active session,
you must first end it with the
EndSession API operation.
For more information about sessions, see Store and retrieve conversation
history and context with Amazon Bedrock
sessions.
Ends the session.
After you end a session, you can still access its content but you can’t add to it. To delete the session and it's content, you use the DeleteSession API operation. For more information about sessions, see Store and retrieve conversation history and context with Amazon Bedrock sessions.
Generates an SQL query from a natural language query.
For more information, see Generate a query for structured data in the Amazon Bedrock User Guide.
get_agent_memory(client, agent_alias_id, agent_id, max_items \\ nil, memory_id, memory_type, next_token \\ nil, options \\ [])
View SourceGets the sessions stored in the memory of the agent.
get_invocation_step(client, invocation_step_id, session_identifier, input, options \\ [])
View SourceRetrieves the details of a specific invocation step within an invocation in a session.
For more information about sessions, see Store and retrieve conversation history and context with Amazon Bedrock sessions.
Retrieves details about a specific session.
For more information about sessions, see Store and retrieve conversation history and context with Amazon Bedrock sessions.
invoke_agent(client, agent_alias_id, agent_id, session_id, input, options \\ [])
View SourceSends a prompt for the agent to process and respond to.
Note the following fields for the request:
*
To continue the same conversation with an agent, use the same sessionId
value
in the request.
*
To activate trace enablement, turn enableTrace
to true
. Trace enablement
helps you follow the agent's reasoning process that led it to the information it
processed, the actions it took, and the final result it yielded. For more
information, see Trace enablement.
*
End a conversation by setting endSession
to true
.
*
In the sessionState
object, you can include attributes for the session or
prompt or, if you configured an action group to return control, results from
invocation of the action group.
The response contains both chunk and trace attributes.
The final response is returned in the bytes
field of the chunk
object. The
InvokeAgent
returns one chunk for the entire interaction.
*
The attribution
object contains citations for parts of the response.
*
If you set enableTrace
to true
in the request, you can trace the agent's
steps and reasoning process that led it to the response.
*
If the action predicted was configured to return control, the response returns
parameters for the action, elicited from the user, in the returnControl
field.
* Errors are also surfaced in the response.
invoke_flow(client, flow_alias_identifier, flow_identifier, input, options \\ [])
View SourceInvokes an alias of a flow to run the inputs that you specify and return the output of each node as a stream.
If there's an error, the error is returned. For more information, see Test a flow in Amazon Bedrock in the Amazon Bedrock User Guide.
The CLI doesn't support streaming operations in Amazon Bedrock, including
InvokeFlow
.
Invokes an inline Amazon Bedrock agent using the configurations you provide with the request.
* Specify the following fields for security purposes.
*
(Optional) customerEncryptionKeyArn
– The Amazon Resource Name (ARN) of a KMS
key to encrypt the creation of the agent.
*
(Optional) idleSessionTTLinSeconds
– Specify the number of seconds for which
the agent should maintain session information. After this time expires, the
subsequent InvokeInlineAgent
request begins a new session.
*
To override the default prompt behavior for agent orchestration and to use
advanced prompts, include a promptOverrideConfiguration
object.
For more information, see Advanced prompts.
* The agent instructions will not be honored if your agent has only one knowledge base, uses default prompts, has no action group, and user input is disabled.
list_invocation_steps(client, session_identifier, input, options \\ [])
View SourceLists all invocation steps associated with a session and optionally, an invocation within the session.
For more information about sessions, see Store and retrieve conversation history and context with Amazon Bedrock sessions.
list_invocations(client, session_identifier, input, options \\ [])
View SourceLists all invocations associated with a specific session.
For more information about sessions, see Store and retrieve conversation history and context with Amazon Bedrock sessions.
Lists all sessions in your Amazon Web Services account.
For more information about sessions, see Store and retrieve conversation history and context with Amazon Bedrock sessions.
List all the tags for the resource you specify.
Optimizes a prompt for the task that you specify.
For more information, see Optimize a prompt in the Amazon Bedrock User Guide.
put_invocation_step(client, session_identifier, input, options \\ [])
View SourceAdd an invocation step to an invocation in a session.
An invocation step stores fine-grained state checkpoints, including text and images, for each interaction. For more information about sessions, see Store and retrieve conversation history and context with Amazon Bedrock sessions.
Related APIs:
*
*
*
*
Reranks the relevance of sources based on queries.
For more information, see Improve the relevance of query responses with a reranker model.
Queries a knowledge base and retrieves information from it.
Queries a knowledge base and generates responses based on the retrieved results and using the specified foundation model or inference profile.
The response only cites sources that are relevant to the query.
Queries a knowledge base and generates responses based on the retrieved results, with output in streaming format.
The CLI doesn't support streaming operations in Amazon Bedrock, including
InvokeModelWithResponseStream
.
This operation requires permission for the bedrock:RetrieveAndGenerate
action.
Associate tags with a resource.
For more information, see Tagging resources in the Amazon Bedrock User Guide.
Remove tags from a resource.
Updates the metadata or encryption settings of a session.
For more information about sessions, see Store and retrieve conversation history and context with Amazon Bedrock sessions.