ExAws.Bedrock.EventStream (ex_aws_bedrock v2.6.0)

Copy Markdown View Source

Handle streaming of output generated by models.

The model detail returned by ExAws.Bedrock.get_foundation_model/1 must have:

responseStreamingSupported = true

This requires hackney otherwise we will fail at runtime. It also assumes Jason is available but we can improve this to lookup the ExAws JSON coded.

AWS API Docs

Summary

Functions

See ExAws.Request.Url.build/2.

Builds the hackney options for the streaming request.

Stream of chunks from the response stream.

Functions

build_request_url(post_operation, config)

See ExAws.Request.Url.build/2.

hackney_options(config)

Builds the hackney options for the streaming request.

Merges caller-provided options from the ExAws config :http_opts (e.g. recv_timeout, connect_timeout, pool) on top of the async-streaming defaults. Without this, the stream would always use hackney's built-in recv_timeout (5s) and drop slow responses regardless of the timeout the caller configured.

The streaming defaults win on conflicting keys, so the async-streaming mode (async: :once) and the forced HTTP/1.1 protocol can't be accidentally disabled by caller options.

stream_objects!(post_operation, opts, config)

Stream of chunks from the response stream.

Raises on any error.

AWS API Docs