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

BedrockChat Langchain Custom Integration not working #81

Open
darielnoel opened this issue Sep 21, 2024 · 0 comments
Open

BedrockChat Langchain Custom Integration not working #81

darielnoel opened this issue Sep 21, 2024 · 0 comments
Labels
bug Something isn't working integrations Adding support for third-party tools, agents, or services library Issues and enhancements directly related to the codebase of the library component of the project.

Comments

@darielnoel
Copy link
Contributor

darielnoel commented Sep 21, 2024

Is your request related to a problem? Please describe.

We're attempting to integrate AWS Bedrock into our application using the BedrockChat from @langchain/community/chat_models/bedrock. However, we're encountering a dependency error that prevents the integration from working:

node_modules/@aws-sdk/credential-provider-node/node_modules/@aws-sdk/token-providers/dist-es/fromSso.js:2:25:
  2 │ ..., getSSOTokenFromFile...
    ╵      ~~~~~~~~~~~~~~~~~~~

✘ [ERROR] No matching export in "node_modules/@smithy/shared-ini-file-loader/dist-es/index.js" for import "getSSOTokenFromFile"

This error suggests there's a mismatch between the AWS SDK dependencies, specifically involving the @aws-sdk/credential-provider-node and @smithy/shared-ini-file-loader packages.

Describe the solution you'd like

We need a solution that allows us to successfully integrate AWS Bedrock into our application without encountering dependency conflicts. This could involve:

  1. Updating the @langchain/community package to use a version of AWS SDK that resolves this dependency issue.

  2. Providing clear documentation on which versions of AWS SDK packages are compatible with the Bedrock integration.

  3. Offering an alternative method to configure AWS credentials that doesn't rely on the problematic dependencies.

Describe alternatives you've considered

  1. Manually resolving the dependency versions in our package.json, but this feels like a fragile solution.
  2. Using a different method to interact with AWS Bedrock, but we prefer to use the LangChain integration for consistency with our other LLM integrations.
  3. Implementing a custom credential provider, but this seems like it would add unnecessary complexity to our codebase.

Additional context

We're using the following configuration for Bedrock:

const llm = new BedrockChat({
  model: "anthropic.claude-3-5-sonnet-20240620-v1:0",
  region: import.meta.env.VITE_BEDROCK_AWS_REGION,
  credentials: {
    accessKeyId: import.meta.env.VITE_BEDROCK_AWS_ACCESS_KEY_ID,
    secretAccessKey: import.meta.env.VITE_BEDROCK_AWS_SECRET_ACCESS_KEY,
  },
  temperature: 0.9,
  maxTokens: 1040,
  maxRetries: 1,
});

To quickly test it clone this branch:

https://github.com/kaiban-ai/KaibanJS/tree/bedrock-integration

Then

npm i
npm run dev
npm run play:sb

https://github.com/kaiban-ai/KaibanJS/blob/bedrock-integration/playground/react/src/stories/LLMs.stories.js#L73

Uncomment the commented lines here...

https://github.com/kaiban-ai/KaibanJS/blob/bedrock-integration/playground/react/src/teams/llms/bedrock.js

@darielnoel darielnoel added bug Something isn't working good first issue Good for newcomers library Issues and enhancements directly related to the codebase of the library component of the project. integrations Adding support for third-party tools, agents, or services labels Sep 21, 2024
@darielnoel darielnoel removed the good first issue Good for newcomers label Nov 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working integrations Adding support for third-party tools, agents, or services library Issues and enhancements directly related to the codebase of the library component of the project.
Projects
None yet
Development

No branches or pull requests

1 participant