From 84540cb3d49f53916c0d3e8a52f1a3f20f51c8ef Mon Sep 17 00:00:00 2001 From: Philip Date: Tue, 16 Apr 2024 19:59:19 +0800 Subject: [PATCH 1/2] fix: downgrade pytype --- sdks/python/julep/api/client.py | 14 +-- sdks/python/julep/api/types/chat_settings.py | 14 +-- sdks/python/poetry.lock | 97 ++++---------------- sdks/python/pyproject.toml | 2 +- 4 files changed, 32 insertions(+), 95 deletions(-) diff --git a/sdks/python/julep/api/client.py b/sdks/python/julep/api/client.py index 013b3e3e4..1298f4770 100644 --- a/sdks/python/julep/api/client.py +++ b/sdks/python/julep/api/client.py @@ -80,9 +80,9 @@ def __init__( self._client_wrapper = SyncClientWrapper( base_url=_get_base_url(base_url=base_url, environment=environment), api_key=api_key, - httpx_client=httpx.Client(timeout=timeout) - if httpx_client is None - else httpx_client, + httpx_client=( + httpx.Client(timeout=timeout) if httpx_client is None else httpx_client + ), ) def list_sessions( @@ -1838,9 +1838,11 @@ def __init__( self._client_wrapper = AsyncClientWrapper( base_url=_get_base_url(base_url=base_url, environment=environment), api_key=api_key, - httpx_client=httpx.AsyncClient(timeout=timeout) - if httpx_client is None - else httpx_client, + httpx_client=( + httpx.AsyncClient(timeout=timeout) + if httpx_client is None + else httpx_client + ), ) async def list_sessions( diff --git a/sdks/python/julep/api/types/chat_settings.py b/sdks/python/julep/api/types/chat_settings.py index 086c5a74d..ebaa5b991 100644 --- a/sdks/python/julep/api/types/chat_settings.py +++ b/sdks/python/julep/api/types/chat_settings.py @@ -21,13 +21,13 @@ class ChatSettings(pydantic.BaseModel): length_penalty: typing.Optional[float] = pydantic.Field( description="(Huggingface-like) Number between 0 and 2.0. 1.0 is neutral and values larger than that penalize number of tokens generated." ) - logit_bias: typing.Optional[ - typing.Dict[str, typing.Optional[int]] - ] = pydantic.Field( - description=( - "Modify the likelihood of specified tokens appearing in the completion.\n" - "\n" - "Accepts a JSON object that maps tokens (specified by their token ID in the tokenizer) to an associated bias value from -100 to 100. Mathematically, the bias is added to the logits generated by the model prior to sampling. The exact effect will vary per model, but values between -1 and 1 should decrease or increase likelihood of selection; values like -100 or 100 should result in a ban or exclusive selection of the relevant token.\n" + logit_bias: typing.Optional[typing.Dict[str, typing.Optional[int]]] = ( + pydantic.Field( + description=( + "Modify the likelihood of specified tokens appearing in the completion.\n" + "\n" + "Accepts a JSON object that maps tokens (specified by their token ID in the tokenizer) to an associated bias value from -100 to 100. Mathematically, the bias is added to the logits generated by the model prior to sampling. The exact effect will vary per model, but values between -1 and 1 should decrease or increase likelihood of selection; values like -100 or 100 should result in a ban or exclusive selection of the relevant token.\n" + ) ) ) max_tokens: typing.Optional[int] = pydantic.Field( diff --git a/sdks/python/poetry.lock b/sdks/python/poetry.lock index 58faffd70..7dfae3f8a 100644 --- a/sdks/python/poetry.lock +++ b/sdks/python/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry 1.8.2 and should not be changed by hand. +# This file is automatically @generated by Poetry 1.7.1 and should not be changed by hand. [[package]] name = "annotated-types" @@ -790,17 +790,6 @@ files = [ {file = "idna-3.7.tar.gz", hash = "sha256:028ff3aadf0609c1fd278d8ea3089299412a7a8b9bd005dd08b9f8285bcb5cfc"}, ] -[[package]] -name = "immutabledict" -version = "4.2.0" -description = "Immutable wrapper around dictionaries (a fork of frozendict)" -optional = false -python-versions = ">=3.8,<4.0" -files = [ - {file = "immutabledict-4.2.0-py3-none-any.whl", hash = "sha256:d728b2c2410d698d95e6200237feb50a695584d20289ad3379a439aa3d90baba"}, - {file = "immutabledict-4.2.0.tar.gz", hash = "sha256:e003fd81aad2377a5a758bf7e1086cf3b70b63e9a5cc2f46bce8d0a2b4727c5f"}, -] - [[package]] name = "importlab" version = "0.8.1" @@ -1448,58 +1437,6 @@ files = [ {file = "mistune-3.0.2.tar.gz", hash = "sha256:fc7f93ded930c92394ef2cb6f04a8aabab4117a91449e72dcc8dfa646a508be8"}, ] -[[package]] -name = "msgspec" -version = "0.18.6" -description = "A fast serialization and validation library, with builtin support for JSON, MessagePack, YAML, and TOML." -optional = false -python-versions = ">=3.8" -files = [ - {file = "msgspec-0.18.6-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:77f30b0234eceeff0f651119b9821ce80949b4d667ad38f3bfed0d0ebf9d6d8f"}, - {file = "msgspec-0.18.6-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:1a76b60e501b3932782a9da039bd1cd552b7d8dec54ce38332b87136c64852dd"}, - {file = "msgspec-0.18.6-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:06acbd6edf175bee0e36295d6b0302c6de3aaf61246b46f9549ca0041a9d7177"}, - {file = "msgspec-0.18.6-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:40a4df891676d9c28a67c2cc39947c33de516335680d1316a89e8f7218660410"}, - {file = "msgspec-0.18.6-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:a6896f4cd5b4b7d688018805520769a8446df911eb93b421c6c68155cdf9dd5a"}, - {file = "msgspec-0.18.6-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:3ac4dd63fd5309dd42a8c8c36c1563531069152be7819518be0a9d03be9788e4"}, - {file = "msgspec-0.18.6-cp310-cp310-win_amd64.whl", hash = "sha256:fda4c357145cf0b760000c4ad597e19b53adf01382b711f281720a10a0fe72b7"}, - {file = "msgspec-0.18.6-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:e77e56ffe2701e83a96e35770c6adb655ffc074d530018d1b584a8e635b4f36f"}, - {file = "msgspec-0.18.6-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:d5351afb216b743df4b6b147691523697ff3a2fc5f3d54f771e91219f5c23aaa"}, - {file = "msgspec-0.18.6-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:c3232fabacef86fe8323cecbe99abbc5c02f7698e3f5f2e248e3480b66a3596b"}, - {file = "msgspec-0.18.6-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e3b524df6ea9998bbc99ea6ee4d0276a101bcc1aa8d14887bb823914d9f60d07"}, - {file = "msgspec-0.18.6-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:37f67c1d81272131895bb20d388dd8d341390acd0e192a55ab02d4d6468b434c"}, - {file = "msgspec-0.18.6-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:d0feb7a03d971c1c0353de1a8fe30bb6579c2dc5ccf29b5f7c7ab01172010492"}, - {file = "msgspec-0.18.6-cp311-cp311-win_amd64.whl", hash = "sha256:41cf758d3f40428c235c0f27bc6f322d43063bc32da7b9643e3f805c21ed57b4"}, - {file = "msgspec-0.18.6-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:d86f5071fe33e19500920333c11e2267a31942d18fed4d9de5bc2fbab267d28c"}, - {file = "msgspec-0.18.6-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:ce13981bfa06f5eb126a3a5a38b1976bddb49a36e4f46d8e6edecf33ccf11df1"}, - {file = "msgspec-0.18.6-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e97dec6932ad5e3ee1e3c14718638ba333befc45e0661caa57033cd4cc489466"}, - {file = "msgspec-0.18.6-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ad237100393f637b297926cae1868b0d500f764ccd2f0623a380e2bcfb2809ca"}, - {file = "msgspec-0.18.6-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:db1d8626748fa5d29bbd15da58b2d73af25b10aa98abf85aab8028119188ed57"}, - {file = "msgspec-0.18.6-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:d70cb3d00d9f4de14d0b31d38dfe60c88ae16f3182988246a9861259c6722af6"}, - {file = "msgspec-0.18.6-cp312-cp312-win_amd64.whl", hash = "sha256:1003c20bfe9c6114cc16ea5db9c5466e49fae3d7f5e2e59cb70693190ad34da0"}, - {file = "msgspec-0.18.6-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:f7d9faed6dfff654a9ca7d9b0068456517f63dbc3aa704a527f493b9200b210a"}, - {file = "msgspec-0.18.6-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:9da21f804c1a1471f26d32b5d9bc0480450ea77fbb8d9db431463ab64aaac2cf"}, - {file = "msgspec-0.18.6-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:46eb2f6b22b0e61c137e65795b97dc515860bf6ec761d8fb65fdb62aa094ba61"}, - {file = "msgspec-0.18.6-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c8355b55c80ac3e04885d72db515817d9fbb0def3bab936bba104e99ad22cf46"}, - {file = "msgspec-0.18.6-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:9080eb12b8f59e177bd1eb5c21e24dd2ba2fa88a1dbc9a98e05ad7779b54c681"}, - {file = "msgspec-0.18.6-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:cc001cf39becf8d2dcd3f413a4797c55009b3a3cdbf78a8bf5a7ca8fdb76032c"}, - {file = "msgspec-0.18.6-cp38-cp38-win_amd64.whl", hash = "sha256:fac5834e14ac4da1fca373753e0c4ec9c8069d1fe5f534fa5208453b6065d5be"}, - {file = "msgspec-0.18.6-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:974d3520fcc6b824a6dedbdf2b411df31a73e6e7414301abac62e6b8d03791b4"}, - {file = "msgspec-0.18.6-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:fd62e5818731a66aaa8e9b0a1e5543dc979a46278da01e85c3c9a1a4f047ef7e"}, - {file = "msgspec-0.18.6-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:7481355a1adcf1f08dedd9311193c674ffb8bf7b79314b4314752b89a2cf7f1c"}, - {file = "msgspec-0.18.6-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6aa85198f8f154cf35d6f979998f6dadd3dc46a8a8c714632f53f5d65b315c07"}, - {file = "msgspec-0.18.6-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:0e24539b25c85c8f0597274f11061c102ad6b0c56af053373ba4629772b407be"}, - {file = "msgspec-0.18.6-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:c61ee4d3be03ea9cd089f7c8e36158786cd06e51fbb62529276452bbf2d52ece"}, - {file = "msgspec-0.18.6-cp39-cp39-win_amd64.whl", hash = "sha256:b5c390b0b0b7da879520d4ae26044d74aeee5144f83087eb7842ba59c02bc090"}, - {file = "msgspec-0.18.6.tar.gz", hash = "sha256:a59fc3b4fcdb972d09138cb516dbde600c99d07c38fd9372a6ef500d2d031b4e"}, -] - -[package.extras] -dev = ["attrs", "coverage", "furo", "gcovr", "ipython", "msgpack", "mypy", "pre-commit", "pyright", "pytest", "pyyaml", "sphinx", "sphinx-copybutton", "sphinx-design", "tomli", "tomli-w"] -doc = ["furo", "ipython", "sphinx", "sphinx-copybutton", "sphinx-design"] -test = ["attrs", "msgpack", "mypy", "pyright", "pytest", "pyyaml", "tomli", "tomli-w"] -toml = ["tomli", "tomli-w"] -yaml = ["pyyaml"] - [[package]] name = "mypy-extensions" version = "1.0.0" @@ -2198,33 +2135,30 @@ files = [ [[package]] name = "pytype" -version = "2024.4.11" +version = "2024.1.5" description = "Python type inferencer" optional = false python-versions = ">=3.8" files = [ - {file = "pytype-2024.4.11-cp310-cp310-macosx_11_0_x86_64.whl", hash = "sha256:b3647b554eea009c9069d58440aed6b9e66d2f3ba20ef2674ffd5cd3b0bf83d7"}, - {file = "pytype-2024.4.11-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:fd24126c5b7bbda52fb48ad9d5b4811a7b090a944c8f39a45b94246668722e8c"}, - {file = "pytype-2024.4.11-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ae6c825b7067f420810f8846147df4fdc966c340a859f51317ba26c860cda906"}, - {file = "pytype-2024.4.11-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:b140b180cb287bbbce025e4c929cf3b020aecf4f91899ef609073ab02f2ba8e2"}, - {file = "pytype-2024.4.11-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a3483a44f457766be85c2a2ef779f3c23f2a95973e5fdb844a030149fc1d92e3"}, - {file = "pytype-2024.4.11-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2986961d1a2ef778a9fea2f81c90cbe6f4a196ff783b26a30e7f3c9be1545c10"}, - {file = "pytype-2024.4.11-cp38-cp38-macosx_11_0_x86_64.whl", hash = "sha256:ad59ed48b185d61f5ab8bceb173e6680eeabf109c5f15290ad88b7be1096e493"}, - {file = "pytype-2024.4.11-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:50da73a6a24337d00c9c88697ced74909dd00e3b9238ad619490ff83a6588d52"}, - {file = "pytype-2024.4.11-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:51c5470061ace9908a8306e3aa460e89e8fc15e63557625c387f932b852d3fa8"}, - {file = "pytype-2024.4.11-cp39-cp39-macosx_11_0_x86_64.whl", hash = "sha256:4484bbe24c58c289cea0c7549a507f20eea29caa68dcaf1e857eba584324641e"}, - {file = "pytype-2024.4.11-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8ad2f7cbfc9843a3f6f1d776318a2f4d96b0ca2d054128280be58eef293c0795"}, - {file = "pytype-2024.4.11-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:aa1069fcaaa9859273ec31650632e7bba9af0e82083e8f7d08f9b742d6d36055"}, - {file = "pytype-2024.4.11.tar.gz", hash = "sha256:3315f51ce482d8c07e2f1857c47ccd17beb4a9bfde9afa7d1e6669f1e8881081"}, + {file = "pytype-2024.1.5-cp310-cp310-macosx_11_0_x86_64.whl", hash = "sha256:af4b7ced6049e7fececb646262a25874e8a4e6a0b7e540c100b673aacd230ffa"}, + {file = "pytype-2024.1.5-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:20680085e5a7beee2aaedddbf96863efa96ff047061ae82e31404336180502f5"}, + {file = "pytype-2024.1.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b1c5857acd6348e9f5ace6427d74824f433d6bbfad0e0104b98f5078f5781af6"}, + {file = "pytype-2024.1.5-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:33227cd847df1c5e92dbe013dc3926b78c77b36032a1caa3e488286aa9a0a14e"}, + {file = "pytype-2024.1.5-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:0e59fb2866cdd804b31ef9baa0f53bc6fddaeaf68a7b1af6aa62c1b9854f017e"}, + {file = "pytype-2024.1.5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:bf28233b140e9a7702cffcc8346c8d47b492813bee5f11ba2cef906ff4c05c55"}, + {file = "pytype-2024.1.5-cp38-cp38-macosx_11_0_x86_64.whl", hash = "sha256:5281cc89ba5acc5a9184845f5c02319c0fbfcd87a9ab4920b6bce0d0caec6860"}, + {file = "pytype-2024.1.5-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:b1b802867ede7cfd7dbe479cfdd3a1341dac005bfcb2718ff22070494fdd57be"}, + {file = "pytype-2024.1.5-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a964a105af46fff3495be76ee34ad34acf47300018244122ea75d0e777d04cb5"}, + {file = "pytype-2024.1.5-cp39-cp39-macosx_11_0_x86_64.whl", hash = "sha256:144e83bb7b80e5b0972a25bed2e4f03c0cd91d677ad0902bb775fdac156151ca"}, + {file = "pytype-2024.1.5-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:c22db76f45a218c673f70c4ab32e7de757b808ce5d9ae55d1b3621f05187c496"}, + {file = "pytype-2024.1.5-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:734d34b3ce13ccea64c419f88630fd189d6d06cbb24516cfb6fe36edc1860da2"}, ] [package.dependencies] attrs = ">=21.4.0" -immutabledict = ">=4.1.0" importlab = ">=0.8" jinja2 = ">=3.1.2" libcst = ">=1.0.1" -msgspec = ">=0.18.6" networkx = "<3.2" ninja = ">=1.10.0.post2" pycnite = ">=2023.10.11" @@ -2307,6 +2241,7 @@ files = [ {file = "PyYAML-6.0.1-cp311-cp311-win_amd64.whl", hash = "sha256:bf07ee2fef7014951eeb99f56f39c9bb4af143d8aa3c21b1677805985307da34"}, {file = "PyYAML-6.0.1-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:855fb52b0dc35af121542a76b9a84f8d1cd886ea97c84703eaa6d88e37a2ad28"}, {file = "PyYAML-6.0.1-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:40df9b996c2b73138957fe23a16a4f0ba614f4c0efce1e9406a184b6d07fa3a9"}, + {file = "PyYAML-6.0.1-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a08c6f0fe150303c1c6b71ebcd7213c2858041a7e01975da3a99aed1e7a378ef"}, {file = "PyYAML-6.0.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6c22bec3fbe2524cde73d7ada88f6566758a8f7227bfbf93a408a9d86bcc12a0"}, {file = "PyYAML-6.0.1-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:8d4e9c88387b0f5c7d5f281e55304de64cf7f9c0021a3525bd3b1c542da3b0e4"}, {file = "PyYAML-6.0.1-cp312-cp312-win32.whl", hash = "sha256:d483d2cdf104e7c9fa60c544d92981f12ad66a457afae824d146093b8c294c54"}, @@ -3090,4 +3025,4 @@ testing = ["big-O", "jaraco.functools", "jaraco.itertools", "more-itertools", "p [metadata] lock-version = "2.0" python-versions = ">=3.8,<3.14" -content-hash = "74f56ee5deab1209d463c25f4660baa9c82472c13fe4505793ae2ec55ac66a4f" +content-hash = "67d5487b31e56254e06687ef707fc544441e69e1f65cde6077630ec71c307df3" diff --git a/sdks/python/pyproject.toml b/sdks/python/pyproject.toml index 920791fa7..c75b5a85f 100644 --- a/sdks/python/pyproject.toml +++ b/sdks/python/pyproject.toml @@ -17,7 +17,7 @@ typing-extensions = ">=4.0.0,<5.0.0" [tool.poetry.group.dev.dependencies] -pytype = ">=2024.4.11" +pytype = "2024.1.5" black = "^24.4.0" ward = "^0.68.0b0" ruff = "^0.1.13" From 53f8022d6d6b43e8a6f8935967c5087245d63e03 Mon Sep 17 00:00:00 2001 From: philipbalbas Date: Tue, 16 Apr 2024 12:03:11 +0000 Subject: [PATCH 2/2] refactor: Lint agents-api (CI) --- agents-api/agents_api/__init__.py | 1 + agents-api/agents_api/activities/types.py | 6 ++---- agents-api/agents_api/clients/worker/types.py | 6 ++---- agents-api/agents_api/common/exceptions/sessions.py | 1 + agents-api/agents_api/common/protocol/agents.py | 2 +- agents-api/agents_api/common/protocol/sessions.py | 1 + agents-api/agents_api/common/utils/json.py | 1 + agents-api/agents_api/env.py | 1 + agents-api/agents_api/model_registry.py | 1 + agents-api/agents_api/models/agent/create_agent.py | 2 +- agents-api/agents_api/models/docs/list_docs.py | 1 + agents-api/agents_api/models/entry/test_entry_queries.py | 1 + agents-api/agents_api/models/session/create_session.py | 1 + .../agents_api/models/session/test_session_queries.py | 1 + agents-api/agents_api/models/user/create_user.py | 1 + agents-api/agents_api/models/user/test_user_queries.py | 1 + agents-api/agents_api/web.py | 1 + agents-api/agents_api/worker/__main__.py | 1 + 18 files changed, 20 insertions(+), 10 deletions(-) diff --git a/agents-api/agents_api/__init__.py b/agents-api/agents_api/__init__.py index 2e60bac27..744ed4960 100644 --- a/agents-api/agents_api/__init__.py +++ b/agents-api/agents_api/__init__.py @@ -1,6 +1,7 @@ """ The `agents_api` module serves as the foundation of the agent management system within the `agents-api` project. This module is responsible for defining the structure and capabilities of the API that manages agents. It includes operations such as creating, updating, listing, and deleting agents, as well as managing documents and tools associated with these agents. This file, in particular, acts as a configuration and initialization point for the `agents_api` package, and as per the directive, should not contain any imports. """ + ################################# ## Do NOT put any imports here ## ################################# diff --git a/agents-api/agents_api/activities/types.py b/agents-api/agents_api/activities/types.py index 4fa1d4d46..37fd8015d 100644 --- a/agents-api/agents_api/activities/types.py +++ b/agents-api/agents_api/activities/types.py @@ -25,12 +25,10 @@ class ChatML(BaseModel): token_count: Optional[int] = None -class BaseTask(BaseModel): - ... +class BaseTask(BaseModel): ... -class BaseTaskArgs(BaseModel): - ... +class BaseTaskArgs(BaseModel): ... class AddPrinciplesTaskArgs(BaseTaskArgs): diff --git a/agents-api/agents_api/clients/worker/types.py b/agents-api/agents_api/clients/worker/types.py index 16fa8404b..86bf564dd 100644 --- a/agents-api/agents_api/clients/worker/types.py +++ b/agents-api/agents_api/clients/worker/types.py @@ -25,12 +25,10 @@ class ChatML(BaseModel): token_count: Optional[int] = None -class BaseTask(BaseModel): - ... +class BaseTask(BaseModel): ... -class BaseTaskArgs(BaseModel): - ... +class BaseTaskArgs(BaseModel): ... class MemoryManagementTaskArgs(BaseTaskArgs): diff --git a/agents-api/agents_api/common/exceptions/sessions.py b/agents-api/agents_api/common/exceptions/sessions.py index cb363c887..b4101989b 100644 --- a/agents-api/agents_api/common/exceptions/sessions.py +++ b/agents-api/agents_api/common/exceptions/sessions.py @@ -3,6 +3,7 @@ These exceptions are used throughout the agents API to handle errors related to session operations, such as when a requested session cannot be found. """ + from uuid import UUID from . import BaseCommonException diff --git a/agents-api/agents_api/common/protocol/agents.py b/agents-api/agents_api/common/protocol/agents.py index 43dae1c25..222f91f01 100644 --- a/agents-api/agents_api/common/protocol/agents.py +++ b/agents-api/agents_api/common/protocol/agents.py @@ -17,4 +17,4 @@ class AgentDefaultSettings(BaseModel): """Penalty that decreases the likelihood of frequently used words in the agent's responses.""" frequency_penalty: float = 0.0 """Minimum probability threshold for including a word in the agent's response.""" - min_p: float = 0.01 \ No newline at end of file + min_p: float = 0.01 diff --git a/agents-api/agents_api/common/protocol/sessions.py b/agents-api/agents_api/common/protocol/sessions.py index ee5dbfc81..ec4ed7d78 100644 --- a/agents-api/agents_api/common/protocol/sessions.py +++ b/agents-api/agents_api/common/protocol/sessions.py @@ -2,6 +2,7 @@ This module defines session-related data structures and settings used across the agents API. It includes definitions for session settings and session data models. """ + from uuid import UUID from pydantic import BaseModel, validator diff --git a/agents-api/agents_api/common/utils/json.py b/agents-api/agents_api/common/utils/json.py index 5b39238df..b5d4857ae 100644 --- a/agents-api/agents_api/common/utils/json.py +++ b/agents-api/agents_api/common/utils/json.py @@ -1,4 +1,5 @@ """This module provides JSON utilities, including a custom JSON encoder for handling specific object types and a utility function for JSON serialization.""" + import json from uuid import UUID from typing import Any diff --git a/agents-api/agents_api/env.py b/agents-api/agents_api/env.py index ff2cec6e8..e888ce46a 100644 --- a/agents-api/agents_api/env.py +++ b/agents-api/agents_api/env.py @@ -2,6 +2,7 @@ This module is responsible for loading and providing access to environment variables used throughout the agents-api application. It utilizes the environs library for environment variable parsing. """ + from pprint import pprint from environs import Env diff --git a/agents-api/agents_api/model_registry.py b/agents-api/agents_api/model_registry.py index 9e39489b7..62d4a7f6b 100644 --- a/agents-api/agents_api/model_registry.py +++ b/agents-api/agents_api/model_registry.py @@ -1,6 +1,7 @@ """ Model Registry maintains a list of supported models and their configs. """ + from typing import Dict from agents_api.clients.model import julep_client, openai_client from openai import AsyncOpenAI diff --git a/agents-api/agents_api/models/agent/create_agent.py b/agents-api/agents_api/models/agent/create_agent.py index f6bab27f7..df2e15458 100644 --- a/agents-api/agents_api/models/agent/create_agent.py +++ b/agents-api/agents_api/models/agent/create_agent.py @@ -102,4 +102,4 @@ def create_agent_query( "metadata": metadata, "instructions": instructions, }, - ) \ No newline at end of file + ) diff --git a/agents-api/agents_api/models/docs/list_docs.py b/agents-api/agents_api/models/docs/list_docs.py index 720c274e7..c10489d7c 100644 --- a/agents-api/agents_api/models/docs/list_docs.py +++ b/agents-api/agents_api/models/docs/list_docs.py @@ -1,4 +1,5 @@ """This module contains functions for querying document-related data from the 'cozodb' database using datalog queries.""" + from typing import Literal from uuid import UUID diff --git a/agents-api/agents_api/models/entry/test_entry_queries.py b/agents-api/agents_api/models/entry/test_entry_queries.py index 737743a09..8a084ed44 100644 --- a/agents-api/agents_api/models/entry/test_entry_queries.py +++ b/agents-api/agents_api/models/entry/test_entry_queries.py @@ -2,6 +2,7 @@ This module contains tests for entry queries against the CozoDB database. It verifies the functionality of adding, retrieving, and processing entries as defined in the schema. """ + # Tests for entry queries from uuid import uuid4 diff --git a/agents-api/agents_api/models/session/create_session.py b/agents-api/agents_api/models/session/create_session.py index 0c6c4f112..b65b8291f 100644 --- a/agents-api/agents_api/models/session/create_session.py +++ b/agents-api/agents_api/models/session/create_session.py @@ -2,6 +2,7 @@ This module contains the functionality for creating a new session in the 'cozodb' database. It constructs and executes a datalog query to insert session data. """ + from uuid import UUID import pandas as pd diff --git a/agents-api/agents_api/models/session/test_session_queries.py b/agents-api/agents_api/models/session/test_session_queries.py index 18d4ccdbf..018c08949 100644 --- a/agents-api/agents_api/models/session/test_session_queries.py +++ b/agents-api/agents_api/models/session/test_session_queries.py @@ -1,6 +1,7 @@ """ This module contains tests for session-related queries against the 'cozodb' database. It verifies the creation, retrieval, and deletion of session records as defined in the schema provided in agents-api/README.md. """ + # Tests for session queries from uuid import uuid4 diff --git a/agents-api/agents_api/models/user/create_user.py b/agents-api/agents_api/models/user/create_user.py index edaf9566e..3c1f70fa0 100644 --- a/agents-api/agents_api/models/user/create_user.py +++ b/agents-api/agents_api/models/user/create_user.py @@ -2,6 +2,7 @@ This module contains the functionality for creating a new user in the CozoDB database. It defines a query for inserting user data into the 'users' relation. """ + from uuid import UUID import pandas as pd diff --git a/agents-api/agents_api/models/user/test_user_queries.py b/agents-api/agents_api/models/user/test_user_queries.py index e3024a204..e4464b529 100644 --- a/agents-api/agents_api/models/user/test_user_queries.py +++ b/agents-api/agents_api/models/user/test_user_queries.py @@ -1,4 +1,5 @@ """This module contains tests for user-related queries against the 'cozodb' database. It includes tests for creating, updating, and retrieving user information.""" + # Tests for user queries from uuid import uuid4 diff --git a/agents-api/agents_api/web.py b/agents-api/agents_api/web.py index 5156a6b48..d3c365710 100644 --- a/agents-api/agents_api/web.py +++ b/agents-api/agents_api/web.py @@ -1,6 +1,7 @@ """ This module initializes the FastAPI application, registers routes, sets up middleware, and configures exception handlers. """ + import fire import uvicorn import logging diff --git a/agents-api/agents_api/worker/__main__.py b/agents-api/agents_api/worker/__main__.py index 2f669b2a1..7730915d3 100644 --- a/agents-api/agents_api/worker/__main__.py +++ b/agents-api/agents_api/worker/__main__.py @@ -2,6 +2,7 @@ This script initializes and runs a Temporal worker that listens for tasks on a specified queue. It supports various workflows and activities related to agents' operations. """ + #!/usr/bin/env python3 import asyncio