generated from langchain-ai/integration-repo-template
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
32 changed files
with
5,553 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,5 @@ | ||
# 🦜️🔗 LangChain {partner} | ||
|
||
This repository contains {n} packages with {partner} integrations with LangChain: | ||
This repository contains 1 package with Datastax integrations with LangChain: | ||
|
||
- [langchain-{package}](https://pypi.org/project/langchain-{package}/) integrates [{product}}]({product_link}). | ||
{- ... if more packages} | ||
|
||
## Initial Repo Checklist (Remove this section after completing) | ||
|
||
This setup assumes that the partner package is already split. For those instructions, | ||
see [these docs](https://python.langchain.com/docs/contributing/integrations#partner-packages). | ||
|
||
- [ ] Fill out the readme above (for folks that follow pypi link) | ||
- [ ] Copy package into /libs folder | ||
- [ ] Update these fields in /libs/*/pyproject.toml | ||
|
||
- `tool.poetry.repository` | ||
- `tool.poetry.urls["Source Code"]` | ||
|
||
- [ ] Add integration testing secrets in Github (ask Erick for help) | ||
- [ ] Add secrets as env vars in .github/workflows/_release.yml | ||
- [ ] Configure `LIB_DIRS` in .github/scripts/check_diff.py | ||
- [ ] Add partner collaborators in Github (ask Erick for help) | ||
- [ ] Add new repo to test-pypi and pypi trusted publishing (ask Erick for help) | ||
- [ ] Populate .github/workflows/_release.yml with `on.workflow_dispatch.inputs.working-directory.default` | ||
- [langchain-astradb](https://pypi.org/project/langchain-astradb/) integrates [AstraDB](https://www.datastax.com/products/datastax-astra). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
__pycache__ | ||
*.env | ||
.mypy_cache | ||
.ruff_cache | ||
.pytest_cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2023 LangChain, Inc. | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
SHELL := /bin/bash | ||
.PHONY: all format lint test tests integration_test integration_tests spell_check help | ||
|
||
# Default target executed when no arguments are given to make. | ||
all: help | ||
|
||
# Define a variable for the test file path. | ||
TEST_FILE ?= tests/unit_tests/ | ||
INTEGRATION_TEST_FILE ?= tests/integration_tests/ | ||
|
||
test: | ||
poetry run pytest $(TEST_FILE) | ||
|
||
tests: | ||
poetry run pytest $(TEST_FILE) | ||
|
||
integration_test: | ||
poetry run pytest $(INTEGRATION_TEST_FILE) | ||
|
||
integration_tests: | ||
poetry run pytest $(INTEGRATION_TEST_FILE) | ||
|
||
###################### | ||
# LINTING AND FORMATTING | ||
###################### | ||
|
||
# Define a variable for Python and notebook files. | ||
PYTHON_FILES=. | ||
MYPY_CACHE=.mypy_cache | ||
lint format: PYTHON_FILES=. | ||
lint_diff format_diff: PYTHON_FILES=$(shell git diff --relative=libs/partners/astradb --name-only --diff-filter=d master | grep -E '\.py$$|\.ipynb$$') | ||
lint_package: PYTHON_FILES=langchain_astradb | ||
lint_tests: PYTHON_FILES=tests | ||
lint_tests: MYPY_CACHE=.mypy_cache_test | ||
|
||
lint lint_diff lint_package lint_tests: | ||
poetry run ruff . | ||
poetry run ruff format $(PYTHON_FILES) --diff | ||
poetry run ruff --select I $(PYTHON_FILES) | ||
mkdir -p $(MYPY_CACHE); poetry run mypy $(PYTHON_FILES) --cache-dir $(MYPY_CACHE) | ||
|
||
format format_diff: | ||
poetry run ruff format $(PYTHON_FILES) | ||
poetry run ruff --select I --fix $(PYTHON_FILES) | ||
|
||
spell_check: | ||
poetry run codespell --toml pyproject.toml | ||
|
||
spell_fix: | ||
poetry run codespell --toml pyproject.toml -w | ||
|
||
check_imports: $(shell find langchain_astradb -name '*.py') | ||
poetry run python ./scripts/check_imports.py $^ | ||
|
||
###################### | ||
# HELP | ||
###################### | ||
|
||
help: | ||
@echo '----' | ||
@echo 'check_imports - check imports' | ||
@echo 'format - run code formatters' | ||
@echo 'lint - run linters' | ||
@echo 'test - run unit tests' | ||
@echo 'tests - run unit tests' | ||
@echo 'test TEST_FILE=<test_file> - run all tests in file' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
# langchain-astradb | ||
|
||
This package contains the LangChain integrations for using DataStax Astra DB. | ||
|
||
> DataStax [Astra DB](https://docs.datastax.com/en/astra/home/astra.html) is a serverless vector-capable database built on Apache Cassandra® and made conveniently available | ||
> through an easy-to-use JSON API. | ||
_**Note.** For a short transitional period, only some of the Astra DB integration classes are contained in this package (the remaining ones being still in `langchain-community`). In a short while, and surely by version 0.2 of LangChain, all of the Astra DB support will be removed from `langchain-community` and included in this package._ | ||
|
||
## Installation and Setup | ||
|
||
Installation of this partner package: | ||
|
||
```bash | ||
pip install langchain-astradb | ||
``` | ||
|
||
## Integrations overview | ||
|
||
### Vector Store | ||
|
||
```python | ||
from langchain_astradb import AstraDBVectorStore | ||
|
||
my_store = AstraDBVectorStore( | ||
embedding=my_embeddings, | ||
collection_name="my_store", | ||
api_endpoint="https://...", | ||
token="AstraCS:...", | ||
) | ||
``` | ||
|
||
### Chat message history | ||
|
||
```python | ||
from langchain_astradb import AstraDBChatMessageHistory | ||
message_history = AstraDBChatMessageHistory( | ||
session_id="test-session", | ||
api_endpoint="...", | ||
token="...", | ||
) | ||
``` | ||
|
||
### Store | ||
|
||
```python | ||
from langchain_astradb import AstraDBStore | ||
store = AstraDBStore( | ||
collection_name="my_kv_store", | ||
api_endpoint="...", | ||
token="..." | ||
) | ||
``` | ||
|
||
### Byte Store | ||
|
||
```python | ||
from langchain_astradb import AstraDBByteStore | ||
store = AstraDBByteStore( | ||
collection_name="my_kv_store", | ||
api_endpoint="...", | ||
token="..." | ||
) | ||
``` | ||
|
||
## Reference | ||
|
||
See the [LangChain docs page](https://python.langchain.com/docs/integrations/providers/astradb) for a more detailed listing. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from langchain_astradb.chat_message_histories import AstraDBChatMessageHistory | ||
from langchain_astradb.storage import AstraDBByteStore, AstraDBStore | ||
from langchain_astradb.vectorstores import AstraDBVectorStore | ||
|
||
__all__ = [ | ||
"AstraDBByteStore", | ||
"AstraDBStore", | ||
"AstraDBChatMessageHistory", | ||
"AstraDBVectorStore", | ||
] |
Oops, something went wrong.