From 074b8daab3178179d832b2e04a1f97ad09f16c2c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 1 Aug 2024 17:04:29 +0200 Subject: [PATCH 01/12] build(deps): bump the minor group across 1 directory with 5 updates (#968) Bumps the minor group with 5 updates in the / directory: | Package | From | To | | --- | --- | --- | | [huggingface-hub](https://github.com/huggingface/huggingface_hub) | `0.24.0` | `0.24.5` | | [mypy](https://github.com/python/mypy) | `1.11.0` | `1.11.1` | | [ruff](https://github.com/astral-sh/ruff) | `0.5.4` | `0.5.5` | | [pre-commit](https://github.com/pre-commit/pre-commit) | `3.7.1` | `3.8.0` | | [pytest](https://github.com/pytest-dev/pytest) | `8.3.1` | `8.3.2` | Updates `huggingface-hub` from 0.24.0 to 0.24.5 - [Release notes](https://github.com/huggingface/huggingface_hub/releases) - [Commits](https://github.com/huggingface/huggingface_hub/compare/v0.24.0...v0.24.5) Updates `mypy` from 1.11.0 to 1.11.1 - [Changelog](https://github.com/python/mypy/blob/master/CHANGELOG.md) - [Commits](https://github.com/python/mypy/compare/v1.11...v1.11.1) Updates `ruff` from 0.5.4 to 0.5.5 - [Release notes](https://github.com/astral-sh/ruff/releases) - [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md) - [Commits](https://github.com/astral-sh/ruff/compare/0.5.4...0.5.5) Updates `pre-commit` from 3.7.1 to 3.8.0 - [Release notes](https://github.com/pre-commit/pre-commit/releases) - [Changelog](https://github.com/pre-commit/pre-commit/blob/main/CHANGELOG.md) - [Commits](https://github.com/pre-commit/pre-commit/compare/v3.7.1...v3.8.0) Updates `pytest` from 8.3.1 to 8.3.2 - [Release notes](https://github.com/pytest-dev/pytest/releases) - [Changelog](https://github.com/pytest-dev/pytest/blob/main/CHANGELOG.rst) - [Commits](https://github.com/pytest-dev/pytest/compare/8.3.1...8.3.2) --- updated-dependencies: - dependency-name: huggingface-hub dependency-type: direct:production update-type: version-update:semver-patch dependency-group: minor - dependency-name: mypy dependency-type: direct:development update-type: version-update:semver-patch dependency-group: minor - dependency-name: ruff dependency-type: direct:development update-type: version-update:semver-patch dependency-group: minor - dependency-name: pre-commit dependency-type: direct:development update-type: version-update:semver-minor dependency-group: minor - dependency-name: pytest dependency-type: direct:development update-type: version-update:semver-patch dependency-group: minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- poetry.lock | 114 ++++++++++++++++++++++++------------------------- pyproject.toml | 8 ++-- 2 files changed, 61 insertions(+), 61 deletions(-) diff --git a/poetry.lock b/poetry.lock index 240c2f9d2..abab7f0ad 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1458,13 +1458,13 @@ socks = ["socksio (==1.*)"] [[package]] name = "huggingface-hub" -version = "0.24.0" +version = "0.24.5" description = "Client library to download and publish models, datasets and other repos on the huggingface.co hub" optional = false python-versions = ">=3.8.0" files = [ - {file = "huggingface_hub-0.24.0-py3-none-any.whl", hash = "sha256:7ad92edefb93d8145c061f6df8d99df2ff85f8379ba5fac8a95aca0642afa5d7"}, - {file = "huggingface_hub-0.24.0.tar.gz", hash = "sha256:6c7092736b577d89d57b3cdfea026f1b0dc2234ae783fa0d59caf1bf7d52dfa7"}, + {file = "huggingface_hub-0.24.5-py3-none-any.whl", hash = "sha256:d93fb63b1f1a919a22ce91a14518974e81fc4610bf344dfe7572343ce8d3aced"}, + {file = "huggingface_hub-0.24.5.tar.gz", hash = "sha256:7b45d6744dd53ce9cbf9880957de00e9d10a9ae837f1c9b7255fc8fa4e8264f3"}, ] [package.dependencies] @@ -2761,38 +2761,38 @@ dill = ">=0.3.8" [[package]] name = "mypy" -version = "1.11.0" +version = "1.11.1" description = "Optional static typing for Python" optional = false python-versions = ">=3.8" files = [ - {file = "mypy-1.11.0-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:a3824187c99b893f90c845bab405a585d1ced4ff55421fdf5c84cb7710995229"}, - {file = "mypy-1.11.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:96f8dbc2c85046c81bcddc246232d500ad729cb720da4e20fce3b542cab91287"}, - {file = "mypy-1.11.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:1a5d8d8dd8613a3e2be3eae829ee891b6b2de6302f24766ff06cb2875f5be9c6"}, - {file = "mypy-1.11.0-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:72596a79bbfb195fd41405cffa18210af3811beb91ff946dbcb7368240eed6be"}, - {file = "mypy-1.11.0-cp310-cp310-win_amd64.whl", hash = "sha256:35ce88b8ed3a759634cb4eb646d002c4cef0a38f20565ee82b5023558eb90c00"}, - {file = "mypy-1.11.0-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:98790025861cb2c3db8c2f5ad10fc8c336ed2a55f4daf1b8b3f877826b6ff2eb"}, - {file = "mypy-1.11.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:25bcfa75b9b5a5f8d67147a54ea97ed63a653995a82798221cca2a315c0238c1"}, - {file = "mypy-1.11.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:0bea2a0e71c2a375c9fa0ede3d98324214d67b3cbbfcbd55ac8f750f85a414e3"}, - {file = "mypy-1.11.0-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:d2b3d36baac48e40e3064d2901f2fbd2a2d6880ec6ce6358825c85031d7c0d4d"}, - {file = "mypy-1.11.0-cp311-cp311-win_amd64.whl", hash = "sha256:d8e2e43977f0e09f149ea69fd0556623919f816764e26d74da0c8a7b48f3e18a"}, - {file = "mypy-1.11.0-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:1d44c1e44a8be986b54b09f15f2c1a66368eb43861b4e82573026e04c48a9e20"}, - {file = "mypy-1.11.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:cea3d0fb69637944dd321f41bc896e11d0fb0b0aa531d887a6da70f6e7473aba"}, - {file = "mypy-1.11.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:a83ec98ae12d51c252be61521aa5731f5512231d0b738b4cb2498344f0b840cd"}, - {file = "mypy-1.11.0-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:c7b73a856522417beb78e0fb6d33ef89474e7a622db2653bc1285af36e2e3e3d"}, - {file = "mypy-1.11.0-cp312-cp312-win_amd64.whl", hash = "sha256:f2268d9fcd9686b61ab64f077be7ffbc6fbcdfb4103e5dd0cc5eaab53a8886c2"}, - {file = "mypy-1.11.0-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:940bfff7283c267ae6522ef926a7887305945f716a7704d3344d6d07f02df850"}, - {file = "mypy-1.11.0-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:14f9294528b5f5cf96c721f231c9f5b2733164e02c1c018ed1a0eff8a18005ac"}, - {file = "mypy-1.11.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:d7b54c27783991399046837df5c7c9d325d921394757d09dbcbf96aee4649fe9"}, - {file = "mypy-1.11.0-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:65f190a6349dec29c8d1a1cd4aa71284177aee5949e0502e6379b42873eddbe7"}, - {file = "mypy-1.11.0-cp38-cp38-win_amd64.whl", hash = "sha256:dbe286303241fea8c2ea5466f6e0e6a046a135a7e7609167b07fd4e7baf151bf"}, - {file = "mypy-1.11.0-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:104e9c1620c2675420abd1f6c44bab7dd33cc85aea751c985006e83dcd001095"}, - {file = "mypy-1.11.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:f006e955718ecd8d159cee9932b64fba8f86ee6f7728ca3ac66c3a54b0062abe"}, - {file = "mypy-1.11.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:becc9111ca572b04e7e77131bc708480cc88a911adf3d0239f974c034b78085c"}, - {file = "mypy-1.11.0-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:6801319fe76c3f3a3833f2b5af7bd2c17bb93c00026a2a1b924e6762f5b19e13"}, - {file = "mypy-1.11.0-cp39-cp39-win_amd64.whl", hash = "sha256:c1a184c64521dc549324ec6ef7cbaa6b351912be9cb5edb803c2808a0d7e85ac"}, - {file = "mypy-1.11.0-py3-none-any.whl", hash = "sha256:56913ec8c7638b0091ef4da6fcc9136896914a9d60d54670a75880c3e5b99ace"}, - {file = "mypy-1.11.0.tar.gz", hash = "sha256:93743608c7348772fdc717af4aeee1997293a1ad04bc0ea6efa15bf65385c538"}, + {file = "mypy-1.11.1-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:a32fc80b63de4b5b3e65f4be82b4cfa362a46702672aa6a0f443b4689af7008c"}, + {file = "mypy-1.11.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:c1952f5ea8a5a959b05ed5f16452fddadbaae48b5d39235ab4c3fc444d5fd411"}, + {file = "mypy-1.11.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:e1e30dc3bfa4e157e53c1d17a0dad20f89dc433393e7702b813c10e200843b03"}, + {file = "mypy-1.11.1-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:2c63350af88f43a66d3dfeeeb8d77af34a4f07d760b9eb3a8697f0386c7590b4"}, + {file = "mypy-1.11.1-cp310-cp310-win_amd64.whl", hash = "sha256:a831671bad47186603872a3abc19634f3011d7f83b083762c942442d51c58d58"}, + {file = "mypy-1.11.1-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:7b6343d338390bb946d449677726edf60102a1c96079b4f002dedff375953fc5"}, + {file = "mypy-1.11.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:e4fe9f4e5e521b458d8feb52547f4bade7ef8c93238dfb5bbc790d9ff2d770ca"}, + {file = "mypy-1.11.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:886c9dbecc87b9516eff294541bf7f3655722bf22bb898ee06985cd7269898de"}, + {file = "mypy-1.11.1-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:fca4a60e1dd9fd0193ae0067eaeeb962f2d79e0d9f0f66223a0682f26ffcc809"}, + {file = "mypy-1.11.1-cp311-cp311-win_amd64.whl", hash = "sha256:0bd53faf56de9643336aeea1c925012837432b5faf1701ccca7fde70166ccf72"}, + {file = "mypy-1.11.1-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:f39918a50f74dc5969807dcfaecafa804fa7f90c9d60506835036cc1bc891dc8"}, + {file = "mypy-1.11.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:0bc71d1fb27a428139dd78621953effe0d208aed9857cb08d002280b0422003a"}, + {file = "mypy-1.11.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:b868d3bcff720dd7217c383474008ddabaf048fad8d78ed948bb4b624870a417"}, + {file = "mypy-1.11.1-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:a707ec1527ffcdd1c784d0924bf5cb15cd7f22683b919668a04d2b9c34549d2e"}, + {file = "mypy-1.11.1-cp312-cp312-win_amd64.whl", hash = "sha256:64f4a90e3ea07f590c5bcf9029035cf0efeae5ba8be511a8caada1a4893f5525"}, + {file = "mypy-1.11.1-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:749fd3213916f1751fff995fccf20c6195cae941dc968f3aaadf9bb4e430e5a2"}, + {file = "mypy-1.11.1-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:b639dce63a0b19085213ec5fdd8cffd1d81988f47a2dec7100e93564f3e8fb3b"}, + {file = "mypy-1.11.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:4c956b49c5d865394d62941b109728c5c596a415e9c5b2be663dd26a1ff07bc0"}, + {file = "mypy-1.11.1-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:45df906e8b6804ef4b666af29a87ad9f5921aad091c79cc38e12198e220beabd"}, + {file = "mypy-1.11.1-cp38-cp38-win_amd64.whl", hash = "sha256:d44be7551689d9d47b7abc27c71257adfdb53f03880841a5db15ddb22dc63edb"}, + {file = "mypy-1.11.1-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:2684d3f693073ab89d76da8e3921883019ea8a3ec20fa5d8ecca6a2db4c54bbe"}, + {file = "mypy-1.11.1-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:79c07eb282cb457473add5052b63925e5cc97dfab9812ee65a7c7ab5e3cb551c"}, + {file = "mypy-1.11.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_28_x86_64.whl", hash = "sha256:11965c2f571ded6239977b14deebd3f4c3abd9a92398712d6da3a772974fad69"}, + {file = "mypy-1.11.1-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:a2b43895a0f8154df6519706d9bca8280cda52d3d9d1514b2d9c3e26792a0b74"}, + {file = "mypy-1.11.1-cp39-cp39-win_amd64.whl", hash = "sha256:1a81cf05975fd61aec5ae16501a091cfb9f605dc3e3c878c0da32f250b74760b"}, + {file = "mypy-1.11.1-py3-none-any.whl", hash = "sha256:0624bdb940255d2dd24e829d99a13cfeb72e4e9031f9492148f410ed30bcab54"}, + {file = "mypy-1.11.1.tar.gz", hash = "sha256:f404a0b069709f18bbdb702eb3dcfe51910602995de00bd39cea3050b5772d08"}, ] [package.dependencies] @@ -3436,13 +3436,13 @@ tests = ["pytest (>=5.4.1)", "pytest-cov (>=2.8.1)", "pytest-mypy (>=0.8.0)", "p [[package]] name = "pre-commit" -version = "3.7.1" +version = "3.8.0" description = "A framework for managing and maintaining multi-language pre-commit hooks." optional = false python-versions = ">=3.9" files = [ - {file = "pre_commit-3.7.1-py2.py3-none-any.whl", hash = "sha256:fae36fd1d7ad7d6a5a1c0b0d5adb2ed1a3bda5a21bf6c3e5372073d7a11cd4c5"}, - {file = "pre_commit-3.7.1.tar.gz", hash = "sha256:8ca3ad567bc78a4972a3f1a477e94a79d4597e8140a6e0b651c5e33899c3654a"}, + {file = "pre_commit-3.8.0-py2.py3-none-any.whl", hash = "sha256:9a90a53bf82fdd8778d58085faf8d83df56e40dfe18f45b19446e26bf1b3a63f"}, + {file = "pre_commit-3.8.0.tar.gz", hash = "sha256:8bb6494d4a20423842e198980c9ecf9f96607a07ea29549e180eef9ae80fe7af"}, ] [package.dependencies] @@ -3872,13 +3872,13 @@ diagrams = ["jinja2", "railroad-diagrams"] [[package]] name = "pytest" -version = "8.3.1" +version = "8.3.2" description = "pytest: simple powerful testing with Python" optional = false python-versions = ">=3.8" files = [ - {file = "pytest-8.3.1-py3-none-any.whl", hash = "sha256:e9600ccf4f563976e2c99fa02c7624ab938296551f280835ee6516df8bc4ae8c"}, - {file = "pytest-8.3.1.tar.gz", hash = "sha256:7e8e5c5abd6e93cb1cc151f23e57adc31fcf8cfd2a3ff2da63e23f732de35db6"}, + {file = "pytest-8.3.2-py3-none-any.whl", hash = "sha256:4ba08f9ae7dcf84ded419494d229b48d0903ea6407b030eaec46df5e6a73bba5"}, + {file = "pytest-8.3.2.tar.gz", hash = "sha256:c132345d12ce551242c87269de812483f5bcc87cdbb4722e48487ba194f9fdce"}, ] [package.dependencies] @@ -4541,29 +4541,29 @@ files = [ [[package]] name = "ruff" -version = "0.5.4" +version = "0.5.5" description = "An extremely fast Python linter and code formatter, written in Rust." optional = false python-versions = ">=3.7" files = [ - {file = "ruff-0.5.4-py3-none-linux_armv6l.whl", hash = "sha256:82acef724fc639699b4d3177ed5cc14c2a5aacd92edd578a9e846d5b5ec18ddf"}, - {file = "ruff-0.5.4-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:da62e87637c8838b325e65beee485f71eb36202ce8e3cdbc24b9fcb8b99a37be"}, - {file = "ruff-0.5.4-py3-none-macosx_11_0_arm64.whl", hash = "sha256:e98ad088edfe2f3b85a925ee96da652028f093d6b9b56b76fc242d8abb8e2059"}, - {file = "ruff-0.5.4-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:4c55efbecc3152d614cfe6c2247a3054cfe358cefbf794f8c79c8575456efe19"}, - {file = "ruff-0.5.4-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:f9b85eaa1f653abd0a70603b8b7008d9e00c9fa1bbd0bf40dad3f0c0bdd06793"}, - {file = "ruff-0.5.4-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:0cf497a47751be8c883059c4613ba2f50dd06ec672692de2811f039432875278"}, - {file = "ruff-0.5.4-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:09c14ed6a72af9ccc8d2e313d7acf7037f0faff43cde4b507e66f14e812e37f7"}, - {file = "ruff-0.5.4-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:628f6b8f97b8bad2490240aa84f3e68f390e13fabc9af5c0d3b96b485921cd60"}, - {file = "ruff-0.5.4-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:3520a00c0563d7a7a7c324ad7e2cde2355733dafa9592c671fb2e9e3cd8194c1"}, - {file = "ruff-0.5.4-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:93789f14ca2244fb91ed481456f6d0bb8af1f75a330e133b67d08f06ad85b516"}, - {file = "ruff-0.5.4-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:029454e2824eafa25b9df46882f7f7844d36fd8ce51c1b7f6d97e2615a57bbcc"}, - {file = "ruff-0.5.4-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:9492320eed573a13a0bc09a2957f17aa733fff9ce5bf00e66e6d4a88ec33813f"}, - {file = "ruff-0.5.4-py3-none-musllinux_1_2_i686.whl", hash = "sha256:a6e1f62a92c645e2919b65c02e79d1f61e78a58eddaebca6c23659e7c7cb4ac7"}, - {file = "ruff-0.5.4-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:768fa9208df2bec4b2ce61dbc7c2ddd6b1be9fb48f1f8d3b78b3332c7d71c1ff"}, - {file = "ruff-0.5.4-py3-none-win32.whl", hash = "sha256:e1e7393e9c56128e870b233c82ceb42164966f25b30f68acbb24ed69ce9c3a4e"}, - {file = "ruff-0.5.4-py3-none-win_amd64.whl", hash = "sha256:58b54459221fd3f661a7329f177f091eb35cf7a603f01d9eb3eb11cc348d38c4"}, - {file = "ruff-0.5.4-py3-none-win_arm64.whl", hash = "sha256:bd53da65f1085fb5b307c38fd3c0829e76acf7b2a912d8d79cadcdb4875c1eb7"}, - {file = "ruff-0.5.4.tar.gz", hash = "sha256:2795726d5f71c4f4e70653273d1c23a8182f07dd8e48c12de5d867bfb7557eed"}, + {file = "ruff-0.5.5-py3-none-linux_armv6l.whl", hash = "sha256:605d589ec35d1da9213a9d4d7e7a9c761d90bba78fc8790d1c5e65026c1b9eaf"}, + {file = "ruff-0.5.5-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:00817603822a3e42b80f7c3298c8269e09f889ee94640cd1fc7f9329788d7bf8"}, + {file = "ruff-0.5.5-py3-none-macosx_11_0_arm64.whl", hash = "sha256:187a60f555e9f865a2ff2c6984b9afeffa7158ba6e1eab56cb830404c942b0f3"}, + {file = "ruff-0.5.5-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:fe26fc46fa8c6e0ae3f47ddccfbb136253c831c3289bba044befe68f467bfb16"}, + {file = "ruff-0.5.5-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:4ad25dd9c5faac95c8e9efb13e15803cd8bbf7f4600645a60ffe17c73f60779b"}, + {file = "ruff-0.5.5-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:f70737c157d7edf749bcb952d13854e8f745cec695a01bdc6e29c29c288fc36e"}, + {file = "ruff-0.5.5-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:cfd7de17cef6ab559e9f5ab859f0d3296393bc78f69030967ca4d87a541b97a0"}, + {file = "ruff-0.5.5-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:a09b43e02f76ac0145f86a08e045e2ea452066f7ba064fd6b0cdccb486f7c3e7"}, + {file = "ruff-0.5.5-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:d0b856cb19c60cd40198be5d8d4b556228e3dcd545b4f423d1ad812bfdca5884"}, + {file = "ruff-0.5.5-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3687d002f911e8a5faf977e619a034d159a8373514a587249cc00f211c67a091"}, + {file = "ruff-0.5.5-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:ac9dc814e510436e30d0ba535f435a7f3dc97f895f844f5b3f347ec8c228a523"}, + {file = "ruff-0.5.5-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:af9bdf6c389b5add40d89b201425b531e0a5cceb3cfdcc69f04d3d531c6be74f"}, + {file = "ruff-0.5.5-py3-none-musllinux_1_2_i686.whl", hash = "sha256:d40a8533ed545390ef8315b8e25c4bb85739b90bd0f3fe1280a29ae364cc55d8"}, + {file = "ruff-0.5.5-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:cab904683bf9e2ecbbe9ff235bfe056f0eba754d0168ad5407832928d579e7ab"}, + {file = "ruff-0.5.5-py3-none-win32.whl", hash = "sha256:696f18463b47a94575db635ebb4c178188645636f05e934fdf361b74edf1bb2d"}, + {file = "ruff-0.5.5-py3-none-win_amd64.whl", hash = "sha256:50f36d77f52d4c9c2f1361ccbfbd09099a1b2ea5d2b2222c586ab08885cf3445"}, + {file = "ruff-0.5.5-py3-none-win_arm64.whl", hash = "sha256:3191317d967af701f1b73a31ed5788795936e423b7acce82a2b63e26eb3e89d6"}, + {file = "ruff-0.5.5.tar.gz", hash = "sha256:cc5516bdb4858d972fbc31d246bdb390eab8df1a26e2353be2dbc0c2d7f5421a"}, ] [[package]] @@ -5765,4 +5765,4 @@ test = ["big-O", "jaraco.functools", "jaraco.itertools", "jaraco.test", "more-it [metadata] lock-version = "2.0" python-versions = ">=3.10,<3.13" -content-hash = "2780eb96d1d1ceeed4fa6321454ebbb0b7178386436c12c5dad027a850357164" +content-hash = "8433d28cbb9cc32e893b6e014ae2b12cfd9aaec1ee0214afc5ee48f797095b46" diff --git a/pyproject.toml b/pyproject.toml index f53db3320..920f72b1d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -24,7 +24,7 @@ requests = "^2.32.3" pycountry = "24.6.1" opentelemetry-api = "^1.22.0" opentelemetry-sdk = "^1.22.0" -huggingface-hub = "^0.24.0" +huggingface-hub = "^0.24.5" opentelemetry-exporter-otlp-proto-http = "1.23.0" # summary grader rouge-score = "^0.1.2" @@ -34,10 +34,10 @@ argilla = "^1.29.1" [tool.poetry.group.dev.dependencies] # lint & format -mypy = "^1.11.0" +mypy = "^1.11.1" nbqa = "^1.8.5" -ruff = "^0.5.4" -pre-commit = "^3.7.1" +ruff = "^0.5.5" +pre-commit = "^3.8.0" # tests pytest = "^8.3" From 71ddbaba0271aaa860346da1b4490f86a3e72dbf Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 2 Aug 2024 09:58:41 +0200 Subject: [PATCH 02/12] build(deps-dev): bump types-setuptools (#973) Bumps [types-setuptools](https://github.com/python/typeshed) from 70.3.0.20240710 to 71.1.0.20240726. - [Commits](https://github.com/python/typeshed/commits) --- updated-dependencies: - dependency-name: types-setuptools dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- poetry.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/poetry.lock b/poetry.lock index abab7f0ad..c0a0800d9 100644 --- a/poetry.lock +++ b/poetry.lock @@ -5254,13 +5254,13 @@ urllib3 = ">=2" [[package]] name = "types-setuptools" -version = "70.3.0.20240710" +version = "71.1.0.20240726" description = "Typing stubs for setuptools" optional = false python-versions = ">=3.8" files = [ - {file = "types-setuptools-70.3.0.20240710.tar.gz", hash = "sha256:842cbf399812d2b65042c9d6ff35113bbf282dee38794779aa1f94e597bafc35"}, - {file = "types_setuptools-70.3.0.20240710-py3-none-any.whl", hash = "sha256:bd0db2a4b9f2c49ac5564be4e0fb3125c4c46b1f73eafdcbceffa5b005cceca4"}, + {file = "types-setuptools-71.1.0.20240726.tar.gz", hash = "sha256:85ba28e9461bb1be86ebba4db0f1c2408f2b11115b1966334ea9dc464e29303e"}, + {file = "types_setuptools-71.1.0.20240726-py3-none-any.whl", hash = "sha256:a7775376f36e0ff09bcad236bf265777590a66b11623e48c20bfc30f1444ea36"}, ] [[package]] From 0af15a5da046b3554ec9a8848b1ef8b98d6ed483 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 2 Aug 2024 10:18:53 +0200 Subject: [PATCH 03/12] build(deps-dev): bump types-docutils (#972) Bumps [types-docutils](https://github.com/python/typeshed) from 0.21.0.20240711 to 0.21.0.20240724. - [Commits](https://github.com/python/typeshed/commits) --- updated-dependencies: - dependency-name: types-docutils dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- poetry.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/poetry.lock b/poetry.lock index c0a0800d9..da0c145a5 100644 --- a/poetry.lock +++ b/poetry.lock @@ -5192,13 +5192,13 @@ files = [ [[package]] name = "types-docutils" -version = "0.21.0.20240711" +version = "0.21.0.20240724" description = "Typing stubs for docutils" optional = false python-versions = ">=3.8" files = [ - {file = "types-docutils-0.21.0.20240711.tar.gz", hash = "sha256:646f239e7afd88304995f444d3ea39639166c9445580ae5dcaf5515974c050ed"}, - {file = "types_docutils-0.21.0.20240711-py3-none-any.whl", hash = "sha256:149d822bd02d77954f4e04d8e87fcd039db2101dbf564a1cd1b0fabbd543277b"}, + {file = "types-docutils-0.21.0.20240724.tar.gz", hash = "sha256:29ff7e27660f4fe76ea61d7e54d05ca3ce3b733ca9e8e8721e0fa587dbc10489"}, + {file = "types_docutils-0.21.0.20240724-py3-none-any.whl", hash = "sha256:bf51c6c488d23c0412f9b3ba10686fb1a6cb0b957ef04b45128d8a55c79ebb00"}, ] [[package]] From c25f1f6ca564c583aa955b884859f78f89461e8d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 2 Aug 2024 10:33:24 +0200 Subject: [PATCH 04/12] build(deps-dev): bump uvicorn from 0.30.3 to 0.30.4 in the minor group (#970) Bumps the minor group with 1 update: [uvicorn](https://github.com/encode/uvicorn). Updates `uvicorn` from 0.30.3 to 0.30.4 - [Release notes](https://github.com/encode/uvicorn/releases) - [Changelog](https://github.com/encode/uvicorn/blob/master/CHANGELOG.md) - [Commits](https://github.com/encode/uvicorn/compare/0.30.3...0.30.4) --- updated-dependencies: - dependency-name: uvicorn dependency-type: direct:development update-type: version-update:semver-patch dependency-group: minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- poetry.lock | 8 ++++---- pyproject.toml | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/poetry.lock b/poetry.lock index da0c145a5..21aa04631 100644 --- a/poetry.lock +++ b/poetry.lock @@ -5329,13 +5329,13 @@ zstd = ["zstandard (>=0.18.0)"] [[package]] name = "uvicorn" -version = "0.30.3" +version = "0.30.4" description = "The lightning-fast ASGI server." optional = false python-versions = ">=3.8" files = [ - {file = "uvicorn-0.30.3-py3-none-any.whl", hash = "sha256:94a3608da0e530cea8f69683aa4126364ac18e3826b6630d1a65f4638aade503"}, - {file = "uvicorn-0.30.3.tar.gz", hash = "sha256:0d114d0831ff1adbf231d358cbf42f17333413042552a624ea6a9b4c33dcfd81"}, + {file = "uvicorn-0.30.4-py3-none-any.whl", hash = "sha256:06b00e3087e58c6865c284143c0c42f810b32ff4f265ab19d08c566f74a08728"}, + {file = "uvicorn-0.30.4.tar.gz", hash = "sha256:00db9a9e3711a5fa59866e2b02fac69d8dc70ce0814aaec9a66d1d9e5c832a30"}, ] [package.dependencies] @@ -5765,4 +5765,4 @@ test = ["big-O", "jaraco.functools", "jaraco.itertools", "jaraco.test", "more-it [metadata] lock-version = "2.0" python-versions = ">=3.10,<3.13" -content-hash = "8433d28cbb9cc32e893b6e014ae2b12cfd9aaec1ee0214afc5ee48f797095b46" +content-hash = "cadb7990ff0f6a59a86c5fd36ecb953754ad5bfe9443631ed396193a7b00fea6" diff --git a/pyproject.toml b/pyproject.toml index 920f72b1d..9eb4e1e39 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -62,7 +62,7 @@ matplotlib = "^3.9.1" [tool.poetry.group.docs.dependencies] fastapi = "^0.110.3" -uvicorn = "^0.30.3" +uvicorn = "^0.30.4" hypercorn = "^0.17.3" jupyter = "^1.0.0" From 36c11daa93251fdc4c4e9a4ac9ab24da7c3dfc93 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 6 Aug 2024 08:37:42 +0200 Subject: [PATCH 05/12] build(deps-dev): bump the minor group across 1 directory with 4 updates (#976) Bumps the minor group with 4 updates in the / directory: [nbqa](https://github.com/nbQA-dev/nbQA), [ruff](https://github.com/astral-sh/ruff), [fastapi](https://github.com/fastapi/fastapi) and [uvicorn](https://github.com/encode/uvicorn). Updates `nbqa` from 1.8.5 to 1.8.7 - [Release notes](https://github.com/nbQA-dev/nbQA/releases) - [Changelog](https://github.com/nbQA-dev/nbQA/blob/main/docs/history.rst) - [Commits](https://github.com/nbQA-dev/nbQA/compare/1.8.5...1.8.7) Updates `ruff` from 0.5.5 to 0.5.6 - [Release notes](https://github.com/astral-sh/ruff/releases) - [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md) - [Commits](https://github.com/astral-sh/ruff/compare/0.5.5...0.5.6) Updates `fastapi` from 0.110.3 to 0.112.0 - [Release notes](https://github.com/fastapi/fastapi/releases) - [Commits](https://github.com/fastapi/fastapi/compare/0.110.3...0.112.0) Updates `uvicorn` from 0.30.4 to 0.30.5 - [Release notes](https://github.com/encode/uvicorn/releases) - [Changelog](https://github.com/encode/uvicorn/blob/master/CHANGELOG.md) - [Commits](https://github.com/encode/uvicorn/compare/0.30.4...0.30.5) --- updated-dependencies: - dependency-name: nbqa dependency-type: direct:development update-type: version-update:semver-patch dependency-group: minor - dependency-name: ruff dependency-type: direct:development update-type: version-update:semver-patch dependency-group: minor - dependency-name: fastapi dependency-type: direct:development update-type: version-update:semver-minor dependency-group: minor - dependency-name: uvicorn dependency-type: direct:development update-type: version-update:semver-patch dependency-group: minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- poetry.lock | 66 ++++++++++++++++++++++++-------------------------- pyproject.toml | 8 +++--- 2 files changed, 35 insertions(+), 39 deletions(-) diff --git a/poetry.lock b/poetry.lock index 21aa04631..472510574 100644 --- a/poetry.lock +++ b/poetry.lock @@ -983,13 +983,13 @@ tests = ["asttokens (>=2.1.0)", "coverage", "coverage-enable-subprocess", "ipyth [[package]] name = "fastapi" -version = "0.110.3" +version = "0.112.0" description = "FastAPI framework, high performance, easy to learn, fast to code, ready for production" optional = false python-versions = ">=3.8" files = [ - {file = "fastapi-0.110.3-py3-none-any.whl", hash = "sha256:fd7600612f755e4050beb74001310b5a7e1796d149c2ee363124abdfa0289d32"}, - {file = "fastapi-0.110.3.tar.gz", hash = "sha256:555700b0159379e94fdbfc6bb66a0f1c43f4cf7060f25239af3d84b63a656626"}, + {file = "fastapi-0.112.0-py3-none-any.whl", hash = "sha256:3487ded9778006a45834b8c816ec4a48d522e2631ca9e75ec5a774f1b052f821"}, + {file = "fastapi-0.112.0.tar.gz", hash = "sha256:d262bc56b7d101d1f4e8fc0ad2ac75bb9935fec504d2b7117686cec50710cf05"}, ] [package.dependencies] @@ -998,7 +998,8 @@ starlette = ">=0.37.2,<0.38.0" typing-extensions = ">=4.8.0" [package.extras] -all = ["email_validator (>=2.0.0)", "httpx (>=0.23.0)", "itsdangerous (>=1.1.0)", "jinja2 (>=2.11.2)", "orjson (>=3.2.1)", "pydantic-extra-types (>=2.0.0)", "pydantic-settings (>=2.0.0)", "python-multipart (>=0.0.7)", "pyyaml (>=5.3.1)", "ujson (>=4.0.1,!=4.0.2,!=4.1.0,!=4.2.0,!=4.3.0,!=5.0.0,!=5.1.0)", "uvicorn[standard] (>=0.12.0)"] +all = ["email_validator (>=2.0.0)", "fastapi-cli[standard] (>=0.0.5)", "httpx (>=0.23.0)", "itsdangerous (>=1.1.0)", "jinja2 (>=2.11.2)", "orjson (>=3.2.1)", "pydantic-extra-types (>=2.0.0)", "pydantic-settings (>=2.0.0)", "python-multipart (>=0.0.7)", "pyyaml (>=5.3.1)", "ujson (>=4.0.1,!=4.0.2,!=4.1.0,!=4.2.0,!=4.3.0,!=5.0.0,!=5.1.0)", "uvicorn[standard] (>=0.12.0)"] +standard = ["email_validator (>=2.0.0)", "fastapi-cli[standard] (>=0.0.5)", "httpx (>=0.23.0)", "jinja2 (>=2.11.2)", "python-multipart (>=0.0.7)", "uvicorn[standard] (>=0.12.0)"] [[package]] name = "fastjsonschema" @@ -2549,29 +2550,24 @@ files = [ {file = "matplotlib-3.9.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:dd2a59ff4b83d33bca3b5ec58203cc65985367812cb8c257f3e101632be86d92"}, {file = "matplotlib-3.9.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0fc001516ffcf1a221beb51198b194d9230199d6842c540108e4ce109ac05cc0"}, {file = "matplotlib-3.9.1-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:83c6a792f1465d174c86d06f3ae85a8fe36e6f5964633ae8106312ec0921fdf5"}, - {file = "matplotlib-3.9.1-cp310-cp310-win_amd64.whl", hash = "sha256:421851f4f57350bcf0811edd754a708d2275533e84f52f6760b740766c6747a7"}, {file = "matplotlib-3.9.1-cp311-cp311-macosx_10_12_x86_64.whl", hash = "sha256:b3fce58971b465e01b5c538f9d44915640c20ec5ff31346e963c9e1cd66fa812"}, {file = "matplotlib-3.9.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:a973c53ad0668c53e0ed76b27d2eeeae8799836fd0d0caaa4ecc66bf4e6676c0"}, {file = "matplotlib-3.9.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:82cd5acf8f3ef43f7532c2f230249720f5dc5dd40ecafaf1c60ac8200d46d7eb"}, {file = "matplotlib-3.9.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ab38a4f3772523179b2f772103d8030215b318fef6360cb40558f585bf3d017f"}, {file = "matplotlib-3.9.1-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:2315837485ca6188a4b632c5199900e28d33b481eb083663f6a44cfc8987ded3"}, - {file = "matplotlib-3.9.1-cp311-cp311-win_amd64.whl", hash = "sha256:a0c977c5c382f6696caf0bd277ef4f936da7e2aa202ff66cad5f0ac1428ee15b"}, {file = "matplotlib-3.9.1-cp312-cp312-macosx_10_12_x86_64.whl", hash = "sha256:565d572efea2b94f264dd86ef27919515aa6d629252a169b42ce5f570db7f37b"}, {file = "matplotlib-3.9.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:6d397fd8ccc64af2ec0af1f0efc3bacd745ebfb9d507f3f552e8adb689ed730a"}, {file = "matplotlib-3.9.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:26040c8f5121cd1ad712abffcd4b5222a8aec3a0fe40bc8542c94331deb8780d"}, {file = "matplotlib-3.9.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d12cb1837cffaac087ad6b44399d5e22b78c729de3cdae4629e252067b705e2b"}, {file = "matplotlib-3.9.1-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:0e835c6988edc3d2d08794f73c323cc62483e13df0194719ecb0723b564e0b5c"}, - {file = "matplotlib-3.9.1-cp312-cp312-win_amd64.whl", hash = "sha256:44a21d922f78ce40435cb35b43dd7d573cf2a30138d5c4b709d19f00e3907fd7"}, {file = "matplotlib-3.9.1-cp39-cp39-macosx_10_12_x86_64.whl", hash = "sha256:0c584210c755ae921283d21d01f03a49ef46d1afa184134dd0f95b0202ee6f03"}, {file = "matplotlib-3.9.1-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:11fed08f34fa682c2b792942f8902e7aefeed400da71f9e5816bea40a7ce28fe"}, {file = "matplotlib-3.9.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0000354e32efcfd86bda75729716b92f5c2edd5b947200be9881f0a671565c33"}, {file = "matplotlib-3.9.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:4db17fea0ae3aceb8e9ac69c7e3051bae0b3d083bfec932240f9bf5d0197a049"}, {file = "matplotlib-3.9.1-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:208cbce658b72bf6a8e675058fbbf59f67814057ae78165d8a2f87c45b48d0ff"}, - {file = "matplotlib-3.9.1-cp39-cp39-win_amd64.whl", hash = "sha256:dc23f48ab630474264276be156d0d7710ac6c5a09648ccdf49fef9200d8cbe80"}, {file = "matplotlib-3.9.1-pp39-pypy39_pp73-macosx_10_15_x86_64.whl", hash = "sha256:3fda72d4d472e2ccd1be0e9ccb6bf0d2eaf635e7f8f51d737ed7e465ac020cb3"}, {file = "matplotlib-3.9.1-pp39-pypy39_pp73-macosx_11_0_arm64.whl", hash = "sha256:84b3ba8429935a444f1fdc80ed930babbe06725bcf09fbeb5c8757a2cd74af04"}, {file = "matplotlib-3.9.1-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b918770bf3e07845408716e5bbda17eadfc3fcbd9307dc67f37d6cf834bb3d98"}, - {file = "matplotlib-3.9.1-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:f1f2e5d29e9435c97ad4c36fb6668e89aee13d48c75893e25cef064675038ac9"}, {file = "matplotlib-3.9.1.tar.gz", hash = "sha256:de06b19b8db95dd33d0dc17c926c7c9ebed9f572074b6fac4f65068a6814d010"}, ] @@ -2899,13 +2895,13 @@ test = ["pep440", "pre-commit", "pytest", "testpath"] [[package]] name = "nbqa" -version = "1.8.5" +version = "1.8.7" description = "Run any standard Python code quality tool on a Jupyter Notebook" optional = false python-versions = ">=3.8.0" files = [ - {file = "nbqa-1.8.5-py3-none-any.whl", hash = "sha256:fe59ccb66f29bda2912c75cacf9cdbd34504923effb58ae1c88211d075213eff"}, - {file = "nbqa-1.8.5.tar.gz", hash = "sha256:91624e9c747bbe38ff14ebf75d17cfb838b5c0432b039bcb7e8ad0bb423ef7ef"}, + {file = "nbqa-1.8.7-py3-none-any.whl", hash = "sha256:36c6f8fced65031ae3d90f5e0d56708cc4e8ee2b5cdddd9a96a1d3b8afe6d21b"}, + {file = "nbqa-1.8.7.tar.gz", hash = "sha256:8122e2cb83df724dcfa788785b3b5336ae3c28535b62f87fb4961011a72423dc"}, ] [package.dependencies] @@ -4541,29 +4537,29 @@ files = [ [[package]] name = "ruff" -version = "0.5.5" +version = "0.5.6" description = "An extremely fast Python linter and code formatter, written in Rust." optional = false python-versions = ">=3.7" files = [ - {file = "ruff-0.5.5-py3-none-linux_armv6l.whl", hash = "sha256:605d589ec35d1da9213a9d4d7e7a9c761d90bba78fc8790d1c5e65026c1b9eaf"}, - {file = "ruff-0.5.5-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:00817603822a3e42b80f7c3298c8269e09f889ee94640cd1fc7f9329788d7bf8"}, - {file = "ruff-0.5.5-py3-none-macosx_11_0_arm64.whl", hash = "sha256:187a60f555e9f865a2ff2c6984b9afeffa7158ba6e1eab56cb830404c942b0f3"}, - {file = "ruff-0.5.5-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:fe26fc46fa8c6e0ae3f47ddccfbb136253c831c3289bba044befe68f467bfb16"}, - {file = "ruff-0.5.5-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:4ad25dd9c5faac95c8e9efb13e15803cd8bbf7f4600645a60ffe17c73f60779b"}, - {file = "ruff-0.5.5-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:f70737c157d7edf749bcb952d13854e8f745cec695a01bdc6e29c29c288fc36e"}, - {file = "ruff-0.5.5-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:cfd7de17cef6ab559e9f5ab859f0d3296393bc78f69030967ca4d87a541b97a0"}, - {file = "ruff-0.5.5-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:a09b43e02f76ac0145f86a08e045e2ea452066f7ba064fd6b0cdccb486f7c3e7"}, - {file = "ruff-0.5.5-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:d0b856cb19c60cd40198be5d8d4b556228e3dcd545b4f423d1ad812bfdca5884"}, - {file = "ruff-0.5.5-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3687d002f911e8a5faf977e619a034d159a8373514a587249cc00f211c67a091"}, - {file = "ruff-0.5.5-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:ac9dc814e510436e30d0ba535f435a7f3dc97f895f844f5b3f347ec8c228a523"}, - {file = "ruff-0.5.5-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:af9bdf6c389b5add40d89b201425b531e0a5cceb3cfdcc69f04d3d531c6be74f"}, - {file = "ruff-0.5.5-py3-none-musllinux_1_2_i686.whl", hash = "sha256:d40a8533ed545390ef8315b8e25c4bb85739b90bd0f3fe1280a29ae364cc55d8"}, - {file = "ruff-0.5.5-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:cab904683bf9e2ecbbe9ff235bfe056f0eba754d0168ad5407832928d579e7ab"}, - {file = "ruff-0.5.5-py3-none-win32.whl", hash = "sha256:696f18463b47a94575db635ebb4c178188645636f05e934fdf361b74edf1bb2d"}, - {file = "ruff-0.5.5-py3-none-win_amd64.whl", hash = "sha256:50f36d77f52d4c9c2f1361ccbfbd09099a1b2ea5d2b2222c586ab08885cf3445"}, - {file = "ruff-0.5.5-py3-none-win_arm64.whl", hash = "sha256:3191317d967af701f1b73a31ed5788795936e423b7acce82a2b63e26eb3e89d6"}, - {file = "ruff-0.5.5.tar.gz", hash = "sha256:cc5516bdb4858d972fbc31d246bdb390eab8df1a26e2353be2dbc0c2d7f5421a"}, + {file = "ruff-0.5.6-py3-none-linux_armv6l.whl", hash = "sha256:a0ef5930799a05522985b9cec8290b185952f3fcd86c1772c3bdbd732667fdcd"}, + {file = "ruff-0.5.6-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:b652dc14f6ef5d1552821e006f747802cc32d98d5509349e168f6bf0ee9f8f42"}, + {file = "ruff-0.5.6-py3-none-macosx_11_0_arm64.whl", hash = "sha256:80521b88d26a45e871f31e4b88938fd87db7011bb961d8afd2664982dfc3641a"}, + {file = "ruff-0.5.6-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d9bc8f328a9f1309ae80e4d392836e7dbc77303b38ed4a7112699e63d3b066ab"}, + {file = "ruff-0.5.6-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:4d394940f61f7720ad371ddedf14722ee1d6250fd8d020f5ea5a86e7be217daf"}, + {file = "ruff-0.5.6-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:111a99cdb02f69ddb2571e2756e017a1496c2c3a2aeefe7b988ddab38b416d36"}, + {file = "ruff-0.5.6-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:e395daba77a79f6dc0d07311f94cc0560375ca20c06f354c7c99af3bf4560c5d"}, + {file = "ruff-0.5.6-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:c476acb43c3c51e3c614a2e878ee1589655fa02dab19fe2db0423a06d6a5b1b6"}, + {file = "ruff-0.5.6-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:e2ff8003f5252fd68425fd53d27c1f08b201d7ed714bb31a55c9ac1d4c13e2eb"}, + {file = "ruff-0.5.6-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c94e084ba3eaa80c2172918c2ca2eb2230c3f15925f4ed8b6297260c6ef179ad"}, + {file = "ruff-0.5.6-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:1f77c1c3aa0669fb230b06fb24ffa3e879391a3ba3f15e3d633a752da5a3e670"}, + {file = "ruff-0.5.6-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:f908148c93c02873210a52cad75a6eda856b2cbb72250370ce3afef6fb99b1ed"}, + {file = "ruff-0.5.6-py3-none-musllinux_1_2_i686.whl", hash = "sha256:563a7ae61ad284187d3071d9041c08019975693ff655438d8d4be26e492760bd"}, + {file = "ruff-0.5.6-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:94fe60869bfbf0521e04fd62b74cbca21cbc5beb67cbb75ab33fe8c174f54414"}, + {file = "ruff-0.5.6-py3-none-win32.whl", hash = "sha256:e6a584c1de6f8591c2570e171cc7ce482bb983d49c70ddf014393cd39e9dfaed"}, + {file = "ruff-0.5.6-py3-none-win_amd64.whl", hash = "sha256:d7fe7dccb1a89dc66785d7aa0ac283b2269712d8ed19c63af908fdccca5ccc1a"}, + {file = "ruff-0.5.6-py3-none-win_arm64.whl", hash = "sha256:57c6c0dd997b31b536bff49b9eee5ed3194d60605a4427f735eeb1f9c1b8d264"}, + {file = "ruff-0.5.6.tar.gz", hash = "sha256:07c9e3c2a8e1fe377dd460371c3462671a728c981c3205a5217291422209f642"}, ] [[package]] @@ -5329,13 +5325,13 @@ zstd = ["zstandard (>=0.18.0)"] [[package]] name = "uvicorn" -version = "0.30.4" +version = "0.30.5" description = "The lightning-fast ASGI server." optional = false python-versions = ">=3.8" files = [ - {file = "uvicorn-0.30.4-py3-none-any.whl", hash = "sha256:06b00e3087e58c6865c284143c0c42f810b32ff4f265ab19d08c566f74a08728"}, - {file = "uvicorn-0.30.4.tar.gz", hash = "sha256:00db9a9e3711a5fa59866e2b02fac69d8dc70ce0814aaec9a66d1d9e5c832a30"}, + {file = "uvicorn-0.30.5-py3-none-any.whl", hash = "sha256:b2d86de274726e9878188fa07576c9ceeff90a839e2b6e25c917fe05f5a6c835"}, + {file = "uvicorn-0.30.5.tar.gz", hash = "sha256:ac6fdbd4425c5fd17a9fe39daf4d4d075da6fdc80f653e5894cdc2fd98752bee"}, ] [package.dependencies] @@ -5765,4 +5761,4 @@ test = ["big-O", "jaraco.functools", "jaraco.itertools", "jaraco.test", "more-it [metadata] lock-version = "2.0" python-versions = ">=3.10,<3.13" -content-hash = "cadb7990ff0f6a59a86c5fd36ecb953754ad5bfe9443631ed396193a7b00fea6" +content-hash = "22922228ba908d2d1c5776ffce156cb5095bef6dad1a6f5fd93158b4faa0c232" diff --git a/pyproject.toml b/pyproject.toml index 9eb4e1e39..b1a97cd8f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -35,8 +35,8 @@ argilla = "^1.29.1" [tool.poetry.group.dev.dependencies] # lint & format mypy = "^1.11.1" -nbqa = "^1.8.5" -ruff = "^0.5.5" +nbqa = "^1.8.7" +ruff = "^0.5.6" pre-commit = "^3.8.0" # tests @@ -61,8 +61,8 @@ sphinx = "^7.4.7" matplotlib = "^3.9.1" [tool.poetry.group.docs.dependencies] -fastapi = "^0.110.3" -uvicorn = "^0.30.4" +fastapi = "^0.112.0" +uvicorn = "^0.30.5" hypercorn = "^0.17.3" jupyter = "^1.0.0" From c9aaf45e377d1941b9ca7df6ee22624d3d306a81 Mon Sep 17 00:00:00 2001 From: MerlinKallenbornAA <166396684+MerlinKallenbornAA@users.noreply.github.com> Date: Tue, 6 Aug 2024 13:50:19 +0200 Subject: [PATCH 06/12] feat: Studio integration of Trace Submission PHS-616 (#975) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: initial version of studio client * fix: Add STUDIO_URL prefix, fix string in test * feat: Add trace submission from tracer * docs: Add docstrings for StudioClient functions * docs: Add example code snippet to how-to * ci: Remove daily OS support tests * ci: Add studio-backend container to sdk-test.yml * ci: update auth token name * ci: Specify missing env variable * ci: Use host name for db in studio-backend service * fix: Circular imports * docs: Add changelog entry --------- Co-authored-by: Niklas Köhnecke --- .github/workflows/daily.yml | 4 +- .github/workflows/sdk-tests.yml | 44 ++++ CHANGELOG.md | 4 +- README.md | 2 +- docker-compose.yaml | 20 ++ env.sample | 1 + .../how_tos/how_to_log_and_debug_a_task.ipynb | 17 +- .../how_tos/how_to_run_the_trace_viewer.ipynb | 35 ---- ...how_to_use_pharia_studio_with_traces.ipynb | 96 +++++++++ src/intelligence_layer/connectors/__init__.py | 1 + .../document_index/document_index.py | 2 +- .../connectors/studio/studio.py | 193 ++++++++++++++++++ src/intelligence_layer/core/tracer/tracer.py | 5 + tests/connectors/studio/test_studio.py | 153 ++++++++++++++ 14 files changed, 528 insertions(+), 49 deletions(-) delete mode 100644 src/documentation/how_tos/how_to_run_the_trace_viewer.ipynb create mode 100644 src/documentation/how_tos/how_to_use_pharia_studio_with_traces.ipynb create mode 100644 src/intelligence_layer/connectors/studio/studio.py create mode 100644 tests/connectors/studio/test_studio.py diff --git a/.github/workflows/daily.yml b/.github/workflows/daily.yml index b2d6a1729..463fcbe9a 100644 --- a/.github/workflows/daily.yml +++ b/.github/workflows/daily.yml @@ -3,9 +3,7 @@ name: "os-support-tests" on: workflow_dispatch: # Scheduled workflows will only run on the default branch. - schedule: - - cron: '0 0 * * *' # runs once a day at midnight in the timezone of your GitHub repository - + defaults: run: shell: bash diff --git a/.github/workflows/sdk-tests.yml b/.github/workflows/sdk-tests.yml index 107ac8705..012bfa3f4 100644 --- a/.github/workflows/sdk-tests.yml +++ b/.github/workflows/sdk-tests.yml @@ -129,6 +129,27 @@ jobs: password: ${{ secrets.GH_PAT }} ports: - "3000:3000" + postgres: + image: postgres:15 + ports: + - "5433:5432" + env: + POSTGRES_DB: "il_sdk" + POSTGRES_USER: "il_sdk" + POSTGRES_PASSWORD: "test" + studio-backend: + image: registry.gitlab.aleph-alpha.de/product/studio/backend:latest + ports: + - "8000:8000" + env: + DATABASE_URL: "postgres:5432" + POSTGRES_DB: "il_sdk" + POSTGRES_USER: "il_sdk" + POSTGRES_PASSWORD: "test" + AUTHORIZATION_SERVICE_URL: "none" + credentials: + username: "unused" + password: ${{ secrets.GL_STUDIO_CONTAINER_TOKEN }} steps: - name: Checkout repository uses: actions/checkout@v4 @@ -164,6 +185,7 @@ jobs: ARGILLA_API_URL: "http://localhost:6900/" ARGILLA_API_KEY: "argilla.apikey" CLIENT_URL: "https://api.aleph-alpha.com" + STUDIO_URL: "http://localhost:8000/" run: | ./scripts/test.sh run-notebooks: @@ -186,6 +208,27 @@ jobs: env: ARGILLA_ELASTICSEARCH: "http://argilla-elastic-search:9200" ARGILLA_ENABLE_TELEMETRY: 0 + postgres: + image: postgres:15 + ports: + - "5433:5432" + env: + POSTGRES_DB: "il_sdk" + POSTGRES_USER: "il_sdk" + POSTGRES_PASSWORD: "test" + studio-backend: + image: registry.gitlab.aleph-alpha.de/product/studio/backend:latest + ports: + - "8000:8000" + env: + DATABASE_URL: "postgres:5432" + POSTGRES_DB: "il_sdk" + POSTGRES_USER: "il_sdk" + POSTGRES_PASSWORD: "test" + AUTHORIZATION_SERVICE_URL: "none" + credentials: + username: "unused" + password: ${{ secrets.GL_STUDIO_CONTAINER_TOKEN }} steps: - name: Checkout repository uses: actions/checkout@v4 @@ -217,5 +260,6 @@ jobs: ARGILLA_API_URL: "http://localhost:6900/" ARGILLA_API_KEY: "argilla.apikey" CLIENT_URL: "https://api.aleph-alpha.com" + STUDIO_URL: "http://localhost:8000" run: | ./scripts/notebook_runner.sh diff --git a/CHANGELOG.md b/CHANGELOG.md index 77de72112..c6e5d5ebc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,13 +6,13 @@ ... ### Features -... +- Add `StudioClient` as connector to PhariaStudio for submitting traces. ### Fixes ... ### Deprecations -... + - Deprecate old Trace Viewer as the new `StudioClient` replaces it. This affects `Tracer.submit_to_trace_viewer`. ## 5.0.3 diff --git a/README.md b/README.md index b260363a6..a4268d738 100644 --- a/README.md +++ b/README.md @@ -149,7 +149,7 @@ The how-tos are quick lookups about how to do things. Compared to the tutorials, | [...define a task](./src/documentation/how_tos/how_to_define_a_task.ipynb) | How to come up with a new task and formulate it | | [...implement a task](./src/documentation/how_tos/how_to_implement_a_task.ipynb) | Implement a formulated task and make it run with the Intelligence Layer | | [...debug and log a task](./src/documentation/how_tos/how_to_log_and_debug_a_task.ipynb) | Tools for logging and debugging in tasks | -| [...run the trace viewer](./src/documentation/how_tos/how_to_run_the_trace_viewer.ipynb) | Downloading and running the trace viewer for debugging traces | +| [...use PhariaStudio with traces](./src/documentation/how_tos/how_to_use_pharia_studio_with_traces.ipynb) | Submitting Traces to PhariaStudio for debugging | | **Analysis Pipeline** | | | [...implement a simple evaluation and aggregation logic](./src/documentation/how_tos/how_to_implement_a_simple_evaluation_and_aggregation_logic.ipynb) | Basic examples of evaluation and aggregation logic | | [...create a dataset](./src/documentation/how_tos/how_to_create_a_dataset.ipynb) | Create a dataset used for running a task | diff --git a/docker-compose.yaml b/docker-compose.yaml index 263b62008..190f65855 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -38,6 +38,26 @@ services: image: ghcr.io/aleph-alpha/trace-viewer-trace-viewer:main ports: - 3000:3000 + + # export GITLAB_TOKEN=... + # (optional) export GITLAB_TOKEN=$(op item get YOUR_TOKEN --format json --fields password | jq .value | tr -d '"') + # echo $GITLAB_TOKEN | docker login registry.gitlab.aleph-alpha.de -u your_email@for_gitlab --password-stdin + # docker compose pull to update containers + studio-backend: + image: registry.gitlab.aleph-alpha.de/product/studio/backend:latest + ports: + - 8000:8000 + depends_on: + postgres: + condition: service_started + restart: true + environment: + DATABASE_URL: postgres:5432 + POSTGRES_DB: il_sdk + POSTGRES_USER: il_sdk + POSTGRES_PASSWORD: test + + AUTHORIZATION_SERVICE_URL: "none" postgres: image: postgres:15 ports: diff --git a/env.sample b/env.sample index c687dc0f8..a7e94aab4 100644 --- a/env.sample +++ b/env.sample @@ -5,3 +5,4 @@ ARGILLA_API_KEY="argilla.apikey" HUGGING_FACE_TOKEN=token # local dev builds run on 5173 TRACE_VIEWER_URL="http://localhost:3000" +STUDIO_URL=http://localhost:8000 diff --git a/src/documentation/how_tos/how_to_log_and_debug_a_task.ipynb b/src/documentation/how_tos/how_to_log_and_debug_a_task.ipynb index 9b62fccc3..d30aa7c7c 100644 --- a/src/documentation/how_tos/how_to_log_and_debug_a_task.ipynb +++ b/src/documentation/how_tos/how_to_log_and_debug_a_task.ipynb @@ -7,10 +7,12 @@ "outputs": [], "source": [ "import random\n", + "from uuid import uuid4\n", "\n", "from aleph_alpha_client import Prompt\n", "from dotenv import load_dotenv\n", "\n", + "from intelligence_layer.connectors import StudioClient\n", "from intelligence_layer.core import (\n", " CompleteInput,\n", " InMemoryTracer,\n", @@ -37,10 +39,7 @@ " - To create custom logging messages in a trace use `task_span.log()`.\n", " - To map a complex execution flow of a task into a single trace, pass the `task_span` of the `do_run` to other execution methods (e.g. `Task.run()` or `model.complete()`). \n", " - If the execution method is not provided by the intelligence layer, the tracing of input and output has to happen manually. See the implementation of `Task.run()` for an example.\n", - " - Use the [trace viewer](./how_to_run_the_trace_viewer.ipynb) to view and inspect a trace\n", - " - Use and display an `InMemoryTracer` in a notebook to automatically send the trace data to the trace viewer.\n", - " - Note: This also works for traces of the `Runner` and the `Evaluator`.\n", - " - To create persistent traces, use the `FileTracer` instead. This creates files which can manually be uploaded in the trace viewer UI." + " - Use the [submit trace functionality of the `StudioClient`](./how_to_use_pharia_studio_with_traces.ipynb) to view and inspect a trace in PhariaStudio" ] }, { @@ -77,9 +76,13 @@ "\n", "tracer = InMemoryTracer()\n", "DummyTask().run(\"\", tracer)\n", - "# ! make sure to run the trace viewer docker container to get the improved display !\n", - "# display an InMemoryTracer in a notebook and send the data to the trace viewer\n", - "display(tracer)\n", + "\n", + "project_name = str(uuid4())\n", + "studio_client = StudioClient(project=project_name)\n", + "my_project = studio_client.create_project(project=project_name)\n", + "\n", + "submitted_trace_id = studio_client.submit_from_tracer(tracer)\n", + "\n", "\n", "pass" ] diff --git a/src/documentation/how_tos/how_to_run_the_trace_viewer.ipynb b/src/documentation/how_tos/how_to_run_the_trace_viewer.ipynb deleted file mode 100644 index 4daf1fed6..000000000 --- a/src/documentation/how_tos/how_to_run_the_trace_viewer.ipynb +++ /dev/null @@ -1,35 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Running the Trace Viewer\n", - "\n", - "Make sure you have your access to the Jfrog instance at https://alephalpha.jfrog.io. \n", - "Then login to the container registry with docker with your JFrog user name and a JFrog token as the password with the following command:\n", - "\n", - "```bash\n", - "docker login alephalpha.jfrog.io\n", - "```\n", - "\n", - "Note: If you do not already have a JFrog token, you can find it on the website under the \"Set me up\" option, either in the resource of interest or under your profile name.\n", - "\n", - "Afterwards, run the container locally to start the trace viewer:\n", - "\n", - "```bash\n", - "docker run -p 3000:3000 alephalpha.jfrog.io/container-images/trace-viewer:latest\n", - "```\n", - "\n", - "Finally, visit `http://localhost:3000`, where you can upload a trace to interact with the data." - ] - } - ], - "metadata": { - "language_info": { - "name": "python" - } - }, - "nbformat": 4, - "nbformat_minor": 2 -} diff --git a/src/documentation/how_tos/how_to_use_pharia_studio_with_traces.ipynb b/src/documentation/how_tos/how_to_use_pharia_studio_with_traces.ipynb new file mode 100644 index 000000000..5161f0295 --- /dev/null +++ b/src/documentation/how_tos/how_to_use_pharia_studio_with_traces.ipynb @@ -0,0 +1,96 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "from uuid import uuid4\n", + "\n", + "from intelligence_layer.connectors import StudioClient\n", + "from intelligence_layer.core import InMemoryTracer, Task, TaskSpan" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# How to use PhariaStudio for Debugging in a SaaS Configuration\n", + "
\n", + "\n", + "Make sure your account has permissions to use the PhariaStudio application.\n", + "\n", + "For an on-prem or local installation, please contact the PhariaStudio team.\n", + "
" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "\n", + "0. Generate a trace of your `Task` of interest.\n", + "1. Initialize a `StudioClient` with a project.\n", + " - Use an existing project or create a new one with the `StudioClient.create_project` function.\n", + "2. Submit your traces with the client\n", + " 1. Submit a single trace via `Tracer.export_for_viewing` and `StudioClient.submit_trace`\n", + " 2. [Recommended] submit multiple traces via `StudioClient.submit_from_tracer`. \n", + "\n", + "### Example" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# Step 0\n", + "class DummyTask(Task[str, str]):\n", + " def do_run(self, input: str, task_span: TaskSpan) -> str:\n", + " return f\"{input} -> output\"\n", + "\n", + "\n", + "tracer = InMemoryTracer()\n", + "DummyTask().run(\"My Dummy Run\", tracer=tracer)\n", + "\n", + "# Step 1\n", + "project_name = str(uuid4())\n", + "studio_client = StudioClient(project=project_name)\n", + "my_project = studio_client.create_project(project=project_name)\n", + "\n", + "# Step 2.1\n", + "trace_to_submit = tracer.export_for_viewing()\n", + "trace_id = studio_client.submit_trace(trace_to_submit) # only works for single traces\n", + "\n", + "# Step 2.2\n", + "tracer2 = InMemoryTracer()\n", + "DummyTask().run(\"My Dummy Run2\", tracer=tracer2)\n", + "DummyTask().run(\"My Dummy Run3\", tracer=tracer2)\n", + "ids_of_submitted_traces = studio_client.submit_from_tracer(tracer2)" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "intelligence-layer-aL2cXmJM-py3.11", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.11.8" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/src/intelligence_layer/connectors/__init__.py b/src/intelligence_layer/connectors/__init__.py index f5a246df9..026cbb3f5 100644 --- a/src/intelligence_layer/connectors/__init__.py +++ b/src/intelligence_layer/connectors/__init__.py @@ -44,5 +44,6 @@ QdrantInMemoryRetriever as QdrantInMemoryRetriever, ) from .retrievers.qdrant_in_memory_retriever import RetrieverType as RetrieverType +from .studio.studio import StudioClient as StudioClient __all__ = [symbol for symbol in dir() if symbol and symbol[0].isupper()] diff --git a/src/intelligence_layer/connectors/document_index/document_index.py b/src/intelligence_layer/connectors/document_index/document_index.py index 6ce714eff..e09bf69b8 100644 --- a/src/intelligence_layer/connectors/document_index/document_index.py +++ b/src/intelligence_layer/connectors/document_index/document_index.py @@ -295,7 +295,7 @@ class DocumentIndexClient: Document Index is a tool for managing collections of documents, enabling operations such as creation, deletion, listing, and searching. Documents can be stored either in the cloud or in a local deployment. - Args: + Attributes: token: A valid token for the document index API. base_document_index_url: The url of the document index' API. diff --git a/src/intelligence_layer/connectors/studio/studio.py b/src/intelligence_layer/connectors/studio/studio.py new file mode 100644 index 000000000..a6888649a --- /dev/null +++ b/src/intelligence_layer/connectors/studio/studio.py @@ -0,0 +1,193 @@ +import os +from collections import defaultdict +from collections.abc import Sequence +from typing import Optional +from urllib.parse import urljoin + +import requests +from pydantic import BaseModel +from requests.exceptions import ConnectionError, MissingSchema + +from intelligence_layer.core.tracer.tracer import ( # Import to be fixed with PHS-731 + ExportedSpan, + ExportedSpanList, + Tracer, +) + + +class StudioProject(BaseModel): + name: str + description: Optional[str] + + +class StudioClient: + """Client for communicating with PhariaStudio. + + Attributes: + project_id: The unique identifier of the project currently in use. + url: The url of your current PhariaStudio instance. + """ + + def __init__( + self, + project: str, + studio_url: Optional[str] = None, + auth_token: Optional[str] = None, + ) -> None: + """Initializes the client. + + Runs a health check to check for a valid url of the Studio connection. + It does not check for a valid authentication token, which happens later. + + Args: + project: The human readable identifier provided by the user. + studio_url: The url of your current PhariaStudio instance. + auth_token: The authorization bearer token of the user. This corresponds to the user's Aleph Alpha token. + """ + self._token = auth_token if auth_token is not None else os.getenv("AA_TOKEN") + if self._token is None: + raise ValueError( + "'AA_TOKEN' is not set and auth_token is not given as a parameter. Please provide one or the other." + ) + self._headers = { + "Content-Type": "application/json", + "Accept": "application/json", + "Authorization": f"Bearer {self._token}", + } + + temp_url = studio_url if studio_url is not None else os.getenv("STUDIO_URL") + if temp_url is None: + raise ValueError( + "'STUDIO_URL' is not set and url is not given as a parameter. Please provide one or the other." + ) + self.url = temp_url + + self._check_connection() + + self._project_name = project + self._project_id: int | None = None + + def _check_connection(self) -> None: + try: + url = urljoin(self.url, "/health") + response = requests.get( + url, + headers=self._headers, + ) + response.raise_for_status() + except MissingSchema: + raise ValueError( + "The given url of the studio client is invalid. Make sure to include http:// in your url." + ) from None + except ConnectionError: + raise ValueError( + "The given url of the studio client does not point to a server." + ) from None + except requests.HTTPError: + raise ValueError( + f"The given url of the studio client does not point to a healthy studio: {response.status_code}: {response.json()}" + ) from None + + @property + def project_id(self) -> int: + if self._project_id is None: + project_id = self._get_project(self._project_name) + if project_id is None: + raise ValueError( + f"Project {self._project_name} was not available. Consider creating it with `StudioClient.create_project`." + ) + self._project_id = project_id + return self._project_id + + def _get_project(self, project: str) -> int | None: + url = urljoin(self.url, "/api/projects") + response = requests.get( + url, + headers=self._headers, + ) + response.raise_for_status() + all_projects = response.json() + try: + project_of_interest = next( + proj for proj in all_projects if proj["name"] == project + ) + return int(project_of_interest["id"]) + except StopIteration: + return None + + def create_project(self, project: str, description: Optional[str] = None) -> int: + """Creates a project in PhariaStudio. + + Projects are uniquely identified by the user provided name. + + Args: + project: User provided name of the project. + description: Description explaining the usage of the project. Defaults to None. + + Returns: + The ID of the newly created project. + """ + url = urljoin(self.url, "/api/projects") + data = StudioProject(name=project, description=description) + response = requests.post( + url, + data=data.model_dump_json(), + headers=self._headers, + ) + match response.status_code: + case 409: + raise ValueError("Project already exists") + case _: + response.raise_for_status() + return int(response.text) + + def submit_trace(self, data: Sequence[ExportedSpan]) -> str: + """Sends the provided spans to Studio as a singular trace. + + The method fails if the span list is empty, has already been created or if + spans belong to multiple traces. + + Args: + data: Spans to create the trace from. Created by exporting from a `Tracer`. + + Returns: + The ID of the created trace. + """ + if len(data) == 0: + raise ValueError("Tried to upload an empty trace") + return self._upload_trace(ExportedSpanList(data)) + + def submit_from_tracer(self, tracer: Tracer) -> list[str]: + """Sends all trace data from the Tracer to Studio. + + Args: + tracer: Tracer to extract data from. + + Returns: + List of created trace IDs. + """ + traces = defaultdict(list) + for span in tracer.export_for_viewing(): + traces[span.context.trace_id].append(span) + + return [self.submit_trace(value) for value in traces.values()] + + def _upload_trace(self, trace: ExportedSpanList) -> str: + url = urljoin(self.url, f"/api/projects/{self.project_id}/traces") + response = requests.post( + url, + data=trace.model_dump_json(), + headers=self._headers, + ) + match response.status_code: + case 409: + raise ValueError( + f"Trace with id {trace.root[0].context.trace_id} already exists." + ) + case 422: + raise ValueError( + f"Uploading the trace failed with 422. Response: {response.json()}" + ) + case _: + response.raise_for_status() + return str(response.json()) diff --git a/src/intelligence_layer/core/tracer/tracer.py b/src/intelligence_layer/core/tracer/tracer.py index b2e78dec1..1983a7105 100644 --- a/src/intelligence_layer/core/tracer/tracer.py +++ b/src/intelligence_layer/core/tracer/tracer.py @@ -1,5 +1,6 @@ import os import traceback +import warnings from abc import ABC, abstractmethod from collections.abc import Mapping, Sequence from contextlib import AbstractContextManager @@ -208,6 +209,10 @@ def export_for_viewing(self) -> Sequence[ExportedSpan]: ... def submit_to_trace_viewer(self) -> bool: + warnings.warn( + "TraceViewer will be removed soon. Use the Studio Trace functionality instead.", + DeprecationWarning, + ) return submit_to_trace_viewer(self.export_for_viewing()) diff --git a/tests/connectors/studio/test_studio.py b/tests/connectors/studio/test_studio.py new file mode 100644 index 000000000..7bfff9682 --- /dev/null +++ b/tests/connectors/studio/test_studio.py @@ -0,0 +1,153 @@ +import os +import time +from collections.abc import Sequence +from typing import Any +from unittest.mock import patch +from uuid import uuid4 + +import pytest +from dotenv import load_dotenv +from pytest import fixture + +from intelligence_layer.connectors import StudioClient +from intelligence_layer.core import ExportedSpan, InMemoryTracer, Task, TaskSpan + + +class TracerTestSubTask(Task[None, None]): + def do_run(self, input: None, task_span: TaskSpan) -> None: + task_span.log("subtask", "value") + + +class TracerTestTask(Task[str, str]): + sub_task = TracerTestSubTask() + + def do_run(self, input: str, task_span: TaskSpan) -> str: + time.sleep(0.001) + with task_span.span("span") as sub_span: + time.sleep(0.001) + sub_span.log("message", "a value") + time.sleep(0.001) + self.sub_task.run(None, sub_span) + time.sleep(0.001) + self.sub_task.run(None, task_span) + try: + with task_span.task_span("Error task", "myInput"): + raise ValueError("oops") + except Exception as _: + pass + time.sleep(0.001) + return "output" + + +@fixture +def test_trace() -> Sequence[ExportedSpan]: + tracer = InMemoryTracer() + task = TracerTestTask() + task.run("my input", tracer) + return tracer.export_for_viewing() + + +@fixture +def studio_client() -> StudioClient: + load_dotenv() + project_name = str(uuid4()) + client = StudioClient(project_name) + client.create_project(project_name) + return client + + +def test_cannot_connect_to_non_existing_project() -> None: + project_name = "non-existing-project" + with pytest.raises(ValueError, match=project_name): + StudioClient(project="non-existing-project").project_id # noqa: B018 + + +def test_cannot_create_the_same_project_twice() -> None: + project_name = str(uuid4()) + client = StudioClient(project="IL-default-project") + client.create_project(project_name) + with pytest.raises(ValueError, match="already exists"): + client.create_project(project_name) + + +def test_can_upload_trace( + test_trace: Sequence[ExportedSpan], studio_client: StudioClient +) -> None: + id = studio_client.submit_trace(test_trace) + + assert id == str(test_trace[0].context.trace_id) + + +def test_cannot_upload_empty_trace(studio_client: StudioClient) -> None: + with pytest.raises(ValueError, match="empty"): + studio_client.submit_trace([]) + + +def test_cannot_upload_same_trace_twice( + test_trace: Sequence[ExportedSpan], studio_client: StudioClient +) -> None: + studio_client.submit_trace(test_trace) + with pytest.raises(ValueError): + studio_client.submit_trace(test_trace) + + +def test_submit_trace_cannot_upload_lists_with_multiple_traces( + studio_client: StudioClient, +) -> None: + tracer = InMemoryTracer() + with tracer.span("test"): + pass + with tracer.span("test2"): + pass + data = tracer.export_for_viewing() + + with pytest.raises(ValueError): + studio_client.submit_trace(data) + # TODO + + +def test_handles_invalid_url() -> None: + with pytest.raises(ValueError, match="invalid"): + StudioClient(str(uuid4), studio_url="unknown-url") + + +def test_handles_valid_but_incorrect_url() -> None: + with pytest.raises(ValueError, match="does not point to a server"): + StudioClient(str(uuid4), studio_url="http://invalid-test-url-123456543") + + +def test_handles_no_auth_configured() -> None: + def mock_return(var: Any) -> Any: + if var == "AA_TOKEN": + return None + else: + return os.environ[var] + + with patch("os.getenv", side_effect=mock_return) as _: # noqa: SIM117 + with pytest.raises(ValueError, match="auth_token"): + StudioClient(str(uuid4)) + + +def test_submit_from_tracer_can_upload_lists_with_multiple_traces( + studio_client: StudioClient, +) -> None: + tracer = InMemoryTracer() + task = TracerTestTask() + task.run("my input", tracer) + task.run("my second input", tracer) + + id_list = set(str(span.context.trace_id) for span in tracer.export_for_viewing()) + + trace_id_list = set(studio_client.submit_from_tracer(tracer)) + + assert trace_id_list == id_list + + +def test_submit_from_tracer_works_with_empty_tracer( + studio_client: StudioClient, +) -> None: + tracer = InMemoryTracer() + + empty_trace_id_list = studio_client.submit_from_tracer(tracer) + + assert len(empty_trace_id_list) == 0 From 19f26def76f6f860c08048fbdc060fb06b4a7541 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 7 Aug 2024 08:15:07 +0200 Subject: [PATCH 07/12] build(deps-dev): bump types-setuptools (#977) Bumps [types-setuptools](https://github.com/python/typeshed) from 71.1.0.20240726 to 71.1.0.20240806. - [Commits](https://github.com/python/typeshed/commits) --- updated-dependencies: - dependency-name: types-setuptools dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- poetry.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/poetry.lock b/poetry.lock index 472510574..e013778a9 100644 --- a/poetry.lock +++ b/poetry.lock @@ -5250,13 +5250,13 @@ urllib3 = ">=2" [[package]] name = "types-setuptools" -version = "71.1.0.20240726" +version = "71.1.0.20240806" description = "Typing stubs for setuptools" optional = false python-versions = ">=3.8" files = [ - {file = "types-setuptools-71.1.0.20240726.tar.gz", hash = "sha256:85ba28e9461bb1be86ebba4db0f1c2408f2b11115b1966334ea9dc464e29303e"}, - {file = "types_setuptools-71.1.0.20240726-py3-none-any.whl", hash = "sha256:a7775376f36e0ff09bcad236bf265777590a66b11623e48c20bfc30f1444ea36"}, + {file = "types-setuptools-71.1.0.20240806.tar.gz", hash = "sha256:ae5e7b4d643ab9e99fc00ac00041804118cabe72a56183c30d524fb064897ad6"}, + {file = "types_setuptools-71.1.0.20240806-py3-none-any.whl", hash = "sha256:3bd8dd02039be0bb79ad880d8893b8eefcb022fabbeeb61245c61b20c9ab1ed0"}, ] [[package]] From 2c3bfcae2191bb13730a6e5a117b5c18d2604f79 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 8 Aug 2024 08:33:14 +0200 Subject: [PATCH 08/12] build(deps-dev): bump pandas-stubs from 2.2.2.240603 to 2.2.2.240807 (#979) Bumps [pandas-stubs](https://github.com/pandas-dev/pandas-stubs) from 2.2.2.240603 to 2.2.2.240807. - [Changelog](https://github.com/pandas-dev/pandas-stubs/blob/main/docs/release_procedure.md) - [Commits](https://github.com/pandas-dev/pandas-stubs/compare/v2.2.2.240603...v2.2.2.240807) --- updated-dependencies: - dependency-name: pandas-stubs dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- poetry.lock | 13 +++++-------- pyproject.toml | 2 +- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/poetry.lock b/poetry.lock index e013778a9..3d026e199 100644 --- a/poetry.lock +++ b/poetry.lock @@ -3238,20 +3238,17 @@ xml = ["lxml (>=4.9.2)"] [[package]] name = "pandas-stubs" -version = "2.2.2.240603" +version = "2.2.2.240807" description = "Type annotations for pandas" optional = false python-versions = ">=3.9" files = [ - {file = "pandas_stubs-2.2.2.240603-py3-none-any.whl", hash = "sha256:e08ce7f602a4da2bff5a67475ba881c39f2a4d4f7fccc1cba57c6f35a379c6c0"}, - {file = "pandas_stubs-2.2.2.240603.tar.gz", hash = "sha256:2dcc86e8fa6ea41535a4561c1f08b3942ba5267b464eff2e99caeee66f9e4cd1"}, + {file = "pandas_stubs-2.2.2.240807-py3-none-any.whl", hash = "sha256:893919ad82be4275f0d07bb47a95d08bae580d3fdea308a7acfcb3f02e76186e"}, + {file = "pandas_stubs-2.2.2.240807.tar.gz", hash = "sha256:64a559725a57a449f46225fbafc422520b7410bff9252b661a225b5559192a93"}, ] [package.dependencies] -numpy = [ - {version = ">=1.23.5", markers = "python_version >= \"3.9\" and python_version < \"3.12\""}, - {version = ">=1.26.0", markers = "python_version >= \"3.12\" and python_version < \"3.13\""}, -] +numpy = ">=1.23.5" types-pytz = ">=2022.1.1" [[package]] @@ -5761,4 +5758,4 @@ test = ["big-O", "jaraco.functools", "jaraco.itertools", "jaraco.test", "more-it [metadata] lock-version = "2.0" python-versions = ">=3.10,<3.13" -content-hash = "22922228ba908d2d1c5776ffce156cb5095bef6dad1a6f5fd93158b4faa0c232" +content-hash = "4fef5107199f3eecb6c52d421b75252514a039571f82a7124c59fb12ed6bc12f" diff --git a/pyproject.toml b/pyproject.toml index b1a97cd8f..c7d832680 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -53,7 +53,7 @@ types-setuptools = "*" types-decorator = "*" types-requests = "*" types-tqdm = "*" -pandas-stubs = "^2.2.2.240603" +pandas-stubs = "^2.2.2.240807" # docs sphinx-rtd-theme = "^2.0.0" From ebe466328dec9b4b93b1734a0128480c866183fd Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 8 Aug 2024 08:42:45 +0200 Subject: [PATCH 09/12] build(deps-dev): bump matplotlib from 3.9.1 to 3.9.1.post1 (#978) Bumps [matplotlib](https://github.com/matplotlib/matplotlib) from 3.9.1 to 3.9.1.post1. - [Release notes](https://github.com/matplotlib/matplotlib/releases) - [Commits](https://github.com/matplotlib/matplotlib/compare/v3.9.1...v3.9.1.post1) --- updated-dependencies: - dependency-name: matplotlib dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- poetry.lock | 55 +++++++++++++++++++++++++++++------------------------ 1 file changed, 30 insertions(+), 25 deletions(-) diff --git a/poetry.lock b/poetry.lock index 3d026e199..692b40bf6 100644 --- a/poetry.lock +++ b/poetry.lock @@ -2540,35 +2540,40 @@ files = [ [[package]] name = "matplotlib" -version = "3.9.1" +version = "3.9.1.post1" description = "Python plotting package" optional = false python-versions = ">=3.9" files = [ - {file = "matplotlib-3.9.1-cp310-cp310-macosx_10_12_x86_64.whl", hash = "sha256:7ccd6270066feb9a9d8e0705aa027f1ff39f354c72a87efe8fa07632f30fc6bb"}, - {file = "matplotlib-3.9.1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:591d3a88903a30a6d23b040c1e44d1afdd0d778758d07110eb7596f811f31842"}, - {file = "matplotlib-3.9.1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:dd2a59ff4b83d33bca3b5ec58203cc65985367812cb8c257f3e101632be86d92"}, - {file = "matplotlib-3.9.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:0fc001516ffcf1a221beb51198b194d9230199d6842c540108e4ce109ac05cc0"}, - {file = "matplotlib-3.9.1-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:83c6a792f1465d174c86d06f3ae85a8fe36e6f5964633ae8106312ec0921fdf5"}, - {file = "matplotlib-3.9.1-cp311-cp311-macosx_10_12_x86_64.whl", hash = "sha256:b3fce58971b465e01b5c538f9d44915640c20ec5ff31346e963c9e1cd66fa812"}, - {file = "matplotlib-3.9.1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:a973c53ad0668c53e0ed76b27d2eeeae8799836fd0d0caaa4ecc66bf4e6676c0"}, - {file = "matplotlib-3.9.1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:82cd5acf8f3ef43f7532c2f230249720f5dc5dd40ecafaf1c60ac8200d46d7eb"}, - {file = "matplotlib-3.9.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ab38a4f3772523179b2f772103d8030215b318fef6360cb40558f585bf3d017f"}, - {file = "matplotlib-3.9.1-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:2315837485ca6188a4b632c5199900e28d33b481eb083663f6a44cfc8987ded3"}, - {file = "matplotlib-3.9.1-cp312-cp312-macosx_10_12_x86_64.whl", hash = "sha256:565d572efea2b94f264dd86ef27919515aa6d629252a169b42ce5f570db7f37b"}, - {file = "matplotlib-3.9.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:6d397fd8ccc64af2ec0af1f0efc3bacd745ebfb9d507f3f552e8adb689ed730a"}, - {file = "matplotlib-3.9.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:26040c8f5121cd1ad712abffcd4b5222a8aec3a0fe40bc8542c94331deb8780d"}, - {file = "matplotlib-3.9.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d12cb1837cffaac087ad6b44399d5e22b78c729de3cdae4629e252067b705e2b"}, - {file = "matplotlib-3.9.1-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:0e835c6988edc3d2d08794f73c323cc62483e13df0194719ecb0723b564e0b5c"}, - {file = "matplotlib-3.9.1-cp39-cp39-macosx_10_12_x86_64.whl", hash = "sha256:0c584210c755ae921283d21d01f03a49ef46d1afa184134dd0f95b0202ee6f03"}, - {file = "matplotlib-3.9.1-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:11fed08f34fa682c2b792942f8902e7aefeed400da71f9e5816bea40a7ce28fe"}, - {file = "matplotlib-3.9.1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0000354e32efcfd86bda75729716b92f5c2edd5b947200be9881f0a671565c33"}, - {file = "matplotlib-3.9.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:4db17fea0ae3aceb8e9ac69c7e3051bae0b3d083bfec932240f9bf5d0197a049"}, - {file = "matplotlib-3.9.1-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:208cbce658b72bf6a8e675058fbbf59f67814057ae78165d8a2f87c45b48d0ff"}, - {file = "matplotlib-3.9.1-pp39-pypy39_pp73-macosx_10_15_x86_64.whl", hash = "sha256:3fda72d4d472e2ccd1be0e9ccb6bf0d2eaf635e7f8f51d737ed7e465ac020cb3"}, - {file = "matplotlib-3.9.1-pp39-pypy39_pp73-macosx_11_0_arm64.whl", hash = "sha256:84b3ba8429935a444f1fdc80ed930babbe06725bcf09fbeb5c8757a2cd74af04"}, - {file = "matplotlib-3.9.1-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b918770bf3e07845408716e5bbda17eadfc3fcbd9307dc67f37d6cf834bb3d98"}, - {file = "matplotlib-3.9.1.tar.gz", hash = "sha256:de06b19b8db95dd33d0dc17c926c7c9ebed9f572074b6fac4f65068a6814d010"}, + {file = "matplotlib-3.9.1.post1-cp310-cp310-macosx_10_12_x86_64.whl", hash = "sha256:3779ad3e8b72df22b8a622c5796bbcfabfa0069b835412e3c1dec8ee3de92d0c"}, + {file = "matplotlib-3.9.1.post1-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:ec400340f8628e8e2260d679078d4e9b478699f386e5cc8094e80a1cb0039c7c"}, + {file = "matplotlib-3.9.1.post1-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:82c18791b8862ea095081f745b81f896b011c5a5091678fb33204fef641476af"}, + {file = "matplotlib-3.9.1.post1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:621a628389c09a6b9f609a238af8e66acecece1cfa12febc5fe4195114ba7446"}, + {file = "matplotlib-3.9.1.post1-cp310-cp310-musllinux_1_2_x86_64.whl", hash = "sha256:9a54734ca761ebb27cd4f0b6c2ede696ab6861052d7d7e7b8f7a6782665115f5"}, + {file = "matplotlib-3.9.1.post1-cp310-cp310-win_amd64.whl", hash = "sha256:0721f93db92311bb514e446842e2b21c004541dcca0281afa495053e017c5458"}, + {file = "matplotlib-3.9.1.post1-cp311-cp311-macosx_10_12_x86_64.whl", hash = "sha256:b08b46058fe2a31ecb81ef6aa3611f41d871f6a8280e9057cb4016cb3d8e894a"}, + {file = "matplotlib-3.9.1.post1-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:22b344e84fcc574f561b5731f89a7625db8ef80cdbb0026a8ea855a33e3429d1"}, + {file = "matplotlib-3.9.1.post1-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:4b49fee26d64aefa9f061b575f0f7b5fc4663e51f87375c7239efa3d30d908fa"}, + {file = "matplotlib-3.9.1.post1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:89eb7e89e2b57856533c5c98f018aa3254fa3789fcd86d5f80077b9034a54c9a"}, + {file = "matplotlib-3.9.1.post1-cp311-cp311-musllinux_1_2_x86_64.whl", hash = "sha256:c06e742bade41fda6176d4c9c78c9ea016e176cd338e62a1686384cb1eb8de41"}, + {file = "matplotlib-3.9.1.post1-cp311-cp311-win_amd64.whl", hash = "sha256:c44edab5b849e0fc1f1c9d6e13eaa35ef65925f7be45be891d9784709ad95561"}, + {file = "matplotlib-3.9.1.post1-cp312-cp312-macosx_10_12_x86_64.whl", hash = "sha256:bf28b09986aee06393e808e661c3466be9c21eff443c9bc881bce04bfbb0c500"}, + {file = "matplotlib-3.9.1.post1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:92aeb8c439d4831510d8b9d5e39f31c16c7f37873879767c26b147cef61e54cd"}, + {file = "matplotlib-3.9.1.post1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:f15798b0691b45c80d3320358a88ce5a9d6f518b28575b3ea3ed31b4bd95d009"}, + {file = "matplotlib-3.9.1.post1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d59fc6096da7b9c1df275f9afc3fef5cbf634c21df9e5f844cba3dd8deb1847d"}, + {file = "matplotlib-3.9.1.post1-cp312-cp312-musllinux_1_2_x86_64.whl", hash = "sha256:ab986817a32a70ce22302438691e7df4c6ee4a844d47289db9d583d873491e0b"}, + {file = "matplotlib-3.9.1.post1-cp312-cp312-win_amd64.whl", hash = "sha256:0d78e7d2d86c4472da105d39aba9b754ed3dfeaeaa4ac7206b82706e0a5362fa"}, + {file = "matplotlib-3.9.1.post1-cp39-cp39-macosx_10_12_x86_64.whl", hash = "sha256:bd07eba6431b4dc9253cce6374a28c415e1d3a7dc9f8aba028ea7592f06fe172"}, + {file = "matplotlib-3.9.1.post1-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:ca230cc4482010d646827bd2c6d140c98c361e769ae7d954ebf6fff2a226f5b1"}, + {file = "matplotlib-3.9.1.post1-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ace27c0fdeded399cbc43f22ffa76e0f0752358f5b33106ec7197534df08725a"}, + {file = "matplotlib-3.9.1.post1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:9a4f3aeb7ba14c497dc6f021a076c48c2e5fbdf3da1e7264a5d649683e284a2f"}, + {file = "matplotlib-3.9.1.post1-cp39-cp39-musllinux_1_2_x86_64.whl", hash = "sha256:23f96fbd4ff4cfa9b8a6b685a65e7eb3c2ced724a8d965995ec5c9c2b1f7daf5"}, + {file = "matplotlib-3.9.1.post1-cp39-cp39-win_amd64.whl", hash = "sha256:2808b95452b4ffa14bfb7c7edffc5350743c31bda495f0d63d10fdd9bc69e895"}, + {file = "matplotlib-3.9.1.post1-pp39-pypy39_pp73-macosx_10_15_x86_64.whl", hash = "sha256:ffc91239f73b4179dec256b01299d46d0ffa9d27d98494bc1476a651b7821cbe"}, + {file = "matplotlib-3.9.1.post1-pp39-pypy39_pp73-macosx_11_0_arm64.whl", hash = "sha256:f965ebca9fd4feaaca45937c4849d92b70653057497181100fcd1e18161e5f29"}, + {file = "matplotlib-3.9.1.post1-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:801ee9323fd7b2da0d405aebbf98d1da77ea430bbbbbec6834c0b3af15e5db44"}, + {file = "matplotlib-3.9.1.post1-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:50113e9b43ceb285739f35d43db36aa752fb8154325b35d134ff6e177452f9ec"}, + {file = "matplotlib-3.9.1.post1.tar.gz", hash = "sha256:c91e585c65092c975a44dc9d4239ba8c594ba3c193d7c478b6d178c4ef61f406"}, ] [package.dependencies] From 50a150e3035748619cd398fe32fd0a5a9fccac8d Mon Sep 17 00:00:00 2001 From: Michael Barlow <25936840+Michael-JB@users.noreply.github.com> Date: Fri, 9 Aug 2024 12:08:11 +0200 Subject: [PATCH 10/12] [DI-133] feat(document-index): integrate chunk overlap config (#981) - you can now specify a chunk overlap when configuring an index - add validation to ensure 0 <= overlap < chunk_size - add validation to ensure chunk_size is specified and valid --- CHANGELOG.md | 1 + .../connectors/document_index/document_index.py | 15 +++++++++++++-- .../document_index/test_document_index.py | 14 ++++++++++++++ 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c6e5d5ebc..4f266d7e6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ ### Features - Add `StudioClient` as connector to PhariaStudio for submitting traces. +- You can now specify a `chunk_overlap` when creating an index in the Document Index. ### Fixes ... diff --git a/src/intelligence_layer/connectors/document_index/document_index.py b/src/intelligence_layer/connectors/document_index/document_index.py index e09bf69b8..21a462490 100644 --- a/src/intelligence_layer/connectors/document_index/document_index.py +++ b/src/intelligence_layer/connectors/document_index/document_index.py @@ -6,8 +6,9 @@ from urllib.parse import quote import requests -from pydantic import BaseModel, Field +from pydantic import BaseModel, Field, model_validator from requests import HTTPError +from typing_extensions import Self from intelligence_layer.connectors.base.json_serializable import JsonSerializable @@ -29,11 +30,20 @@ class IndexConfiguration(BaseModel): Args: embedding_type: "symmetric" or "asymmetric" embedding type. + chunk_overlap: The maximum number of tokens of overlap between consecutive chunks. Must be + less than `chunk_size`. chunk_size: The maximum size of the chunks in tokens to be used for the index. """ embedding_type: Literal["symmetric", "asymmetric"] - chunk_size: int + chunk_overlap: int = Field(default=0, ge=0) + chunk_size: int = Field(..., gt=0, le=2046) + + @model_validator(mode="after") + def validate_chunk_overlap(self) -> Self: + if not self.chunk_overlap < self.chunk_size: + raise ValueError("chunk_overlap must be less than chunk_size") + return self class DocumentContents(BaseModel): @@ -427,6 +437,7 @@ def index_configuration(self, index_path: IndexPath) -> IndexConfiguration: response_json: Mapping[str, Any] = response.json() return IndexConfiguration( embedding_type=response_json["embedding_type"], + chunk_overlap=response_json["chunk_overlap"], chunk_size=response_json["chunk_size"], ) diff --git a/tests/connectors/document_index/test_document_index.py b/tests/connectors/document_index/test_document_index.py index 650c1fd1c..6cc69a555 100644 --- a/tests/connectors/document_index/test_document_index.py +++ b/tests/connectors/document_index/test_document_index.py @@ -1,6 +1,7 @@ from http import HTTPStatus import pytest +from pydantic import ValidationError from pytest import fixture, raises from intelligence_layer.connectors.document_index.document_index import ( @@ -9,6 +10,7 @@ DocumentFilterQueryParams, DocumentIndexClient, DocumentPath, + IndexConfiguration, IndexPath, ResourceNotFound, SearchQuery, @@ -233,6 +235,17 @@ def test_document_path_is_immutable() -> None: assert dictionary[path] == 1 +def test_index_configuration_rejects_invalid_chunk_overlap() -> None: + try: + IndexConfiguration( + chunk_size=128, chunk_overlap=128, embedding_type="asymmetric" + ) + except ValidationError as e: + assert "chunk_overlap must be less than chunk_size" in str(e) + else: + raise AssertionError("ValidationError was not raised") + + def test_document_indexes_are_returned( document_index: DocumentIndexClient, collection_path: CollectionPath ) -> None: @@ -243,4 +256,5 @@ def test_document_indexes_are_returned( ) assert index_configuration.embedding_type == "asymmetric" + assert index_configuration.chunk_overlap == 0 assert index_configuration.chunk_size == 512 From e09f5a2eedb524f59bd555935c4bb3af42b8169f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 9 Aug 2024 13:30:33 +0200 Subject: [PATCH 11/12] build(deps-dev): bump ruff from 0.5.6 to 0.5.7 in the minor group (#980) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bumps the minor group with 1 update: [ruff](https://github.com/astral-sh/ruff). Updates `ruff` from 0.5.6 to 0.5.7 - [Release notes](https://github.com/astral-sh/ruff/releases) - [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md) - [Commits](https://github.com/astral-sh/ruff/compare/0.5.6...0.5.7) --- updated-dependencies: - dependency-name: ruff dependency-type: direct:development update-type: version-update:semver-patch dependency-group: minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Niklas Köhnecke <155443293+NiklasKoehneckeAA@users.noreply.github.com> --- poetry.lock | 40 ++++++++++++++++++++-------------------- pyproject.toml | 2 +- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/poetry.lock b/poetry.lock index 692b40bf6..e16d0edb5 100644 --- a/poetry.lock +++ b/poetry.lock @@ -4539,29 +4539,29 @@ files = [ [[package]] name = "ruff" -version = "0.5.6" +version = "0.5.7" description = "An extremely fast Python linter and code formatter, written in Rust." optional = false python-versions = ">=3.7" files = [ - {file = "ruff-0.5.6-py3-none-linux_armv6l.whl", hash = "sha256:a0ef5930799a05522985b9cec8290b185952f3fcd86c1772c3bdbd732667fdcd"}, - {file = "ruff-0.5.6-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:b652dc14f6ef5d1552821e006f747802cc32d98d5509349e168f6bf0ee9f8f42"}, - {file = "ruff-0.5.6-py3-none-macosx_11_0_arm64.whl", hash = "sha256:80521b88d26a45e871f31e4b88938fd87db7011bb961d8afd2664982dfc3641a"}, - {file = "ruff-0.5.6-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d9bc8f328a9f1309ae80e4d392836e7dbc77303b38ed4a7112699e63d3b066ab"}, - {file = "ruff-0.5.6-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:4d394940f61f7720ad371ddedf14722ee1d6250fd8d020f5ea5a86e7be217daf"}, - {file = "ruff-0.5.6-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:111a99cdb02f69ddb2571e2756e017a1496c2c3a2aeefe7b988ddab38b416d36"}, - {file = "ruff-0.5.6-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:e395daba77a79f6dc0d07311f94cc0560375ca20c06f354c7c99af3bf4560c5d"}, - {file = "ruff-0.5.6-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:c476acb43c3c51e3c614a2e878ee1589655fa02dab19fe2db0423a06d6a5b1b6"}, - {file = "ruff-0.5.6-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:e2ff8003f5252fd68425fd53d27c1f08b201d7ed714bb31a55c9ac1d4c13e2eb"}, - {file = "ruff-0.5.6-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c94e084ba3eaa80c2172918c2ca2eb2230c3f15925f4ed8b6297260c6ef179ad"}, - {file = "ruff-0.5.6-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:1f77c1c3aa0669fb230b06fb24ffa3e879391a3ba3f15e3d633a752da5a3e670"}, - {file = "ruff-0.5.6-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:f908148c93c02873210a52cad75a6eda856b2cbb72250370ce3afef6fb99b1ed"}, - {file = "ruff-0.5.6-py3-none-musllinux_1_2_i686.whl", hash = "sha256:563a7ae61ad284187d3071d9041c08019975693ff655438d8d4be26e492760bd"}, - {file = "ruff-0.5.6-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:94fe60869bfbf0521e04fd62b74cbca21cbc5beb67cbb75ab33fe8c174f54414"}, - {file = "ruff-0.5.6-py3-none-win32.whl", hash = "sha256:e6a584c1de6f8591c2570e171cc7ce482bb983d49c70ddf014393cd39e9dfaed"}, - {file = "ruff-0.5.6-py3-none-win_amd64.whl", hash = "sha256:d7fe7dccb1a89dc66785d7aa0ac283b2269712d8ed19c63af908fdccca5ccc1a"}, - {file = "ruff-0.5.6-py3-none-win_arm64.whl", hash = "sha256:57c6c0dd997b31b536bff49b9eee5ed3194d60605a4427f735eeb1f9c1b8d264"}, - {file = "ruff-0.5.6.tar.gz", hash = "sha256:07c9e3c2a8e1fe377dd460371c3462671a728c981c3205a5217291422209f642"}, + {file = "ruff-0.5.7-py3-none-linux_armv6l.whl", hash = "sha256:548992d342fc404ee2e15a242cdbea4f8e39a52f2e7752d0e4cbe88d2d2f416a"}, + {file = "ruff-0.5.7-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:00cc8872331055ee017c4f1071a8a31ca0809ccc0657da1d154a1d2abac5c0be"}, + {file = "ruff-0.5.7-py3-none-macosx_11_0_arm64.whl", hash = "sha256:eaf3d86a1fdac1aec8a3417a63587d93f906c678bb9ed0b796da7b59c1114a1e"}, + {file = "ruff-0.5.7-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a01c34400097b06cf8a6e61b35d6d456d5bd1ae6961542de18ec81eaf33b4cb8"}, + {file = "ruff-0.5.7-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:fcc8054f1a717e2213500edaddcf1dbb0abad40d98e1bd9d0ad364f75c763eea"}, + {file = "ruff-0.5.7-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:7f70284e73f36558ef51602254451e50dd6cc479f8b6f8413a95fcb5db4a55fc"}, + {file = "ruff-0.5.7-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:a78ad870ae3c460394fc95437d43deb5c04b5c29297815a2a1de028903f19692"}, + {file = "ruff-0.5.7-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:9ccd078c66a8e419475174bfe60a69adb36ce04f8d4e91b006f1329d5cd44bcf"}, + {file = "ruff-0.5.7-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:7e31c9bad4ebf8fdb77b59cae75814440731060a09a0e0077d559a556453acbb"}, + {file = "ruff-0.5.7-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8d796327eed8e168164346b769dd9a27a70e0298d667b4ecee6877ce8095ec8e"}, + {file = "ruff-0.5.7-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:4a09ea2c3f7778cc635e7f6edf57d566a8ee8f485f3c4454db7771efb692c499"}, + {file = "ruff-0.5.7-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:a36d8dcf55b3a3bc353270d544fb170d75d2dff41eba5df57b4e0b67a95bb64e"}, + {file = "ruff-0.5.7-py3-none-musllinux_1_2_i686.whl", hash = "sha256:9369c218f789eefbd1b8d82a8cf25017b523ac47d96b2f531eba73770971c9e5"}, + {file = "ruff-0.5.7-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:b88ca3db7eb377eb24fb7c82840546fb7acef75af4a74bd36e9ceb37a890257e"}, + {file = "ruff-0.5.7-py3-none-win32.whl", hash = "sha256:33d61fc0e902198a3e55719f4be6b375b28f860b09c281e4bdbf783c0566576a"}, + {file = "ruff-0.5.7-py3-none-win_amd64.whl", hash = "sha256:083bbcbe6fadb93cd86709037acc510f86eed5a314203079df174c40bbbca6b3"}, + {file = "ruff-0.5.7-py3-none-win_arm64.whl", hash = "sha256:2dca26154ff9571995107221d0aeaad0e75a77b5a682d6236cf89a58c70b76f4"}, + {file = "ruff-0.5.7.tar.gz", hash = "sha256:8dfc0a458797f5d9fb622dd0efc52d796f23f0a1493a9527f4e49a550ae9a7e5"}, ] [[package]] @@ -5763,4 +5763,4 @@ test = ["big-O", "jaraco.functools", "jaraco.itertools", "jaraco.test", "more-it [metadata] lock-version = "2.0" python-versions = ">=3.10,<3.13" -content-hash = "4fef5107199f3eecb6c52d421b75252514a039571f82a7124c59fb12ed6bc12f" +content-hash = "b03803138a939684f18e25b8a29e387569579fbdc90e2b65f81c1e720131c6d6" diff --git a/pyproject.toml b/pyproject.toml index c7d832680..552b1231a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -36,7 +36,7 @@ argilla = "^1.29.1" # lint & format mypy = "^1.11.1" nbqa = "^1.8.7" -ruff = "^0.5.6" +ruff = "^0.5.7" pre-commit = "^3.8.0" # tests From 78130830473872f4aa6292663b169a9b017b54cf Mon Sep 17 00:00:00 2001 From: Michael Barlow <25936840+Michael-JB@users.noreply.github.com> Date: Fri, 9 Aug 2024 17:16:43 +0200 Subject: [PATCH 12/12] [DI-133] docs(document-index): add indexes to notebook (#983) - update Document Index jupyter notebook to include creation and assignment of index - make default collection and index names less generic --- src/documentation/document_index.ipynb | 51 +++++++++++++++++++++----- 1 file changed, 42 insertions(+), 9 deletions(-) diff --git a/src/documentation/document_index.ipynb b/src/documentation/document_index.ipynb index cbe22b86a..3c4b40de8 100644 --- a/src/documentation/document_index.ipynb +++ b/src/documentation/document_index.ipynb @@ -19,6 +19,8 @@ " DocumentIndexClient,\n", " DocumentIndexRetriever,\n", " DocumentPath,\n", + " IndexConfiguration,\n", + " IndexPath,\n", " LimitedConcurrencyClient,\n", ")\n", "from intelligence_layer.core import InMemoryTracer\n", @@ -58,7 +60,7 @@ "## Upload documents to the Document Index\n", "\n", "To search through the DI, you'll first need to upload the documents to it.\n", - "For now, we'll use the DI instance stored in the Aleph Alpha cloud.\n", + "For now, we'll use the [DI instance hosted by Aleph Alpha](https://app.document-index.aleph-alpha.com).\n", "We assume you have an assigned namespace and possess a token to access it." ] }, @@ -88,12 +90,13 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Now, to start working with the DI, you need to execute four simple steps:\n", + "Now, to start working with the DI, you need to execute five simple steps:\n", "\n", - "1. Create a collection.\n", - "2. Define a few documents we will put in our collection.\n", - "3. Upload the documents to the collection.\n", - "4. Verify whether the documents are successfully uploaded." + "1. Create a new collection.\n", + "2. Assign an index to the collection. This makes it searchable.\n", + "3. Define a few documents we will put in our collection.\n", + "4. Upload the documents to the collection.\n", + "5. Verify that the documents are successfully uploaded." ] }, { @@ -103,13 +106,43 @@ "outputs": [], "source": [ "# change this value if you want to use a collection of a different name\n", - "COLLECTION = \"demo\"\n", + "COLLECTION = \"intelligence-layer-sdk-demo-collection\"\n", "\n", "collection_path = CollectionPath(namespace=NAMESPACE, collection=COLLECTION)\n", "\n", "document_index.create_collection(collection_path)" ] }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "Now, let's create an index and assign it to this collection. You can do this before or after populating the collection with documents; the Document Index automatically updates semantic indexes in the background." + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [ + "# change this value if you want to use an index of a different name\n", + "INDEX = \"intelligence-layer-sdk-demo-index\"\n", + "\n", + "index_path = IndexPath(namespace=NAMESPACE, index=INDEX)\n", + "\n", + "# customise the parameters of the index here\n", + "index_configuration = IndexConfiguration(\n", + " chunk_size=64, chunk_overlap=0, embedding_type=\"asymmetric\"\n", + ")\n", + "\n", + "# create the namespace-wide index resource\n", + "document_index.create_index(index_path, index_configuration)\n", + "\n", + "# assign the index to the collection\n", + "document_index.assign_index_to_collection(collection_path, INDEX)" + ] + }, { "cell_type": "markdown", "metadata": {}, @@ -246,7 +279,7 @@ "source": [ "document_index_retriever = DocumentIndexRetriever(\n", " document_index=document_index,\n", - " index_name=\"asymmetric\",\n", + " index_name=INDEX,\n", " namespace=NAMESPACE,\n", " collection=COLLECTION,\n", " k=5,\n", @@ -323,7 +356,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.11.0" + "version": "3.12.4" } }, "nbformat": 4,