Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat/added bedrock streaming #314

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

lloydhamilton
Copy link

@lloydhamilton lloydhamilton commented Jan 12, 2025

What does this PR do?

Added streaming functionality for Bedrock API integration. Followed as closely as possible the coding styles written in openai_client.py and ollama_clienytpy.

  • Added api call to bedrock .converse_stream endpoint when streaming is true.
  • To enable streaming, set streaming = True is api_kwargs.
client = BedrockAPIClient(aws_profile_name="test_profile", aws_region_name="eu-west-1")
model_kwargs = {
    "modelId": "eu.anthropic.claude-3-5-sonnet-20240620-v1:0",
    "stream": True,
}

Since the stream parameter is not a parameter recognised by Bedrock, I had to add api_kwargs.pop("stream") when evaluating api_kwargs prior to bedrock API call.

Related issue:
#283

Add tests that extends the tests written in #289

Before submitting
  • Was this discussed/agreed via a GitHub issue? (not for typos and docs)
  • Did you read the contributor guideline?
  • Did you make sure your PR does only one thing, instead of bundling different changes together?
  • Did you make sure to update the documentation with your changes? (if necessary)
  • Did you write any new necessary tests? (not for typos and docs)
  • Did you verify new and existing tests pass locally with your changes?
  • Did you list all the breaking changes introduced by this pull request?

@lloydhamilton lloydhamilton changed the title Fix/added bedrock streaming feat/added bedrock streaming Jan 12, 2025
@lloydhamilton lloydhamilton marked this pull request as ready for review January 12, 2025 17:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant