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

.Net: Add connector for AWS Bedrock #4335

Closed
stephentoub opened this issue Dec 17, 2023 · 14 comments · Fixed by #7627
Closed

.Net: Add connector for AWS Bedrock #4335

stephentoub opened this issue Dec 17, 2023 · 14 comments · Fixed by #7627
Assignees
Labels
ai connector Anything related to AI connectors Ignite .NET Issue or Pull requests regarding .NET code sk team issue A tag to denote issues that where created by the Semantic Kernel team (i.e., not the community)

Comments

@stephentoub
Copy link
Member

https://docs.aws.amazon.com/sdkfornet/v3/apidocs/items/Bedrock/TBedrockClient.html

@stephentoub stephentoub added the .NET Issue or Pull requests regarding .NET code label Dec 17, 2023
@stephentoub stephentoub added this to the v1.1.0 milestone Dec 17, 2023
@github-actions github-actions bot changed the title Add connector for AWS Bedrock .Net: Add connector for AWS Bedrock Dec 17, 2023
@markwallace-microsoft markwallace-microsoft added sk team issue A tag to denote issues that where created by the Semantic Kernel team (i.e., not the community) vnext and removed triage labels Dec 19, 2023
@stekiri
Copy link

stekiri commented Dec 21, 2023

After reading #3094, I was wondering if there is still hope for the Bedrock connector to make it into the main repo? That would be soooo sweet 🙏

@matthewbolanos matthewbolanos added the ai connector Anything related to AI connectors label Jan 3, 2024
@matthewbolanos matthewbolanos moved this to Backlog in Semantic Kernel Jan 5, 2024
Copy link

github-actions bot commented Apr 6, 2024

This issue is stale because it has been open for 90 days with no activity.

@github-actions github-actions bot added the stale Issue is stale because it has been open for 90 days with no activity label Apr 6, 2024
@fbouteruche
Copy link

fbouteruche commented May 7, 2024

Hi @stephentoub do you need help with this one? I'd love to give it a hand.

I've authored this library https://github.com/fbouteruche/rockhead-extensions and I know how to work with AWS Bedrock.

@stephentoub
Copy link
Member Author

@markwallace-microsoft?

@github-actions github-actions bot removed the stale Issue is stale because it has been open for 90 days with no activity label Jun 2, 2024
@as14692
Copy link

as14692 commented Jun 10, 2024

@stephentoub @markwallace-microsoft We are planning to work on this. Could you please update the status regarding this issue.

@stephentoub
Copy link
Member Author

@stephentoub @markwallace-microsoft We are planning to work on this. Could you please update the status regarding this issue.

Awesome. @markwallace-microsoft ?

@Beau-Gosse-dev
Copy link

@stephentoub Should we plan to fork this repo and open a PR adding the Bedrock connectors here? https://github.com/microsoft/semantic-kernel/tree/main/dotnet/src/Connectors

@markwallace-microsoft
Copy link
Member

@Beau-Gosse-dev we'd be delighted to have this contribution. I'm adding @RogerBarreto as he has been working with contributors on some of the new connectors.

We will create a feature branch for this work to allow multiple smaller PR's which will be easier to review and merge.
Some information about this process: https://github.com/microsoft/semantic-kernel/blob/main/docs/decisions/0031-feature-branch-strategy.md

@RogerBarreto
Copy link
Member

RogerBarreto commented Jun 14, 2024

@Beau-Gosse-dev, @as14692 please follow the instructions on our Feature Branch Strategy provided by @markwallace-microsoft above.

Feature branch for Amazon Bedrock was created, on the next PR's please target this branch https://github.com/microsoft/semantic-kernel/tree/feature-connectors-amazon

Consider initial namespace naming as Microsoft.SemanticKernel.Connectors.Amazon following similar folder and coding pattern (Client abstractions, Core, Services) used in our latest Google connector for Vertex AI.

Thanks for the contribution!

@RogerBarreto RogerBarreto moved this from Backlog to Community PRs in Semantic Kernel Jun 14, 2024
@RogerBarreto RogerBarreto self-assigned this Jun 14, 2024
@RogerBarreto RogerBarreto removed this from the v1.1.0 milestone Jun 14, 2024
@Beau-Gosse-dev
Copy link

Thanks so much @markwallace-microsoft and @RogerBarreto !

One question right away, will we be able to take a dependency on the AWS SDK for Bedrock? source code, nuget

@markwallace-microsoft
Copy link
Member

Thanks so much @markwallace-microsoft and @RogerBarreto !

One question right away, will we be able to take a dependency on the AWS SDK for Bedrock? source code, nuget

That should be fine

@halllo
Copy link

halllo commented Jul 20, 2024

