View Source AWS.BedrockAgentRuntime (aws-elixir v1.0.4)

Contains APIs related to model invocation and querying of knowledge bases.

Link to this section Summary

Functions

Deletes memory from the specified memory identifier.

Generates an SQL query from a natural language query.

The CLI doesn't support streaming operations in Amazon Bedrock, including InvokeAgent.

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.

Optimizes a prompt for the task that you specify.

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.

Link to this section Functions

Link to this function

delete_agent_memory(client, agent_alias_id, agent_id, input, options \\ [])

View Source

Deletes memory from the specified memory identifier.

Link to this function

generate_query(client, input, options \\ [])

View Source

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.

Link to this function

get_agent_memory(client, agent_alias_id, agent_id, max_items \\ nil, memory_id, memory_type, next_token \\ nil, options \\ [])

View Source

Gets the sessions stored in the memory of the agent.

Link to this function

invoke_agent(client, agent_alias_id, agent_id, session_id, input, options \\ [])

View Source

The CLI doesn't support streaming operations in Amazon Bedrock, including InvokeAgent.

Sends 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 is returned in the bytes field of the chunk object.

* 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.

Link to this function

invoke_flow(client, flow_alias_identifier, flow_identifier, input, options \\ [])

View Source

Invokes 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.

Link to this function

invoke_inline_agent(client, session_id, input, options \\ [])

View Source

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.

The CLI doesn't support streaming operations in Amazon Bedrock, including InvokeInlineAgent.

Link to this function

optimize_prompt(client, input, options \\ [])

View Source

Optimizes a prompt for the task that you specify.

For more information, see Optimize a prompt in the Amazon Bedrock User Guide.

Link to this function

rerank(client, input, options \\ [])

View Source

Reranks the relevance of sources based on queries.

For more information, see Improve the relevance of query responses with a reranker model.

Link to this function

retrieve(client, knowledge_base_id, input, options \\ [])

View Source

Queries a knowledge base and retrieves information from it.

Link to this function

retrieve_and_generate(client, input, options \\ [])

View Source

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.

Link to this function

retrieve_and_generate_stream(client, input, options \\ [])

View Source

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.