langchain-cratedb


Namelangchain-cratedb JSON
Version 0.1.0 PyPI version JSON
download
home_pagehttps://github.com/crate/langchain-cratedb
SummaryUse LangChain with CrateDB
upload_time2025-01-03 10:00:48
maintainerNone
docs_urlNone
authorNone
requires_python<4.0,>=3.9
licenseMIT
keywords ai artificial intelligence cratedb embedding vectors fulltext search langchain llm machine learning ml rag semantic search vdbms vector embeddings vector database vector search vector store
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # langchain-cratedb

[![Bluesky][badge-bluesky]][project-bluesky]
[![Release Notes][badge-release-notes]][project-release-notes]
[![CI][badge-ci]][project-ci]
[![Downloads per month][badge-downloads-per-month]][project-downloads]

[![Package version][badge-package-version]][project-pypi]
[![License][badge-license]][project-license]
[![Status][badge-status]][project-pypi]
[![Supported Python versions][badge-python-versions]][project-pypi]

» [Documentation]
| [Changelog]
| [PyPI]
| [Issues]
| [Source code]
| [License]
| [CrateDB]
| [Community Forum]

The `langchain-cratedb` package implements the [CrateDB provider for LangChain],
i.e. core LangChain abstractions using [CrateDB] or [CrateDB Cloud].

Feel free to use the abstractions as provided or else modify them / extend them
as appropriate for your own applications. We appreciate contributions of any kind.

## Introduction

CrateDB is a distributed and scalable SQL database for storing and analyzing
massive amounts of data in near real-time, even with complex queries.
It is PostgreSQL-compatible, and based on Lucene.

LangChain is a composable framework to build context-aware, reasoning
applications with large language models, leveraging your company’s data
and APIs.

LangChain for CrateDB is an AI/ML framework that unlocks the application
of LLM technologies to hands-on projects, covering many needs end-to-end.
It builds upon the large array of utilities bundled by the LangChain
toolkit and the ultra-fast indexing capabilities of CrateDB.

You can apply [LangChain] to implement text-based applications using commercial
models, for example provided by [OpenAI], or open-source models, for example
Meta's [Llama] multilingual text-only and text-image models.

## Installation

```bash
pip install --upgrade langchain-cratedb
```

## Requirements

The package currently supports CrateDB and its Python DB API driver,
available per [crate] package. It will be automatically installed
when installing the LangChain adapter.

You can run [CrateDB Self-Managed] or start using [CrateDB Cloud],
see [CrateDB Installation], or [CrateDB Cloud Console].

## Usage

To learn about the LangChain adapter for CrateDB, please refer to the
documentation and examples:

- [Using LangChain with CrateDB]
- [CrateDB LangChain examples]

### Vector Store

A few notebooks demonstrate how to use the CrateDB vector store functionality
around its `FLOAT_VECTOR` data type and its `KNN_MATCH` function together with
LangChain.

You will learn how to import and query unstructured data using the
`CrateDBVectorStore`, for example to create a retrieval augmented generation
(RAG) pipeline.

Retrieval-Augmented Generation (RAG) combines a retrieval system, which fetches
relevant documents, with a generative model, allowing it to incorporate external
knowledge for more accurate and informed responses.

- [Example: Basic vector search]
- [Example: Basic RAG]
- [Example: Advanced RAG with use case]

### Document Loader

This notebook demonstrates how to load documents from a CrateDB database, using
LangChain's `SQLDatabase` and `CrateDBLoader` interfaces, based on SQLAlchemy.

- [Example: Load data from database table]

### Chat History

The chat message history adapter helps to store and manage chat message history
in a CrateDB table, for supporting conversational memory.

- [Example: Chat message history]

### Full Cache

The standard / full cache avoids invoking the LLM when the supplied
prompt is exactly the same as one encountered already.

- [Example: CrateDBCache]

### Semantic Cache

The semantic cache allows users to retrieve cached prompts based on semantic
similarity between the user input and previously cached inputs, also avoiding
to invoke the LLM when not needed.

- [Example: CrateDBSemanticCache]


