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: allow CacheBackedEmbeddings to cache queries #20073

Merged

Conversation

jokester
Copy link
Contributor

@jokester jokester commented Apr 5, 2024

Thank you for contributing to LangChain!

  • PR title: "package: description"

    • Where "package" is whichever of langchain, community, core, experimental, etc. is being modified. Use "docs: ..." for purely docs changes, "templates: ..." for template changes, "infra: ..." for CI changes.
    • Example: "community: add foobar LLM"
  • Description:

This PR allow cache of query embedding. Prior to this PR, it required a custom class to cache queries too.
To make the change non-breaking, query caching is not enabled by default.

  • Issue: no, but an intent was mentioned in docs: mention caveats with CacheBackedEmbeddings.embed_query #19926

  • Dependencies: no

  • **Twitter handle: tarsylia

  • Add tests and docs: If you're adding a new integration, please include

    1. a test for the integration, preferably unit tests that do not rely on network access,
    2. an example notebook showing its use. It lives in docs/docs/integrations directory.
  • Lint and test: Run make format, make lint and make test from the root of the package(s) you've modified. See contribution guidelines for more: https://python.langchain.com/docs/contributing/

Additional guidelines:

  • Make sure optional dependencies are imported within a function.
  • Please do not add dependencies to pyproject.toml files (even optional ones) unless they are required for unit tests.
  • Most PRs should not touch more than one package.
  • Changes should be backwards compatible.
  • If you are adding something to community, do not re-import it in langchain.

If no one reviews your PR within a few days, please @-mention one of baskaryan, efriis, eyurtsev, hwchase17.

Copy link

vercel bot commented Apr 5, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
langchain ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 13, 2024 3:17pm

@jokester jokester force-pushed the allow-cache-backed-embeddings-query branch from 2b44ff3 to 22f241d Compare April 7, 2024 15:30
@jokester jokester marked this pull request as ready for review April 7, 2024 15:32
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. Ɑ: embeddings Related to text embedding models module 🤖:improvement Medium size change to existing code to handle new use-cases labels Apr 7, 2024
@jokester jokester force-pushed the allow-cache-backed-embeddings-query branch from 334a032 to e9b2423 Compare April 7, 2024 15:40
@jokester jokester changed the title langchain: allow CacheBackedEmbeddingsallow to cache query embeddings langchain: allow CacheBackedEmbeddings to cache queries Apr 7, 2024
@jokester
Copy link
Contributor Author

jokester commented Apr 8, 2024

@eyurtsev Sorry to bother but can I ask you to review this too? 🙏🏽

I think this PR answers some concern in previous code comments and also make it easier to use.

@dosubot dosubot bot added the lgtm PR looks good. Use to confirm that a PR is ready for merging. label May 13, 2024
@eyurtsev eyurtsev enabled auto-merge (squash) May 13, 2024 15:11
@eyurtsev
Copy link
Collaborator

Looks great! Merging

@eyurtsev eyurtsev merged commit b53548d into langchain-ai:master May 13, 2024
44 checks passed
@jokester jokester deleted the allow-cache-backed-embeddings-query branch May 14, 2024 04:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Ɑ: embeddings Related to text embedding models module 🤖:improvement Medium size change to existing code to handle new use-cases lgtm PR looks good. Use to confirm that a PR is ready for merging. size:L This PR changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants