langchain-ai / langchain-aws

Build LangChain Applications on AWS
MIT License
63 stars 46 forks source link

Adding amazon-bedrock-guardrailConfig for Guardrails to support different streaming types #52

Open supreetkt opened 1 month ago

supreetkt commented 1 month ago

Guardrails supports Asynchronous and Synchronous streaming that determine how guardrails are applied to the model response. This feature is currently not supported by the Bedrock classes. Feature is highlighted here in the Bedrock documentation and requires amazon-bedrock-guardrailConfig to be passed in the API call while using streaming and using InvokeModelWithResponseStream.

boto3 supports this in the invoke_model_with_response_stream method as a part of the body.