## Project Information

### Acknowledgements
Kudos to the authors of all the many software components this library is
inheriting from and building upon, most notably the [langchain-postgres]
package, and [langchain] itself.

### Contributing
The `langchain-cratedb` package is an open source project, and is
[managed on GitHub]. We appreciate contributions of any kind.

### License
The project uses the MIT license, like the langchain-postgres project
it is deriving from.


[CrateDB]: https://cratedb.com/database
[CrateDB Cloud]: https://cratedb.com/database/cloud
[CrateDB Cloud Console]: https://console.cratedb.cloud/
[CrateDB Installation]: https://cratedb.com/docs/guide/install/
[CrateDB LangChain examples]: https://github.com/crate/cratedb-examples/tree/main/topic/machine-learning/llm-langchain
[CrateDB provider for LangChain]: https://python.langchain.com/docs/integrations/providers/cratedb/
[CrateDB Self-Managed]: https://cratedb.com/database/self-managed
[CrateDBVectorStore]: https://github.com/crate/langchain-cratedb/blob/cratedb/docs/vectorstores.ipynb
[crate]: https://pypi.org/project/crate/
[Example: Advanced RAG with use case]: https://github.com/crate/cratedb-examples/blob/main/topic/machine-learning/llm-langchain/cratedb_rag_customer_support_langchain.ipynb
[Example: Chat message history]: https://github.com/crate/cratedb-examples/blob/main/topic/machine-learning/llm-langchain/conversational_memory.ipynb
[Example: CrateDBCache]: https://github.com/crate/langchain-cratedb/blob/main/examples/basic/cache.py
[Example: CrateDBSemanticCache]: https://github.com/crate/langchain-cratedb/blob/main/examples/basic/cache.py
[Example: Basic RAG]: https://github.com/crate/cratedb-examples/blob/main/topic/machine-learning/llm-langchain/cratedb_rag_customer_support.ipynb
[Example: Basic vector search]: https://github.com/crate/cratedb-examples/blob/main/topic/machine-learning/llm-langchain/vector_search.ipynb
[Example: Load data from database table]: https://github.com/crate/cratedb-examples/blob/main/topic/machine-learning/llm-langchain/document_loader.ipynb
[LangChain]: https://www.langchain.com/
[langchain]: https://github.com/langchain-ai/langchain
[langchain-postgres]: https://github.com/langchain-ai/langchain-postgres
[Llama]: https://www.llama.com/
[OpenAI]: https://openai.com/
[Using LangChain with CrateDB]: https://cratedb.com/docs/guide/integrate/langchain/

[Changelog]: https://github.com/crate/langchain-cratedb/blob/cratedb/CHANGES.md
[Community Forum]: https://community.cratedb.com/
[Documentation]: https://cratedb.com/docs/guide/integrate/langchain/
[Issues]: https://github.com/crate/langchain-cratedb/issues
[License]: https://github.com/crate/langchain-cratedb/blob/cratedb/LICENSE
[managed on GitHub]: https://github.com/crate/langchain-cratedb
[PyPI]: https://pypi.org/project/langchain-cratedb/
[Source code]: https://github.com/crate/langchain-cratedb

