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