langchain-kinetica 1.0.0__tar.gz → 1.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. langchain_kinetica-1.2.0/.editorconfig +52 -0
  2. langchain_kinetica-1.2.0/.github/workflows/release.yml +47 -0
  3. langchain_kinetica-1.2.0/.github/workflows/test.yml +46 -0
  4. langchain_kinetica-1.2.0/.gitignore +166 -0
  5. langchain_kinetica-1.2.0/.python-version +1 -0
  6. langchain_kinetica-1.2.0/Makefile +74 -0
  7. langchain_kinetica-1.2.0/PKG-INFO +69 -0
  8. langchain_kinetica-1.2.0/README.md +53 -0
  9. langchain_kinetica-1.2.0/langchain_kinetica/__init__.py +33 -0
  10. langchain_kinetica-1.2.0/langchain_kinetica/chat_models.py +537 -0
  11. langchain_kinetica-1.2.0/langchain_kinetica/document_loaders.py +89 -0
  12. langchain_kinetica-1.2.0/langchain_kinetica/py.typed +0 -0
  13. langchain_kinetica-1.2.0/langchain_kinetica/vectorstores.py +934 -0
  14. langchain_kinetica-1.2.0/notebooks/README.md +37 -0
  15. langchain_kinetica-1.2.0/notebooks/kinetica_chat.ipynb +475 -0
  16. langchain_kinetica-1.2.0/notebooks/kinetica_loader.ipynb +152 -0
  17. langchain_kinetica-1.2.0/notebooks/kinetica_provider.ipynb +125 -0
  18. langchain_kinetica-1.2.0/notebooks/kinetica_retriever.ipynb +227 -0
  19. langchain_kinetica-1.2.0/notebooks/kinetica_vectorstore.ipynb +425 -0
  20. langchain_kinetica-1.2.0/notebooks/state_of_the_union.txt +723 -0
  21. langchain_kinetica-1.2.0/pyproject.toml +108 -0
  22. langchain_kinetica-1.2.0/scripts/check_imports.py +19 -0
  23. langchain_kinetica-1.2.0/scripts/lint_imports.sh +17 -0
  24. langchain_kinetica-1.2.0/tests/integration_tests/__init__.py +1 -0
  25. langchain_kinetica-1.2.0/tests/integration_tests/test_chat_models.py +196 -0
  26. langchain_kinetica-1.2.0/tests/integration_tests/test_vectorstores.py +318 -0
  27. langchain_kinetica-1.2.0/tests/unit_tests/__init__.py +1 -0
  28. langchain_kinetica-1.2.0/tests/unit_tests/test_unit_chat_models.py +69 -0
  29. langchain_kinetica-1.2.0/uv.lock +3831 -0
  30. langchain-kinetica-1.0.0/LICENSE +0 -21
  31. langchain-kinetica-1.0.0/PKG-INFO +0 -110
  32. langchain-kinetica-1.0.0/README.md +0 -72
  33. langchain-kinetica-1.0.0/pyproject.toml +0 -31
  34. langchain-kinetica-1.0.0/setup.cfg +0 -4
  35. langchain-kinetica-1.0.0/src/langchain_kinetica/__init__.py +0 -8
  36. langchain-kinetica-1.0.0/src/langchain_kinetica/llm_chat.py +0 -183
  37. langchain-kinetica-1.0.0/src/langchain_kinetica/sa_datafile.py +0 -60
  38. langchain-kinetica-1.0.0/src/langchain_kinetica/sa_dto.py +0 -111
  39. langchain-kinetica-1.0.0/src/langchain_kinetica/sql_output.py +0 -45
  40. langchain-kinetica-1.0.0/src/langchain_kinetica.egg-info/PKG-INFO +0 -110
  41. langchain-kinetica-1.0.0/src/langchain_kinetica.egg-info/SOURCES.txt +0 -13
  42. langchain-kinetica-1.0.0/src/langchain_kinetica.egg-info/dependency_links.txt +0 -1
  43. langchain-kinetica-1.0.0/src/langchain_kinetica.egg-info/requires.txt +0 -3
  44. langchain-kinetica-1.0.0/src/langchain_kinetica.egg-info/top_level.txt +0 -1