[badge-bluesky]: https://img.shields.io/badge/Bluesky-0285FF?logo=bluesky&logoColor=fff&label=Follow%20%40CrateDB
[badge-ci]: https://github.com/crate/langchain-cratedb/actions/workflows/ci.yml/badge.svg
[badge-downloads-per-month]: https://pepy.tech/badge/langchain-cratedb/month
[badge-license]: https://img.shields.io/github/license/crate/langchain-cratedb.svg
[badge-package-version]: https://img.shields.io/pypi/v/langchain-cratedb.svg
[badge-python-versions]: https://img.shields.io/pypi/pyversions/langchain-cratedb.svg
[badge-release-notes]: https://img.shields.io/github/release/crate/langchain-cratedb?label=Release+Notes
[badge-status]: https://img.shields.io/pypi/status/langchain-cratedb.svg
[project-bluesky]: https://bsky.app/search?q=cratedb
[project-ci]: https://github.com/crate/langchain-cratedb/actions/workflows/ci.yml
[project-downloads]: https://pepy.tech/project/langchain-cratedb/
[project-license]: https://github.com/crate/langchain-cratedb/blob/cratedb/LICENSE
[project-pypi]: https://pypi.org/project/langchain-cratedb
[project-release-notes]: https://github.com/crate/langchain-cratedb/releases


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/crate/langchain-cratedb",
    "name": "langchain-cratedb",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.9",
    "maintainer_email": null,
    "keywords": "ai, artificial intelligence, cratedb, embedding vectors, fulltext search, langchain, llm, machine learning, ml, rag, semantic search, vdbms, vector embeddings, vector database, vector search, vector store",
    "author": null,
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/26/46/0eb010d117400bf897e2fc184568e6eff4f9bccfa1d738e265d6847e9c13/langchain_cratedb-0.1.0.tar.gz",
    "platform": null,
    "description": "# langchain-cratedb\n\n[![Bluesky][badge-bluesky]][project-bluesky]\n[![Release Notes][badge-release-notes]][project-release-notes]\n[![CI][badge-ci]][project-ci]\n[![Downloads per month][badge-downloads-per-month]][project-downloads]\n\n[![Package version][badge-package-version]][project-pypi]\n[![License][badge-license]][project-license]\n[![Status][badge-status]][project-pypi]\n[![Supported Python versions][badge-python-versions]][project-pypi]\n\n\u00bb [Documentation]\n| [Changelog]\n| [PyPI]\n| [Issues]\n| [Source code]\n| [License]\n| [CrateDB]\n| [Community Forum]\n\nThe `langchain-cratedb` package implements the [CrateDB provider for LangChain],\ni.e. core LangChain abstractions using [CrateDB] or [CrateDB Cloud].\n\nFeel free to use the abstractions as provided or else modify them / extend them\nas appropriate for your own applications. We appreciate contributions of any kind.\n\n## Introduction\n\nCrateDB is a distributed and scalable SQL database for storing and analyzing\nmassive amounts of data in near real-time, even with complex queries.\nIt is PostgreSQL-compatible, and based on Lucene.\n\nLangChain is a composable framework to build context-aware, reasoning\napplications with large language models, leveraging your company\u2019s data\nand APIs.\n\nLangChain for CrateDB is an AI/ML framework that unlocks the application\nof LLM technologies to hands-on projects, covering many needs end-to-end.\nIt builds upon the large array of utilities bundled by the LangChain\ntoolkit and the ultra-fast indexing capabilities of CrateDB.\n\nYou can apply [LangChain] to implement text-based applications using commercial\nmodels, for example provided by [OpenAI], or open-source models, for example\nMeta's [Llama] multilingual text-only and text-image models.\n\n## Installation\n\n```bash\npip install --upgrade langchain-cratedb\n```\n\n## Requirements\n\nThe package currently supports CrateDB and its Python DB API driver,\navailable per [crate] package. It will be automatically installed\nwhen installing the LangChain adapter.\n\nYou can run [CrateDB Self-Managed] or start using [CrateDB Cloud],\nsee [CrateDB Installation], or [CrateDB Cloud Console].\n\n## Usage\n\nTo learn about the LangChain adapter for CrateDB, please refer to the\ndocumentation and examples:\n\n- [Using LangChain with CrateDB]\n- [CrateDB LangChain examples]\n\n### Vector Store\n\nA few notebooks demonstrate how to use the CrateDB vector store functionality\naround its `FLOAT_VECTOR` data type and its `KNN_MATCH` function together with\nLangChain.\n\nYou will learn how to import and query unstructured data using the\n`CrateDBVectorStore`, for example to create a retrieval augmented generation\n(RAG) pipeline.\n\nRetrieval-Augmented Generation (RAG) combines a retrieval system, which fetches\nrelevant documents, with a generative model, allowing it to incorporate external\nknowledge for more accurate and informed responses.\n\n- [Example: Basic vector search]\n- [Example: Basic RAG]\n- [Example: Advanced RAG with use case]\n\n### Document Loader\n\nThis notebook demonstrates how to load documents from a CrateDB database, using\nLangChain's `SQLDatabase` and `CrateDBLoader` interfaces, based on SQLAlchemy.\n\n- [Example: Load data from database table]\n\n### Chat History\n\nThe chat message history adapter helps to store and manage chat message history\nin a CrateDB table, for supporting conversational memory.\n\n- [Example: Chat message history]\n\n### Full Cache\n\nThe standard / full cache avoids invoking the LLM when the supplied\nprompt is exactly the same as one encountered already.\n\n- [Example: CrateDBCache]\n\n### Semantic Cache\n\nThe semantic cache allows users to retrieve cached prompts based on semantic\nsimilarity between the user input and previously cached inputs, also avoiding\nto invoke the LLM when not needed.\n\n- [Example: CrateDBSemanticCache]\n\n\n## Project Information\n\n### Acknowledgements\nKudos to the authors of all the many software components this library is\ninheriting from and building upon, most notably the [langchain-postgres]\npackage, and [langchain] itself.\n\n### Contributing\nThe `langchain-cratedb` package is an open source project, and is\n[managed on GitHub]. We appreciate contributions of any kind.\n\n### License\nThe project uses the MIT license, like the langchain-postgres project\nit is deriving from.\n\n\n[CrateDB]: https://cratedb.com/database\n[CrateDB Cloud]: https://cratedb.com/database/cloud\n[CrateDB Cloud Console]: https://console.cratedb.cloud/\n[CrateDB Installation]: https://cratedb.com/docs/guide/install/\n[CrateDB LangChain examples]: https://github.com/crate/cratedb-examples/tree/main/topic/machine-learning/llm-langchain\n[CrateDB provider for LangChain]: https://python.langchain.com/docs/integrations/providers/cratedb/\n[CrateDB Self-Managed]: https://cratedb.com/database/self-managed\n[CrateDBVectorStore]: https://github.com/crate/langchain-cratedb/blob/cratedb/docs/vectorstores.ipynb\n[crate]: https://pypi.org/project/crate/\n[Example: Advanced RAG with use case]: https://github.com/crate/cratedb-examples/blob/main/topic/machine-learning/llm-langchain/cratedb_rag_customer_support_langchain.ipynb\n[Example: Chat message history]: https://github.com/crate/cratedb-examples/blob/main/topic/machine-learning/llm-langchain/conversational_memory.ipynb\n[Example: CrateDBCache]: https://github.com/crate/langchain-cratedb/blob/main/examples/basic/cache.py\n[Example: CrateDBSemanticCache]: https://github.com/crate/langchain-cratedb/blob/main/examples/basic/cache.py\n[Example: Basic RAG]: https://github.com/crate/cratedb-examples/blob/main/topic/machine-learning/llm-langchain/cratedb_rag_customer_support.ipynb\n[Example: Basic vector search]: https://github.com/crate/cratedb-examples/blob/main/topic/machine-learning/llm-langchain/vector_search.ipynb\n[Example: Load data from database table]: https://github.com/crate/cratedb-examples/blob/main/topic/machine-learning/llm-langchain/document_loader.ipynb\n[LangChain]: https://www.langchain.com/\n[langchain]: https://github.com/langchain-ai/langchain\n[langchain-postgres]: https://github.com/langchain-ai/langchain-postgres\n[Llama]: https://www.llama.com/\n[OpenAI]: https://openai.com/\n[Using LangChain with CrateDB]: https://cratedb.com/docs/guide/integrate/langchain/\n\n[Changelog]: https://github.com/crate/langchain-cratedb/blob/cratedb/CHANGES.md\n[Community Forum]: https://community.cratedb.com/\n[Documentation]: https://cratedb.com/docs/guide/integrate/langchain/\n[Issues]: https://github.com/crate/langchain-cratedb/issues\n[License]: https://github.com/crate/langchain-cratedb/blob/cratedb/LICENSE\n[managed on GitHub]: https://github.com/crate/langchain-cratedb\n[PyPI]: https://pypi.org/project/langchain-cratedb/\n[Source code]: https://github.com/crate/langchain-cratedb\n\n[badge-bluesky]: https://img.shields.io/badge/Bluesky-0285FF?logo=bluesky&logoColor=fff&label=Follow%20%40CrateDB\n[badge-ci]: https://github.com/crate/langchain-cratedb/actions/workflows/ci.yml/badge.svg\n[badge-downloads-per-month]: https://pepy.tech/badge/langchain-cratedb/month\n[badge-license]: https://img.shields.io/github/license/crate/langchain-cratedb.svg\n[badge-package-version]: https://img.shields.io/pypi/v/langchain-cratedb.svg\n[badge-python-versions]: https://img.shields.io/pypi/pyversions/langchain-cratedb.svg\n[badge-release-notes]: https://img.shields.io/github/release/crate/langchain-cratedb?label=Release+Notes\n[badge-status]: https://img.shields.io/pypi/status/langchain-cratedb.svg\n[project-bluesky]: https://bsky.app/search?q=cratedb\n[project-ci]: https://github.com/crate/langchain-cratedb/actions/workflows/ci.yml\n[project-downloads]: https://pepy.tech/project/langchain-cratedb/\n[project-license]: https://github.com/crate/langchain-cratedb/blob/cratedb/LICENSE\n[project-pypi]: https://pypi.org/project/langchain-cratedb\n[project-release-notes]: https://github.com/crate/langchain-cratedb/releases\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Use LangChain with CrateDB",
    "version": "0.1.0",
    "project_urls": {
        "Homepage": "https://github.com/crate/langchain-cratedb",
        "Release Notes": "https://github.com/crate/langchain-cratedb/releases",
        "Repository": "https://github.com/crate/langchain-cratedb",
        "Source Code": "https://github.com/crate/langchain-cratedb"
    },
    "split_keywords": [
        "ai",
        " artificial intelligence",
        " cratedb",
        " embedding vectors",
        " fulltext search",
        " langchain",
        " llm",
        " machine learning",
        " ml",
        " rag",
        " semantic search",
        " vdbms",
        " vector embeddings",
        " vector database",
        " vector search",
        " vector store"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "57acd6f206e5a1004eb2f23d259a0c727b20e881836587246c5660b37d6c6c84",
                "md5": "c2b4b620af843edd6edbb9256cad01d1",
                "sha256": "d267fd41904c632af705c497bf2057113ac3638ae2ea3cdb2f1b6fac54bbc04b"
            },
            "downloads": -1,
            "filename": "langchain_cratedb-0.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c2b4b620af843edd6edbb9256cad01d1",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.9",
            "size": 23513,
            "upload_time": "2025-01-03T10:00:45",
            "upload_time_iso_8601": "2025-01-03T10:00:45.773141Z",
            "url": "https://files.pythonhosted.org/packages/57/ac/d6f206e5a1004eb2f23d259a0c727b20e881836587246c5660b37d6c6c84/langchain_cratedb-0.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "26460eb010d117400bf897e2fc184568e6eff4f9bccfa1d738e265d6847e9c13",
                "md5": "cb1ae5fbf6e34bb1260b385f40b4dd23",
                "sha256": "ea0e63be0917314c7046fe0d371e8cd66117ce1010cbf036a683c09ac9ddc644"
            },
            "downloads": -1,
            "filename": "langchain_cratedb-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "cb1ae5fbf6e34bb1260b385f40b4dd23",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.9",
            "size": 21687,
            "upload_time": "2025-01-03T10:00:48",
            "upload_time_iso_8601": "2025-01-03T10:00:48.037648Z",
            "url": "https://files.pythonhosted.org/packages/26/46/0eb010d117400bf897e2fc184568e6eff4f9bccfa1d738e265d6847e9c13/langchain_cratedb-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-01-03 10:00:48",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "crate",
    "github_project": "langchain-cratedb",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "langchain-cratedb"
}
        
Elapsed time: 1.69075s