101 lines
1.9 KiB
Nix
101 lines
1.9 KiB
Nix
{
|
|
lib,
|
|
buildPythonPackage,
|
|
fetchFromGitHub,
|
|
|
|
# build-system
|
|
hatchling,
|
|
|
|
# dependencies
|
|
huggingface-hub,
|
|
langchain-core,
|
|
sentence-transformers,
|
|
tokenizers,
|
|
transformers,
|
|
|
|
# tests
|
|
freezegun,
|
|
httpx,
|
|
lark,
|
|
pandas,
|
|
pytest-asyncio,
|
|
pytest-mock,
|
|
pytest-socket,
|
|
pytestCheckHook,
|
|
requests-mock,
|
|
responses,
|
|
syrupy,
|
|
toml,
|
|
|
|
# passthru
|
|
gitUpdater,
|
|
}:
|
|
|
|
buildPythonPackage (finalAttrs: {
|
|
pname = "langchain-huggingface";
|
|
version = "1.2.1";
|
|
pyproject = true;
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "langchain-ai";
|
|
repo = "langchain";
|
|
tag = "langchain-huggingface==${finalAttrs.version}";
|
|
hash = "sha256-I6n7UNEbGqlyzT663k7+YpcaB/+rE9RlkqIToupoEyY=";
|
|
};
|
|
|
|
sourceRoot = "${finalAttrs.src.name}/libs/partners/huggingface";
|
|
|
|
build-system = [ hatchling ];
|
|
|
|
dependencies = [
|
|
huggingface-hub
|
|
langchain-core
|
|
sentence-transformers
|
|
tokenizers
|
|
transformers
|
|
];
|
|
|
|
nativeCheckInputs = [
|
|
freezegun
|
|
httpx
|
|
lark
|
|
pandas
|
|
pytest-asyncio
|
|
pytest-mock
|
|
pytest-socket
|
|
pytestCheckHook
|
|
requests-mock
|
|
responses
|
|
syrupy
|
|
toml
|
|
];
|
|
|
|
enabledTestPaths = [ "tests/unit_tests" ];
|
|
|
|
disabledTests = [
|
|
# Requires a circular dependency on langchain
|
|
"test_init_chat_model_huggingface"
|
|
];
|
|
|
|
pythonImportsCheck = [ "langchain_huggingface" ];
|
|
|
|
passthru = {
|
|
# python updater script sets the wrong tag
|
|
skipBulkUpdate = true;
|
|
updateScript = gitUpdater {
|
|
rev-prefix = "langchain-huggingface==";
|
|
};
|
|
};
|
|
|
|
meta = {
|
|
changelog = "https://github.com/langchain-ai/langchain/releases/tag/${finalAttrs.src.tag}";
|
|
description = "Integration package connecting Huggingface related classes and LangChain";
|
|
homepage = "https://github.com/langchain-ai/langchain/tree/master/libs/partners/huggingface";
|
|
license = lib.licenses.mit;
|
|
maintainers = with lib.maintainers; [
|
|
natsukium
|
|
sarahec
|
|
];
|
|
};
|
|
})
|