1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 nix-update-script,
6
7 # build-system
8 pdm-backend,
9
10 # dependencies
11 langchain-core,
12 tokenizers,
13 httpx,
14 httpx-sse,
15 pydantic,
16
17 # tests
18 langchain-tests,
19 pytest-asyncio,
20 pytestCheckHook,
21}:
22
23buildPythonPackage rec {
24 pname = "langchain-mistralai";
25 version = "0.2.10";
26 pyproject = true;
27
28 src = fetchFromGitHub {
29 owner = "langchain-ai";
30 repo = "langchain";
31 tag = "langchain-mistralai==${version}";
32 hash = "sha256-1oH9GRvjYv/YzedKXeWgw5nwNgMQ9mSNkmZ2xwPekXc=";
33 };
34
35 sourceRoot = "${src.name}/libs/partners/mistralai";
36
37 build-system = [ pdm-backend ];
38
39 dependencies = [
40 langchain-core
41 tokenizers
42 httpx
43 httpx-sse
44 pydantic
45 ];
46
47 pythonRelaxDeps = [
48 # Each component release requests the exact latest core.
49 # That prevents us from updating individual components.
50 "langchain-core"
51 ];
52
53 nativeCheckInputs = [
54 langchain-tests
55 pytest-asyncio
56 pytestCheckHook
57 ];
58
59 pytestFlagsArray = [ "tests/unit_tests" ];
60
61 pythonImportsCheck = [ "langchain_mistralai" ];
62
63 passthru.updateScript = nix-update-script {
64 extraArgs = [
65 "--version-regex"
66 "langchain-mistralai==([0-9.]+)"
67 ];
68 };
69
70 meta = {
71 changelog = "https://github.com/langchain-ai/langchain-mistralai/releases/tag/langchain-mistralai==${version}";
72 description = "Build LangChain applications with mistralai";
73 homepage = "https://github.com/langchain-ai/langchain/tree/master/libs/partners/mistralai";
74 license = lib.licenses.mit;
75 maintainers = [
76 lib.maintainers.sarahec
77 ];
78 };
79}