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

Langchain::DependencyHelper doesn't respect .gemspec of a gem depending on langchainrb #880

Open
ms-ati opened this issue Nov 22, 2024 · 1 comment

Comments

@ms-ati
Copy link

ms-ati commented Nov 22, 2024

Describe the bug

Consider a gem which depends on langchainrb.

  • Langchain::DependencyHelper does not look in the gemspec dependencies of the current gem being developed, forcing LLM dependencies (e.g. aws-sdk-bedrockruntime) to be duplicated in the Gemfile as well.

To Reproduce

Create a gem depending on langchainrb with a .gemspec containing:

spec.add_dependency 'aws-sdk-bedrockruntime'
spec.add_dependency 'langchainrb'  

Observe this error when initializing a Langchain::LLM::AwsBedrock:

~/.gem/ruby/3.3.2/gems/langchainrb-0.19.1/lib/langchain/dependency_helper.rb:38:in `rescue in depends_on': Could not load aws-sdk-bedrockruntime. Please ensure that the aws-sdk-bedrockruntime gem is installed. (Langchain::DependencyHelper::LoadError)
        from ~/.gem/ruby/3.3.2/gems/langchainrb-0.19.1/lib/langchain/dependency_helper.rb:17:in `depends_on'
        from ~/.gem/ruby/3.3.2/gems/langchainrb-0.19.1/lib/langchain/llm/aws_bedrock.rb:46:in `initialize'
        from bin/console:36:in `new'
        from bin/console:36:in `<main>'

To resolve, one must add aws-sdk-bedrockruntime to the Gemfile, as the .gemspec is not consulted in Langchain::DependencyHelper.

Expected behavior

Expected DependencyHelper to find dependencies listed in the gemspec of the gem which depends on langchainrb.

@andreibondarev
Copy link
Collaborator

@ms-ati Is this a public open source gem that you're developing?

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

No branches or pull requests

2 participants