💡 All-in-one AI framework for semantic search, LLM orchestration and language model workflows
Python agentsaiai-agentsembeddingsinformation-retrievallanguage-modellarge-language-modelsllmnlppythonragretrieval-augmented-generationsearchsearch-enginesemantic-searchsentence-embeddingstransformerstxtaivector-databasevector-search
Add txtai_minimal package, closes #1090
davidmezzettid0ddedc04855
diff --git a/.github/workflows/minimal.yml b/.github/workflows/minimal.ymlindex 80744085..444ebfff 100644--- a/.github/workflows/minimal.yml+++ b/.github/workflows/minimal.yml@@ -15,13 +15,8 @@ jobs:with:python-version: "3.10"- - name: Base install- run: |- pip install -U pip wheel- pip install .- python -c "import txtai"-- name: Minimal installrun: |- pip uninstall -y faiss-cpu msgpack torch+ pip install -U pip wheel+ MINIMAL=1 pip install .python -c "import txtai"diff --git a/README.md b/README.mdindex fedf351e..55979322 100644--- a/README.md+++ b/README.md@@ -192,7 +192,7 @@ pip install txtaiPython 3.10+ is supported. Using a Python [virtual environment](https://docs.python.org/3/library/venv.html) is recommended.-See the detailed [install instructions](https://neuml.github.io/txtai/install) for more information covering [optional dependencies](https://neuml.github.io/txtai/install/#optional-dependencies), [environment specific prerequisites](https://neuml.github.io/txtai/install/#environment-specific-prerequisites), [installing from source](https://neuml.github.io/txtai/install/#install-from-source), [conda support](https://neuml.github.io/txtai/install/#conda) and how to [run with containers](https://neuml.github.io/txtai/cloud).+See the detailed [install instructions](https://neuml.github.io/txtai/install) for more information covering [optional dependencies](https://neuml.github.io/txtai/install/#optional-dependencies), [environment specific prerequisites](https://neuml.github.io/txtai/install/#environment-specific-prerequisites), [installing from source](https://neuml.github.io/txtai/install/#install-from-source), [conda support](https://neuml.github.io/txtai/install/#conda), [lightweight minimal installation](https://neuml.github.io/txtai/install/#minimal-install) and how to [run with containers](https://neuml.github.io/txtai/cloud).## Model guidediff --git a/docs/install.md b/docs/install.mdindex 22dd2676..e9f9d0eb 100644--- a/docs/install.md+++ b/docs/install.md@@ -146,7 +146,7 @@ The [txtai build workflow](https://github.com/neuml/txtai/blob/master/.github/wo## CPU-only-The default install adds PyTorch with GPU support. There are a number of dependencies that come with that. When running in a CPU-only environment or using Embeddings/LLM models without PyTorch (i.e. llama.cpp or API services), the CPU-only PyTorch package can be installed with txtai as follows.+The default install adds PyTorch with GPU support. There are a number of dependencies that come with that. When running in a CPU-only environment, the CPU-only PyTorch package can be installed with txtai as follows.```pip install txtai torch==[version]+cpu \@@ -173,6 +173,22 @@ A [community-supported txtai package](https://anaconda.org/conda-forge/txtai) isconda install -c conda-forge txtai```+## Minimal install++A lightweight minimal install package is available. This is helpful if `torch` or `faiss-cpu` has issues, is too heavy or there is no intention to use those libraries.++All the same extras mentioned above are available in this version of the package.++```+# Lightweight minimal install+pip install txtai_minimal++# Same as standard `txtai` install+pip install txtai_minimal[default]+```++Note that in order to use the `Embeddings` or `LLM` interface without `torch` requires either `llama.cpp` or `litellm`.+## Run with containersDocker images are available for txtai. [See this section](../cloud) for more information on container-based installs.diff --git a/setup.py b/setup.pyindex 64360096..440db395 100644--- a/setup.py+++ b/setup.py@@ -1,19 +1,37 @@-# pylint: disable = C0111+# pylint: disable = C0103,C0111+import os+from setuptools import find_packages, setupwith open("README.md", "r", encoding="utf-8") as f:# Remove GitHub dark mode imagesDESCRIPTION = "".join([line for line in f if "gh-dark-mode-only" not in line])-# Default dependencies-install = ["faiss-cpu>=1.7.1.post2", "msgpack>=1.0.7", "torch>=2.4", "transformers>=4.56.2"]+# Required dependencies+install = ["transformers>=4.56.2"]-# Default dependencies that are also base transformers dependencies+# Required dependencies that are also base transformers dependenciesinstall += ["huggingface-hub>=0.34.0", "numpy>=1.18.4", "pyyaml>=5.3", "regex>=2022.8.17", "safetensors>=0.4.5"]+# Default dependencies+default = ["faiss-cpu>=1.7.1.post2", "msgpack>=1.0.7", "torch>=2.4"]+# Optional dependenciesextras = {}+# Package name+package = "txtai"++if os.getenv("MINIMAL"):+ # Add default extra+ extras["default"] = default++ # Rename this package to have minimal suffix+ package += "_minimal"+else:+ # Default dependencies are required with standard install+ install += default+# Development dependencies - not included in "all" installextras["dev"] = ["black",@@ -139,7 +157,7 @@ extras["all"] = ()setup(- name="txtai",+ name=package,version="9.9.0",author="NeuML",description="All-in-one open-source AI framework for semantic search, LLM orchestration and language model workflows",