1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5
6 # build-system
7 pdm-backend,
8
9 # dependencies
10 langchain-core,
11 ollama,
12
13 # testing
14 langchain-tests,
15 pytestCheckHook,
16 pytest-asyncio,
17 syrupy,
18
19 # passthru
20 gitUpdater,
21}:
22
23buildPythonPackage rec {
24 pname = "langchain-ollama";
25 version = "0.3.6";
26 pyproject = true;
27
28 src = fetchFromGitHub {
29 owner = "langchain-ai";
30 repo = "langchain";
31 tag = "langchain-ollama==${version}";
32 hash = "sha256-GQkyJaYvwRbjDR0Rfen7/X5hFhY2+WU74B6/9Ufhpo4=";
33 };
34
35 sourceRoot = "${src.name}/libs/partners/ollama";
36
37 build-system = [
38 pdm-backend
39 ];
40
41 pythonRelaxDeps = [
42 # Each component release requests the exact latest core.
43 # That prevents us from updating individual components.
44 "langchain-core"
45 ];
46
47 dependencies = [
48 langchain-core
49 ollama
50 ];
51
52 nativeCheckInputs = [
53 langchain-tests
54 pytestCheckHook
55 pytest-asyncio
56 syrupy
57 ];
58
59 enabledTestPaths = [ "tests/unit_tests" ];
60
61 pythonImportsCheck = [ "langchain_ollama" ];
62
63 passthru.updateScript = gitUpdater {
64 rev-prefix = "langchain-ollama==";
65 };
66
67 meta = {
68 changelog = "https://github.com/langchain-ai/langchain/releases/tag/${src.tag}";
69 description = "Integration package connecting Ollama and LangChain";
70 homepage = "https://github.com/langchain-ai/langchain/tree/master/libs/partners/ollama";
71 license = lib.licenses.mit;
72 maintainers = with lib.maintainers; [ sarahec ];
73 };
74}