I am also very interested in this. Will it suffice to add a class in the connectors namespace and implement IChatCompletion?

@Beau-Gosse-dev
Copy link

@halllo , we're currently doing an internal review of these changes before submitting them to this main repo. We'd appreciate your feedback if you have any: as14692#1

@as14692
Copy link

as14692 commented Jul 31, 2024

@markwallace-microsoft @RogerBarreto @stephentoub Submitted first PR for ChatCompletionService and TextGenerationService. Please review.

RogerBarreto added a commit that referenced this issue Aug 14, 2024
### Motivation and Context

<!-- Thank you for your contribution to the semantic-kernel repo!
Please help reviewers and future users, providing the following
information:
  1. Why is this change required?
  2. What problem does it solve?
  3. What scenario does it contribute to?
  4. If it fixes an open issue, please link to the issue here.
-->
There has been a strong demand from developers in the community to be
able to utilize Bedrock with the Semantic Kernel. With the wide variety
of foundation models offered including specialized models tailored for
various domains and use cases, Bedrock's AI capabilities can now be
leveraged within the Semantic Kernel's unified ecosystem with this
connector.

### Description

<!-- Describe your changes, the overall approach, the underlying design.
These notes will help understanding how your code works. Thanks! -->

This pull request implements a connector for Amazon Bedrock, allowing
developers to leverage Bedrock's foundation models within the Semantic
Kernel framework. Key features of this implementation include:
- Core Services: Implementation of `IChatCompletionService` and
`ITextGenerationService` from the Semantic Kernel.
- Authentication and Security: Secure client authentication and API
communication with the Amazon Bedrock Runtime.
- Modular Design: A directory organization and namespace structure
similar to other connectors in the Semantic Kernel, including folders
for core, services, models, and extensions.
- Testing: Inclusion of unit tests and integration tests for available
Bedrock models to demonstrate successful communication with Bedrock API,
request/response mapping, and output generation.

The implementation leverages the following Amazon Bedrock Runtime
actions:
- `InvokeModelAsync` and `InvokeModelWithResponseStreamAsync` for
`GetTextContentsAsync` and `GetStreamingTextContentsAsync`,
respectively.
- `ConverseAsync` and `ConverseStreamAsync` for
`GetChatMessageContentsAsync` and
`GetStreamingChatMessageContentsAsync`, respectively.

The following base models from various providers are currently connected
and available for use under Bedrock:
- AI21 Labs Jamba
- AI21 Labs Jurassic-2 series
- Amazon Titan
- Anthropic Claude
- Cohere Command
- Meta Llama 3
- Mistral AI Mistral

The kernel builder extension methods support two authentication
scenarios:
- User-provided `IAmazonBedrockRuntime` object: Developers can provide a
pre-configured `IAmazonBedrockRuntime` object, allowing for customized
configurations such as specifying custom credentials, endpoints, or
other settings.
- Automatic `IAmazonBedrockRuntime` creation: If developers do not
provide an `IAmazonBedrockRuntime` object, an instance is automatically
created and registered in the dependency injection (DI) container using
the `AWSSDK.Extensions.NETCore.Setup` package. In this case, the
`IAmazonBedrockRuntime` object will be configured with default settings,
such as credentials obtained from environment variables, AWS credentials
files, or instance profile credentials.

Resolve #3094
Resolve #4335
- #3094
- #4335

### Contribution Checklist

<!-- Before submitting this PR, please make sure: -->

- [ ] The code builds clean without any errors or warnings
- [ ] The PR follows the [SK Contribution
Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md)
and the [pre-submission formatting
script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts)
raises no violations
- [ ] All unit tests pass, and I have added new tests where possible
- [ ] I didn't break anyone 😄

---------

Co-authored-by: Charlize Yeh <[email protected]>
Co-authored-by: Roger Barreto <[email protected]>
Co-authored-by: Roger Barreto <[email protected]>
@RogerBarreto RogerBarreto moved this from Community PRs to Sprint: Planned in Semantic Kernel Sep 9, 2024
github-merge-queue bot pushed a commit that referenced this issue Oct 31, 2024
# Add Amazon's AWS Bedrock Connector

- Resolves #4335 

Adding support for Amazon AWS Connector to the Semantic Kernel.

---------

Co-authored-by: Charlize Yeh <[email protected]>
Co-authored-by: Charlize Yeh <[email protected]>
Co-authored-by: Roger Barreto <[email protected]>
@github-project-automation github-project-automation bot moved this from Sprint: In Review to Sprint: Done in Semantic Kernel Oct 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ai connector Anything related to AI connectors Ignite .NET Issue or Pull requests regarding .NET code sk team issue A tag to denote issues that where created by the Semantic Kernel team (i.e., not the community)
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

10 participants