View Source ExAws.Bedrock (ex_aws_bedrock v1.5.4)

Interface to AWS Bedrock.

Amazon Bedrock is a fully managed service that offers a choice of high-performing foundation models (FMs) from leading AI companies.

AWS API Docs

Summary

Functions

Get the properties associated with a Amazon Bedrock custom model that you have created.

Get details about a Amazon Bedrock foundation model.

Invokes the specified Amazon Bedrock model to run inference using the input provided in the request body.

List of Amazon Bedrock foundation models that you can use.

Functions

Link to this function

get_custom_model(model_id)

View Source

Get the properties associated with a Amazon Bedrock custom model that you have created.

AWS API Docs

Link to this function

get_foundation_model(model_id)

View Source

Get details about a Amazon Bedrock foundation model.

AWS API Docs

Link to this function

invoke_model(model_id, inference_parameters)

View Source
@spec invoke_model(String.t(), Jason.Encoder.t()) :: ExAws.Operation.t()

Invokes the specified Amazon Bedrock model to run inference using the input provided in the request body.

You use InvokeModel to run inference for text models, image models, and embedding models.

input = ExAws.Bedrock.Titan.TextModel.build("Hello, LLM.");
request = ExAws.Bedrock.invoke_model("amazon.titan-tg1-large", input);
{:ok, %{"results" => [%{"outputText" => output}|_]}} = ExAws.request(request, service_override: :bedrock);
output

Note the extra service override parameter required for correctly signing the request. Use ExAws.Bedrock.request/2 to automatically provide the correct parameter.

Model parameters are normally JSON documents defined in the link below, therefore pass a struct or map that can be serialized with Jason.encode/1.

AWS API Docs

Model Parameters

Link to this function

list_foundation_models(parameters \\ [])

View Source

List of Amazon Bedrock foundation models that you can use.

AWS API Docs

Parameters

  • :by_customization_type - :FINE_TUNING | :CONTINUED_PRE_TRAINING

  • :by_inference_type - :ON_DEMAND | :PROVISIONED

  • :by_output_modality - :TEXT | :IMAGE | :EMBEDDING

  • :by_provider - An Amazon Bedrock model provider

Link to this function

request(op, config_overrides \\ [])

View Source

See ExAws.Bedrock.Request.request/2.

Link to this function

request!(op, config_overrides \\ [])

View Source

See ExAws.Bedrock.Request.request!/2.