Skip to content

Latest commit

 

History

History
163 lines (124 loc) · 6.96 KB

README.md

File metadata and controls

163 lines (124 loc) · 6.96 KB

langchain-cratedb

Bluesky Release Notes CI Downloads per month

Package version License Status Supported Python versions

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

The langchain-cratedb package implements core LangChain abstractions using CrateDB or CrateDB Cloud.

The package is released under the MIT license.

Feel free to use the abstraction as provided or else modify them / extend them as appropriate for your own application. 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

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:

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. CrateDBVectorStore

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.

Document Loader

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

Chat History

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

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.