summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/langchain-experimental/default.nix
blob: 84b8e7a40d92d9876c7cc0532f0378995d1f3690 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  pythonAtLeast,

  # build-system
  pdm-backend,

  # dependencies
  langchain-core,
  langchain-community,

  # testing
  langchain-tests,
  pytestCheckHook,

  # passthru
  gitUpdater,
}:

buildPythonPackage rec {
  pname = "langchain-experimental";
  version = "0.4.1";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "langchain-ai";
    repo = "langchain-experimental";
    tag = "libs/experimental/v${version}";
    hash = "sha256-3hz63DCoym2V4b6Wzi0eH+B8mvGu7pqRNj3Ltk04UTk=";
  };

  sourceRoot = "${src.name}/libs/experimental";

  patches = [
    # Remove it when https://github.com/langchain-ai/langchain-experimental/pull/58 is merged and released
    ./001-avoid-check-fullpath.patch
  ];

  build-system = [
    pdm-backend
  ];

  pythonRelaxDeps = [
    # Each component release requests the exact latest core.
    # That prevents us from updating individual components.
    "langchain-core"
    "langchain-community"
  ];

  dependencies = [
    langchain-core
    langchain-community
  ];

  nativeCheckInputs = [
    langchain-tests
    pytestCheckHook
  ];

  pytestFlagsArray = [ "tests/unit_tests" ];

  pythonImportsCheck = [ "langchain_experimental" ];

  disabledTests = lib.optionals (pythonAtLeast "3.14") [
    # AttributeError: module 'ast' has no attribute 'Str'
    # https://github.com/langchain-ai/langchain-community/issues/492
    "test_color_question_1"
    "test_color_question_2"
  ];

  passthru.updateScript = gitUpdater {
    rev-prefix = "libs/experimental/v";
  };

  meta = {
    changelog = "https://github.com/langchain-ai/langchain-experimental/releases/tag/${src.tag}";
    description = "Experimental features for LangChain";
    homepage = "https://github.com/langchain-ai/langchain-experimental/tree/main/libs/experimental";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [
      mrdev023
      sarahec
    ];
  };
}