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

refactor: import langchain-core instead of langchain in Langchain Python integration #1789

Open
navaj0 opened this issue Apr 19, 2024 · 1 comment · May be fixed by langfuse/langfuse-python#805
Labels
dependencies Pull requests that update a dependency file integration-langchain

Comments

@navaj0
Copy link

navaj0 commented Apr 19, 2024

Describe the bug

langchain has been split into several slim packages, including langchain-core, langchain-<aws, ...>. Users, especially who are using LCEL, don't need to install the whole langchain package in their working environment.

However, the langfuse CallbackHanlder still takes a hard dependency on langchain, instead of langchain-core. See https://github.com/langfuse/langfuse-python/blob/main/langfuse/callback/langchain.py#L7

Modules here could be imported from langchain_core directly.

To reproduce

In a new python virtual environment, just install

  • langchain-core
  • langchain-aws (or other specific langchain packages)

Run the following will fail immediately

from langfuse.callback import CallbackHandler

Additional information

No response

@marcklingen marcklingen changed the title bug: Can't import CallbackHandler without installing the whole langchain package refactor: import langchain-core instead of langchain` in Langchain Python Integration May 1, 2024
@marcklingen marcklingen changed the title refactor: import langchain-core instead of langchain` in Langchain Python Integration refactor: import langchain-core instead of langchain in Langchain Python integration May 1, 2024
@marcklingen marcklingen added integration-langchain dependencies Pull requests that update a dependency file labels May 1, 2024 — with Linear
Copy link
Member

marcklingen commented May 1, 2024

thanks for raising this. we'll switch imports and see whether this works as expected.

related issue which will remove the dependency on langchain-community: #1920

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file integration-langchain
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants