1{ 2 lib, 3 buildPythonPackage, 4 fetchFromGitHub, 5 6 # build-system 7 setuptools, 8 9 # dependencies 10 jsonschema, 11 numpy, 12 opencv-python-headless, 13 pillow, 14 pydantic, 15 pydantic-extra-types, 16 requests, 17 sentencepiece, 18 tiktoken, 19 typing-extensions, 20 21 # tests 22 click, 23 fastapi, 24 huggingface-hub, 25 openai, 26 pycountry, 27 pydantic-settings, 28 pytestCheckHook, 29 soundfile, 30 soxr, 31 uvicorn, 32}: 33 34buildPythonPackage rec { 35 pname = "mistral-common"; 36 version = "1.8.4"; 37 pyproject = true; 38 39 src = fetchFromGitHub { 40 owner = "mistralai"; 41 repo = "mistral-common"; 42 tag = "v${version}"; 43 hash = "sha256-HB6dsqiDSLhjyANk7ZT/cU98mjJamegAF0uKH8GfgM8="; 44 }; 45 46 build-system = [ setuptools ]; 47 48 dependencies = [ 49 jsonschema 50 numpy 51 opencv-python-headless 52 pillow 53 pydantic 54 pydantic-extra-types 55 requests 56 sentencepiece 57 tiktoken 58 typing-extensions 59 ]; 60 61 pythonImportsCheck = [ "mistral_common" ]; 62 63 nativeCheckInputs = [ 64 click 65 fastapi 66 huggingface-hub 67 openai 68 pycountry 69 pydantic-settings 70 pytestCheckHook 71 soundfile 72 soxr 73 uvicorn 74 ]; 75 76 disabledTests = [ 77 # Require internet 78 "test_download_gated_image" 79 "test_image_encoder_formats" 80 "test_image_processing" 81 82 # AssertionError: Regex pattern did not match. 83 "test_from_url" 84 85 # AssertionError, Extra items in the right set 86 "test_openai_chat_fields" 87 ]; 88 89 meta = { 90 description = "Tools to help you work with Mistral models"; 91 homepage = "https://github.com/mistralai/mistral-common"; 92 changelog = "https://github.com/mistralai/mistral-common/releases/tag/v${version}"; 93 license = lib.licenses.asl20; 94 maintainers = with lib.maintainers; [ bgamari ]; 95 }; 96}