2023-08-10 07:59:29 +00:00
|
|
|
{
|
2024-06-05 15:53:02 +00:00
|
|
|
lib,
|
|
|
|
buildPythonPackage,
|
|
|
|
pythonOlder,
|
|
|
|
fetchFromGitHub,
|
|
|
|
pythonRelaxDepsHook,
|
|
|
|
# propagated build input
|
|
|
|
faiss,
|
|
|
|
torch,
|
|
|
|
transformers,
|
|
|
|
huggingface-hub,
|
|
|
|
numpy,
|
|
|
|
pyyaml,
|
|
|
|
regex,
|
|
|
|
# optional-dependencies
|
|
|
|
aiohttp,
|
|
|
|
fastapi,
|
|
|
|
uvicorn,
|
|
|
|
# TODO add apache-libcloud
|
|
|
|
# , apache-libcloud
|
|
|
|
rich,
|
|
|
|
duckdb,
|
|
|
|
pillow,
|
|
|
|
networkx,
|
|
|
|
python-louvain,
|
|
|
|
onnx,
|
|
|
|
onnxruntime,
|
|
|
|
soundfile,
|
|
|
|
scipy,
|
|
|
|
ttstokenizer,
|
|
|
|
beautifulsoup4,
|
|
|
|
nltk,
|
|
|
|
pandas,
|
|
|
|
tika,
|
|
|
|
imagehash,
|
|
|
|
timm,
|
|
|
|
fasttext,
|
|
|
|
sentencepiece,
|
|
|
|
accelerate,
|
|
|
|
onnxmltools,
|
|
|
|
annoy,
|
|
|
|
hnswlib,
|
|
|
|
# TODO add pymagnitude-lite
|
|
|
|
#, pymagnitude-lite
|
|
|
|
scikit-learn,
|
|
|
|
sentence-transformers,
|
|
|
|
croniter,
|
|
|
|
openpyxl,
|
|
|
|
requests,
|
|
|
|
xmltodict,
|
|
|
|
# native check inputs
|
|
|
|
unittestCheckHook,
|
2023-08-10 07:59:29 +00:00
|
|
|
}:
|
|
|
|
let
|
2024-06-05 15:53:02 +00:00
|
|
|
version = "7.2.0";
|
|
|
|
api = [
|
|
|
|
aiohttp
|
|
|
|
fastapi
|
|
|
|
uvicorn
|
|
|
|
];
|
2023-08-10 07:59:29 +00:00
|
|
|
# cloud = [ apache-libcloud ];
|
|
|
|
console = [ rich ];
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
database = [
|
|
|
|
duckdb
|
|
|
|
pillow
|
|
|
|
];
|
2023-08-10 07:59:29 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
graph = [
|
|
|
|
networkx
|
|
|
|
python-louvain
|
|
|
|
];
|
2023-08-10 07:59:29 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
model = [
|
|
|
|
onnx
|
|
|
|
onnxruntime
|
|
|
|
];
|
2023-08-10 07:59:29 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
pipeline-audio = [
|
|
|
|
onnx
|
|
|
|
onnxruntime
|
|
|
|
soundfile
|
|
|
|
scipy
|
|
|
|
ttstokenizer
|
|
|
|
];
|
|
|
|
pipeline-data = [
|
|
|
|
beautifulsoup4
|
|
|
|
nltk
|
|
|
|
pandas
|
|
|
|
tika
|
|
|
|
];
|
|
|
|
pipeline-image = [
|
|
|
|
imagehash
|
|
|
|
pillow
|
|
|
|
timm
|
|
|
|
];
|
|
|
|
pipeline-text = [
|
|
|
|
fasttext
|
|
|
|
sentencepiece
|
|
|
|
];
|
|
|
|
pipeline-train = [
|
|
|
|
accelerate
|
|
|
|
onnx
|
|
|
|
onnxmltools
|
|
|
|
onnxruntime
|
|
|
|
];
|
2023-08-10 07:59:29 +00:00
|
|
|
pipeline = pipeline-audio ++ pipeline-data ++ pipeline-image ++ pipeline-text ++ pipeline-train;
|
|
|
|
|
|
|
|
similarity = [
|
|
|
|
annoy
|
|
|
|
fasttext
|
|
|
|
hnswlib
|
|
|
|
# pymagnitude-lite
|
|
|
|
scikit-learn
|
|
|
|
sentence-transformers
|
|
|
|
];
|
|
|
|
workflow = [
|
|
|
|
# apache-libcloud
|
|
|
|
croniter
|
|
|
|
openpyxl
|
|
|
|
pandas
|
|
|
|
pillow
|
|
|
|
requests
|
|
|
|
xmltodict
|
|
|
|
];
|
|
|
|
all = api ++ console ++ database ++ graph ++ model ++ pipeline ++ similarity ++ workflow;
|
|
|
|
|
|
|
|
optional-dependencies = {
|
2024-06-05 15:53:02 +00:00
|
|
|
inherit
|
|
|
|
api
|
|
|
|
console
|
|
|
|
database
|
|
|
|
graph
|
|
|
|
model
|
|
|
|
pipeline-audio
|
|
|
|
pipeline-image
|
|
|
|
pipeline-text
|
|
|
|
pipeline-train
|
|
|
|
pipeline
|
|
|
|
similarity
|
|
|
|
workflow
|
|
|
|
all
|
|
|
|
;
|
2023-08-10 07:59:29 +00:00
|
|
|
};
|
|
|
|
in
|
|
|
|
buildPythonPackage {
|
|
|
|
pname = "txtai";
|
|
|
|
inherit version;
|
|
|
|
format = "setuptools";
|
|
|
|
|
2023-10-19 13:55:26 +00:00
|
|
|
disabled = pythonOlder "3.8";
|
2023-08-10 07:59:29 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "neuml";
|
|
|
|
repo = "txtai";
|
2023-08-22 20:05:09 +00:00
|
|
|
rev = "refs/tags/v${version}";
|
2024-06-05 15:53:02 +00:00
|
|
|
hash = "sha256-2d31wzUz0/FcrejDIog2EI4BXgjd7XXpN4tRXpLk5DI=";
|
2023-08-10 07:59:29 +00:00
|
|
|
};
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
nativeBuildInputs = [ pythonRelaxDepsHook ];
|
2023-08-10 07:59:29 +00:00
|
|
|
|
|
|
|
pythonRemoveDeps = [
|
|
|
|
# We call it faiss, not faiss-cpu.
|
|
|
|
"faiss-cpu"
|
|
|
|
];
|
|
|
|
|
|
|
|
propagatedBuildInputs = [
|
|
|
|
faiss
|
|
|
|
torch
|
|
|
|
transformers
|
|
|
|
huggingface-hub
|
|
|
|
numpy
|
|
|
|
pyyaml
|
|
|
|
regex
|
|
|
|
];
|
|
|
|
|
|
|
|
passthru.optional-dependencies = optional-dependencies;
|
|
|
|
|
|
|
|
pythonImportsCheck = [ "txtai" ];
|
|
|
|
|
|
|
|
# some tests hang forever
|
|
|
|
doCheck = false;
|
|
|
|
|
|
|
|
preCheck = ''
|
|
|
|
export TRANSFORMERS_CACHE=$(mktemp -d)
|
|
|
|
'';
|
|
|
|
|
|
|
|
nativeCheckInputs = [
|
|
|
|
unittestCheckHook
|
|
|
|
] ++ optional-dependencies.api ++ optional-dependencies.similarity;
|
|
|
|
|
|
|
|
unittestFlagsArray = [
|
2024-06-05 15:53:02 +00:00
|
|
|
"-s"
|
|
|
|
"test/python"
|
|
|
|
"-v"
|
2023-08-10 07:59:29 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Semantic search and workflows powered by language models";
|
|
|
|
changelog = "https://github.com/neuml/txtai/releases/tag/v${version}";
|
|
|
|
homepage = "https://github.com/neuml/txtai";
|
|
|
|
license = licenses.asl20;
|
|
|
|
maintainers = with maintainers; [ happysalada ];
|
|
|
|
};
|
|
|
|
}
|