Paws 0.8.0 CRAN Release ππ₯³π
Features
- Streaming Support ππ₯³π: Paws now returns
PawsStreamHandler
for streaming services. Learn more. This can be used in multiple ways:- Passing a function to it similar to the apply functions.
- Returning the
httr2::req_performance_connection
and parsing with Paws built-in parserpaws_stream_parser
or usinghttr2::resp_stream_aws
.
Example:
library(paws)
client <- bedrockruntime(region = "us-east-1")
model_id <- "amazon.titan-text-lite-v1:0"
conversation <- list(
list(
role = "user",
content = list(list(text = "What's your name?"))
)
)
resp <- client$converse_stream(
modelId = model_id,
messages = conversation
)
resp$stream(\(chunk) chunk$contentBlockDelta$delta$text)
# Note: stream will close connection after all chunks are read
resp <- client$converse_stream(
modelId = model_id,
messages = conversation
)
# Return httr2 req_performance_connection for full flexibility
con <- resp$stream(.connection = TRUE)
# Handle connection object using paws_stream_parser
while (!is.null(chunk <- paws_stream_parser(con))) {
print(chunk$contentBlockDelta$delta$text)
}
# Note: paws_stream_parser will close connection after all chunks are read
# Or handle connection using httr2::resp_stream_aws
while (!is.null(chunk <- resp_stream_aws(con))) {
str(chunk)
}
close(con)
Backend changes:
- Paws has migrated from aws sdk js to aws sdk python botocore AWS JSONs, which has led to a change to the endpoint regex.
Services
New Support
- bedrock-data-automation
- bedrock-data-automation-runtime
- codeconnections
Deprecated Services
- nimblestudio: AWS no longer supports Nimble. Learn more
- worklink: AWS no longer supports WorkLink.
cloudwatchevents
: AWS CloudWatch Events have been move to EventBridge to align with AWS services.