mirror of
https://github.com/hwchase17/langchain.git
synced 2025-08-14 23:26:34 +00:00
Thank you for contributing to LangChain! - [x] **PR title**: "package: description" - Where "package" is whichever of langchain, community, core, etc. is being modified. Use "docs: ..." for purely docs changes, "infra: ..." for CI changes. - Example: "community: add foobar LLM" **Description**: * Starting to put together some PR's to fix the typing around `langchain-chroma` `filter` and `where_document` query filtering, as mentioned: https://github.com/langchain-ai/langchain/issues/30879 https://github.com/langchain-ai/langchain/issues/30507 The typing of `dict[str, str]` is on the one hand too restrictive (marks valid filter expressions as ill-typed) and also too permissive (allows illegal filter expressions). That's not what this PR addresses though. This PR just removes from the documentation some examples of filters that are illegal, and also syntactically incorrect: (a) dictionaries with keys like `$contains` but the key is missing quotation marks; (b) dictionaries with multiple entries - this is illegal in Chroma filter syntax and will raise an exception. (`{"foo": "bar", "qux": "baz"}`). Filter dictionaries in Chroma must have one and one key only. Again this is just the documentation issue, which is the lowest hanging fruit. I also think we need to update the types for `filter` and `where_document` to be (at the very least `dict[str, Any]`), or, since we have access to Chroma's types, they should be `Where` and `WhereDocument` types. This has a wider blast radius though, so I'm starting small. This PR does not fix the issues mentioned above, it's just starting to get the ball rolling, and cleaning up the documentation. - [x] **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, eyurtsev, ccurme, vbarda, hwchase17. --------- Co-authored-by: Really Him <hesereallyhim@proton.me> |
||
---|---|---|
.. | ||
langchain_chroma | ||
scripts | ||
tests | ||
.gitignore | ||
LICENSE | ||
Makefile | ||
pyproject.toml | ||
README.md | ||
uv.lock |
langchain-chroma
This package contains the LangChain integration with Chroma.
Installation
pip install -U langchain-chroma
Usage
The Chroma
class exposes the connection to the Chroma vector store.
from langchain_chroma import Chroma
embeddings = ... # use a LangChain Embeddings class
vectorstore = Chroma(embeddings=embeddings)