nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5
6 # build-system
7 hatchling,
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 = "1.1.1";
28 pyproject = true;
29
30 src = fetchFromGitHub {
31 owner = "langchain-ai";
32 repo = "langchain";
33 tag = "langchain-mistralai==${version}";
34 hash = "sha256-cdUl6LusttH6c0tBvaxQR5UGHjwyubKELCDv61VQ6Qo=";
35 };
36
37 sourceRoot = "${src.name}/libs/partners/mistralai";
38
39 build-system = [ hatchling ];
40
41 dependencies = [
42 langchain-core
43 tokenizers
44 httpx
45 httpx-sse
46 pydantic
47 ];
48
49 nativeCheckInputs = [
50 langchain-tests
51 pytest-asyncio
52 pytestCheckHook
53 ];
54
55 enabledTestPaths = [ "tests/unit_tests" ];
56
57 disabledTests = [
58 # Comparison error due to message formatting differences
59 "test__convert_dict_to_message_tool_call"
60 # Fails when langchain-core gets ahead of this package
61 "test_serdes"
62 # RuntimeError: Cannot send a request, as the client has been closed.
63 # Tries to download from huggingface hub
64 "test_mistral_init"
65 ];
66
67 pythonImportsCheck = [ "langchain_mistralai" ];
68
69 passthru = {
70 # python updater script sets the wrong tag
71 skipBulkUpdate = true;
72 updateScript = gitUpdater {
73 rev-prefix = "langchain-mistralai==";
74 };
75 };
76
77 meta = {
78 changelog = "https://github.com/langchain-ai/langchain/releases/tag/${src.tag}";
79 description = "Build LangChain applications with mistralai";
80 homepage = "https://github.com/langchain-ai/langchain/tree/master/libs/partners/mistralai";
81 license = lib.licenses.mit;
82 maintainers = [
83 lib.maintainers.sarahec
84 ];
85 };
86}