@@ -0,0 +1,52 @@
1
+ # top-most EditorConfig file
2
+ root = true
3
+
4
+ # All files
5
+ [*]
6
+ charset = utf-8
7
+ end_of_line = lf
8
+ insert_final_newline = true
9
+ trim_trailing_whitespace = true
10
+
11
+ # Python files
12
+ [*.py]
13
+ indent_style = space
14
+ indent_size = 4
15
+ max_line_length = 88
16
+
17
+ # JSON files
18
+ [*.json]
19
+ indent_style = space
20
+ indent_size = 2
21
+
22
+ # YAML files
23
+ [*.{yml,yaml}]
24
+ indent_style = space
25
+ indent_size = 2
26
+
27
+ # Markdown files
28
+ [*.md]
29
+ indent_style = space
30
+ indent_size = 2
31
+ trim_trailing_whitespace = false
32
+
33
+ # Configuration files
34
+ [*.{toml,ini,cfg}]
35
+ indent_style = space
36
+ indent_size = 4
37
+
38
+ # Shell scripts
39
+ [*.sh]
40
+ indent_style = space
41
+ indent_size = 2
42
+
43
+ # Makefile
44
+ [Makefile]
45
+ indent_style = tab
46
+ indent_size = 4
47
+
48
+ # Jupyter notebooks
49
+ [*.ipynb]
50
+ # Jupyter may include trailing whitespace in cell
51
+ # outputs that's semantically meaningful
52
+ trim_trailing_whitespace = false
@@ -0,0 +1,47 @@
1
+ # Based on:
2
+ # https://github.com/astral-sh/trusted-publishing-examples/blob/main/.github/workflows/release.yml
3
+
4
+ name: Release
5
+
6
+ on:
7
+ push:
8
+ tags:
9
+ # Publish on any tag starting with a `v`, e.g., v1.2.3
10
+ - v*
11
+
12
+ jobs:
13
+ pypi:
14
+ name: Publish to PyPI
15
+ runs-on: ubuntu-latest
16
+ # Environment and permissions trusted publishing.
17
+ environment:
18
+ # Create this environment in the GitHub repository under Settings -> Environments
19
+ name: pypi
20
+ permissions:
21
+ id-token: write
22
+ contents: read
23
+
24
+ steps:
25
+ - name: Checkout
26
+ uses: actions/checkout@v6
27
+
28
+ - name: Install the latest version of uv
29
+ uses: astral-sh/setup-uv@v7
30
+ with:
31
+ enable-cache: true
32
+
33
+ - name: Install Python
34
+ run: uv python install
35
+
36
+ - name: Build
37
+ run: uv build
38
+
39
+ - name: Test Imports
40
+ run: |
41
+ uv run --isolated --no-project \
42
+ --with dist/*.whl \
43
+ python -c "from langchain_kinetica import *"
44
+ echo "All imports successful"
45
+
46
+ - name: Publish
47
+ run: uv publish
@@ -0,0 +1,46 @@
1
+ # Basic CI setup: Lint with ruff, run tests with pytest
2
+ # Based on:
3
+ # https://github.com/astral-sh/trusted-publishing-examples/blob/main/.github/workflows/ci.yml
4
+
5
+ name: Test
6
+
7
+ on:
8
+ pull_request:
9
+ push:
10
+ branches:
11
+ - master
12
+
13
+ jobs:
14
+ lint:
15
+ name: Lint and Test
16
+ runs-on: ubuntu-latest
17
+
18
+ steps:
19
+ - uses: actions/checkout@v6
20
+
21
+ - name: Install the latest version of uv
22
+ uses: astral-sh/setup-uv@v7
23
+ with:
24
+ enable-cache: true
25
+
26
+ - name: Install the project
27
+ run: uv sync --locked --all-extras --dev
28
+
29
+ - name: Ruff lint
30
+ run: uv run ruff check .
31
+
32
+ - name: Ruff format
33
+ run: uv run ruff format --diff .
34
+
35
+ - name: Build Project
36
+ run: uv build
37
+
38
+ - name: Test Imports
39
+ run: |
40
+ uv run --isolated --no-project \
41
+ --with dist/*.whl \
42
+ python -c "from langchain_kinetica import *"
43
+ echo "All imports successful"
44
+
45
+ - name: Run unit tests
46
+ run: uv run python -m pytest tests/unit_tests
@@ -0,0 +1,166 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ build/
12
+ develop-eggs/
13
+ dist/
14
+ downloads/
15
+ eggs/
16
+ .eggs/
17
+ lib/
18
+ lib64/
19
+ parts/
20
+ sdist/
21
+ var/
22
+ wheels/
23
+ share/python-wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+ MANIFEST
28
+
29
+ # PyInstaller
30
+ # Usually these files are written by a python script from a template
31
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
32
+ *.manifest
33
+ *.spec
34
+
35
+ # Installer logs
36
+ pip-log.txt
37
+ pip-delete-this-directory.txt
38
+
39
+ # Unit test / coverage reports
40
+ htmlcov/
41
+ .tox/
42
+ .nox/
43
+ .coverage
44
+ .coverage.*
45
+ .cache
46
+ nosetests.xml
47
+ coverage.xml
48
+ *.cover
49
+ *.py,cover
50
+ .hypothesis/
51
+ .pytest_cache/
52
+ cover/
53
+
54
+ # Translations
55
+ *.mo
56
+ *.pot
57
+
58
+ # Django stuff:
59
+ *.log
60
+ local_settings.py
61
+ db.sqlite3
62
+ db.sqlite3-journal
63
+
64
+ # Flask stuff:
65
+ instance/
66
+ .webassets-cache
67
+
68
+ # Scrapy stuff:
69
+ .scrapy
70
+
71
+ # Sphinx documentation
72
+ docs/_build/
73
+
74
+ # PyBuilder
75
+ .pybuilder/
76
+ target/
77
+
78
+ # Jupyter Notebook
79
+ .ipynb_checkpoints
80
+
81
+ # IPython
82
+ profile_default/
83
+ ipython_config.py
84
+
85
+ # pyenv
86
+ # For a library or package, you might want to ignore these files since the code is
87
+ # intended to run in multiple environments; otherwise, check them in:
88
+ # .python-version
89
+
90
+ # pipenv
91
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
93
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
94
+ # install all needed dependencies.
95
+ #Pipfile.lock
96
+
97
+ # poetry
98
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
99
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
100
+ # commonly ignored for libraries.
101
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
102
+ #poetry.lock
103
+
104
+ # pdm
105
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
106
+ #pdm.lock
107
+ # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
108
+ # in version control.
109
+ # https://pdm.fming.dev/#use-with-ide
110
+ .pdm.toml
111
+
112
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
113
+ __pypackages__/
114
+
115
+ # Celery stuff
116
+ celerybeat-schedule
117
+ celerybeat.pid
118
+
119
+ # SageMath parsed files
120
+ *.sage.py
121
+
122
+ # Environments
123
+ .env
124
+ .venv
125
+ env/
126
+ venv/
127
+ ENV/
128
+ env.bak/
129
+ venv.bak/
130
+
131
+ # Spyder project settings
132
+ .spyderproject
133
+ .spyproject
134
+
135
+ # Rope project settings
136
+ .ropeproject
137
+
138
+ # mkdocs documentation
139
+ /site
140
+
141
+ # mypy
142
+ .mypy_cache/
143
+ .dmypy.json
144
+ dmypy.json
145
+
146
+ # Pyre type checker
147
+ .pyre/
148
+
149
+ # pytype static type analyzer
150
+ .pytype/
151
+
152
+ # Cython debug symbols
153
+ cython_debug/
154
+
155
+ # PyCharm
156
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
157
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
158
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
159
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
160
+ #.idea/
161
+
162
+ .DS_Store
163
+
164
+ .ruff_cache/
165
+
166
+ md_docs/
@@ -0,0 +1 @@
1
+ 3.13
@@ -0,0 +1,74 @@
1
+ .PHONY: all format lint test tests integration_tests help extended_tests docs
2
+
3
+ # Default target executed when no arguments are given to make.
4
+ all: help
5
+
6
+ .EXPORT_ALL_VARIABLES:
7
+ UV_FROZEN = true
8
+
9
+ # Define a variable for the test file path.
10
+ TEST_FILE ?= tests/unit_tests/
11
+
12
+ integration_test integration_tests: TEST_FILE=tests/integration_tests/
13
+
14
+ test tests:
15
+ uv run --group test pytest --disable-socket --allow-unix-socket $(TEST_FILE)
16
+
17
+ integration_test integration_tests:
18
+ uv run --group test pytest $(TEST_FILE)
19
+ # --record-mode=new_episodes
20
+
21
+ test_watch:
22
+ uv run --group test ptw --snapshot-update --now . -- -vv $(TEST_FILE)
23
+
24
+ ######################
25
+ # LINTING AND FORMATTING
26
+ ######################
27
+
28
+ # Define a variable for Python and notebook files.
29
+ PYTHON_FILES=.
30
+ MYPY_CACHE=.mypy_cache
31
+ lint format: PYTHON_FILES=.
32
+ lint_diff format_diff: PYTHON_FILES=$(shell git diff --name-only --diff-filter=d master | grep -E '\.py$$|\.ipynb$$')
33
+ lint_package: PYTHON_FILES=langchain_kinetica
34
+ lint_tests: PYTHON_FILES=tests
35
+ lint_tests: MYPY_CACHE=.mypy_cache_test
36
+
37
+ lint lint_diff lint_package lint_tests:
38
+ [ "$(PYTHON_FILES)" = "" ] || uv run ruff check $(PYTHON_FILES)
39
+ [ "$(PYTHON_FILES)" = "" ] || uv run ruff format $(PYTHON_FILES) --diff
40
+ [ "$(PYTHON_FILES)" = "" ] || mkdir -p $(MYPY_CACHE) && uv run mypy $(PYTHON_FILES) --cache-dir $(MYPY_CACHE)
41
+
42
+ format format_diff:
43
+ [ "$(PYTHON_FILES)" = "" ] || uv run ruff format $(PYTHON_FILES)
44
+ [ "$(PYTHON_FILES)" = "" ] || uv run ruff check --fix $(PYTHON_FILES)
45
+
46
+ check_imports: $(shell find langchain_kinetica -name '*.py')
47
+ uv run python ./scripts/check_imports.py $^
48
+
49
+ ######################
50
+ # Generate docs
51
+ ######################
52
+
53
+ NB_FILES=./notebooks/*.ipynb
54
+
55
+ DOCS_DIR=./md_docs
56
+
57
+ docs:
58
+ uv run jupyter nbconvert \
59
+ --to markdown --output-dir=$(DOCS_DIR) \
60
+ $(NB_FILES)
61
+
62
+ ######################
63
+ # HELP
64
+ ######################
65
+
66
+ help:
67
+ @echo '----'
68
+ @echo 'check_imports - check imports'
69
+ @echo 'format - run code formatters'
70
+ @echo 'lint - run linters'
71
+ @echo 'test - run unit tests'
72
+ @echo 'tests - run unit tests'
73
+ @echo 'test TEST_FILE=<test_file> - run all tests in file'
74
+ @echo 'docs - generate markdown documentation from notebooks'
@@ -0,0 +1,69 @@
1
+ Metadata-Version: 2.4
2
+ Name: langchain-kinetica
3
+ Version: 1.2.0
4
+ Summary: An integration package connecting Kinetica and LangChain
5
+ Project-URL: Homepage, https://kinetica.com
6
+ Project-URL: Documentation, https://docs.kinetica.com/7.1/sql-gpt/
7
+ Project-URL: Repository, https://github.com/kineticadb/langchain-kinetica
8
+ Author-email: Chad Juliano <cjuliano@kinetica.com>
9
+ License: MIT
10
+ Requires-Python: <4.0.0,>=3.10.0
11
+ Requires-Dist: gpudb[dataframe]>=7.1.9.10
12
+ Requires-Dist: langchain-core<2.0.0,>=1.1.0
13
+ Requires-Dist: pandas<3.0.0,>=2.2.0
14
+ Requires-Dist: pydantic-settings>=2.12.0
15
+ Description-Content-Type: text/markdown
16
+
17
+ # langchain-kinetica
18
+
19
+ [![PyPI - Version](https://img.shields.io/pypi/v/langchain-kinetica?label=%20)](https://pypi.org/project/langchain-kinetica/#history)
20
+ [![PyPI - License](https://img.shields.io/pypi/l/langchain-kinetica)](https://opensource.org/licenses/MIT)
21
+ [![PyPI - Downloads](https://img.shields.io/pepy/dt/langchain-kinetica)](https://pypistats.org/packages/langchain-kinetica)
22
+ [![Test](https://github.com/kineticadb/langchain-kinetica/actions/workflows/test.yml/badge.svg)](https://github.com/kineticadb/langchain-kinetica/actions/workflows/test.yml)
23
+
24
+ This project contains the Kinetica integration
25
+ provider for Langchain. [Kinetica](https://www.kinetica.com/) is a real-time database purpose built for enabling
26
+ analytics and generative AI on time-series & spatial data.
27
+
28
+ - [Features](#features)
29
+ - [Quick Install](#quick-install)
30
+ - [Documentation](#documentation)
31
+ - [Testing](#testing)
32
+ - [See Also](#see-also)
33
+
34
+ ## Features
35
+
36
+ This package provides integration for core capabilities:
37
+
38
+ - **Chat model** - Kinetica native Text-to-SQL Generation.
39
+ - **Vector Store** - Vector similarity search using Kinetica tables.
40
+ - **Document Loader** - Generate embeddings from Kinetica tables.
41
+ - **Retriever** - Document retriever based on the Vector Store.
42
+
43
+ ## Quick Install
44
+
45
+ ```bash
46
+ pip install langchain-kinetica
47
+ ```
48
+
49
+ ## Documentation
50
+
51
+ For conceptual guides, tutorials, and examples on using these classes, see the [Kinetica Provider Docs](https://docs.langchain.com/oss/python/integrations/providers/kinetica).
52
+
53
+ The documentation is also available in notebook format under `./notebooks`.
54
+
55
+ ## Testing
56
+
57
+ In addition the `make test` macro these tests can be run individually.
58
+
59
+ ```
60
+ $ make integration_tests TEST_FILE=tests/integration_tests/test_chat_models.py
61
+
62
+ $ make integration_tests TEST_FILE=tests/integration_tests/test_vectorstores.py::test_kinetica
63
+ ```
64
+
65
+ ## See Also
66
+
67
+ - [Kinetica LLM Documentation](https://docs.kinetica.com/7.2/sql-gpt/)
68
+ - [LangChain Chat Models](https://docs.langchain.com/oss/python/langchain/models)
69
+ - [Contributing to LangChain](https://docs.langchain.com/oss/python/contributing/overview)
@@ -0,0 +1,53 @@
1
+ # langchain-kinetica
2
+
3
+ [![PyPI - Version](https://img.shields.io/pypi/v/langchain-kinetica?label=%20)](https://pypi.org/project/langchain-kinetica/#history)
4
+ [![PyPI - License](https://img.shields.io/pypi/l/langchain-kinetica)](https://opensource.org/licenses/MIT)
5
+ [![PyPI - Downloads](https://img.shields.io/pepy/dt/langchain-kinetica)](https://pypistats.org/packages/langchain-kinetica)
6
+ [![Test](https://github.com/kineticadb/langchain-kinetica/actions/workflows/test.yml/badge.svg)](https://github.com/kineticadb/langchain-kinetica/actions/workflows/test.yml)
7
+
8
+ This project contains the Kinetica integration
9
+ provider for Langchain. [Kinetica](https://www.kinetica.com/) is a real-time database purpose built for enabling
10
+ analytics and generative AI on time-series & spatial data.
11
+
12
+ - [Features](#features)
13
+ - [Quick Install](#quick-install)
14
+ - [Documentation](#documentation)
15
+ - [Testing](#testing)
16
+ - [See Also](#see-also)
17
+
18
+ ## Features
19
+
20
+ This package provides integration for core capabilities:
21
+
22
+ - **Chat model** - Kinetica native Text-to-SQL Generation.
23
+ - **Vector Store** - Vector similarity search using Kinetica tables.
24
+ - **Document Loader** - Generate embeddings from Kinetica tables.
25
+ - **Retriever** - Document retriever based on the Vector Store.
26
+
27
+ ## Quick Install
28
+
29
+ ```bash
30
+ pip install langchain-kinetica
31
+ ```
32
+
33
+ ## Documentation
34
+
35
+ For conceptual guides, tutorials, and examples on using these classes, see the [Kinetica Provider Docs](https://docs.langchain.com/oss/python/integrations/providers/kinetica).
36
+
37
+ The documentation is also available in notebook format under `./notebooks`.
38
+
39
+ ## Testing
40
+
41
+ In addition the `make test` macro these tests can be run individually.
42
+
43
+ ```
44
+ $ make integration_tests TEST_FILE=tests/integration_tests/test_chat_models.py
45
+
46
+ $ make integration_tests TEST_FILE=tests/integration_tests/test_vectorstores.py::test_kinetica
47
+ ```
48
+
49
+ ## See Also
50
+
51
+ - [Kinetica LLM Documentation](https://docs.kinetica.com/7.2/sql-gpt/)
52
+ - [LangChain Chat Models](https://docs.langchain.com/oss/python/langchain/models)
53
+ - [Contributing to LangChain](https://docs.langchain.com/oss/python/contributing/overview)
@@ -0,0 +1,33 @@
1
+ """An integration package connecting Kinetica and LangChain."""
2
+
3
+ from importlib import metadata
4
+
5
+ from langchain_kinetica.chat_models import (
6
+ ChatKinetica,
7
+ KineticaSqlOutputParser,
8
+ KineticaSqlResponse,
9
+ )
10
+ from langchain_kinetica.document_loaders import KineticaLoader
11
+ from langchain_kinetica.vectorstores import (
12
+ DistanceStrategy,
13
+ KineticaSettings,
14
+ KineticaVectorstore,
15
+ )
16
+
17
+ try:
18
+ __version__ = metadata.version(__package__)
19
+ except metadata.PackageNotFoundError:
20
+ # Case where package metadata is not available.
21
+ __version__ = ""
22
+ del metadata # optional, avoids polluting the results of dir(__package__)
23
+
24
+ __all__ = [
25
+ "ChatKinetica",
26
+ "DistanceStrategy",
27
+ "KineticaLoader",
28
+ "KineticaSettings",
29
+ "KineticaSqlOutputParser",
30
+ "KineticaSqlResponse",
31
+ "KineticaVectorstore",
32
+ "__version__",
33
+ ]