python3Packages.llm-sentence-transformers: init at 0.3.2

This commit is contained in:
Philip Taron
2025-05-31 20:22:54 -07:00
parent c83f08dd2b
commit 5471027b2c
4 changed files with 87 additions and 0 deletions
+3
View File
@@ -17,6 +17,7 @@
enable-llm-ollama ? false,
enable-llm-openai-plugin ? false,
enable-llm-openrouter ? false,
enable-llm-sentence-transformers ? false,
enable-llm-templates-fabric ? false,
enable-llm-templates-github ? false,
enable-llm-venice ? false,
@@ -43,6 +44,7 @@ let
llm-ollama
llm-openai-plugin
llm-openrouter
llm-sentence-transformers
llm-templates-fabric
llm-templates-github
llm-venice
@@ -70,6 +72,7 @@ toPythonApplication (
++ lib.optionals enable-llm-ollama [ llm-ollama ]
++ lib.optionals enable-llm-openai-plugin [ llm-openai-plugin ]
++ lib.optionals enable-llm-openrouter [ llm-openrouter ]
++ lib.optionals enable-llm-sentence-transformers [ llm-sentence-transformers ]
++ lib.optionals enable-llm-templates-fabric [ llm-templates-fabric ]
++ lib.optionals enable-llm-templates-github [ llm-templates-github ]
++ lib.optionals enable-llm-venice [ llm-venice ]
@@ -0,0 +1,60 @@
{
lib,
callPackage,
buildPythonPackage,
fetchFromGitHub,
setuptools,
llm,
einops,
sentence-transformers,
pytestCheckHook,
writableTmpDirAsHomeHook,
}:
buildPythonPackage rec {
pname = "llm-sentence-transformers";
version = "0.3.2";
pyproject = true;
src = fetchFromGitHub {
owner = "simonw";
repo = "llm-sentence-transformers";
tag = version;
hash = "sha256-FDDMItKFEYEptiL3EHKgKVxClqRU9RaM3uD3xP0F4OM=";
};
build-system = [
setuptools
llm
];
dependencies = [
einops
sentence-transformers
];
nativeCheckInputs = [
pytestCheckHook
writableTmpDirAsHomeHook
];
# Disabled because they access the network
disabledTests = [
"test_run_embedding"
"test_embed_multi_with_generator"
];
pythonImportsCheck = [ "llm_sentence_transformers" ];
passthru.tests = {
llm-plugin = callPackage ./tests/llm-plugin.nix { };
};
meta = {
description = "LLM plugin for embeddings using sentence-transformers";
homepage = "https://github.com/simonw/llm-sentence-transformers";
changelog = "https://github.com/simonw/llm-sentence-transformers/releases/tag/${version}/CHANGELOG.md";
license = lib.licenses.asl20;
maintainers = with lib.maintainers; [ philiptaron ];
};
}
@@ -0,0 +1,22 @@
{
runCommand,
python,
yq,
}:
let
venv = python.withPackages (ps: [
ps.llm
ps.llm-sentence-transformers
]);
in
runCommand "llm-sentence-transformers-test-llm-plugin"
{
nativeBuildInputs = [
venv
yq
];
}
''
llm plugins | yq --exit-status 'any(.name == "llm-sentence-transformers")'
touch "$out"
''
+2
View File
@@ -8326,6 +8326,8 @@ self: super: with self; {
llm-openrouter = callPackage ../development/python-modules/llm-openrouter { };
llm-sentence-transformers = callPackage ../development/python-modules/llm-sentence-transformers { };
llm-templates-fabric = callPackage ../development/python-modules/llm-templates-fabric { };
llm-templates-github = callPackage ../development/python-modules/llm-templates-github { };