From 042a7481ab947bbbe60e4ae947198209ff2cfb85 Mon Sep 17 00:00:00 2001 From: Jake Cyr Date: Thu, 6 Mar 2025 19:54:44 -0500 Subject: [PATCH] Update versions --- .github/workflows/test-application.yml | 2 +- openai_function_calling/__init__.py | 4 +- openai_function_calling/function_inferrer.py | 4 +- poetry.lock | 59 ++++++++++---------- pyproject.toml | 8 +-- ruff.toml | 2 +- tests/test_parameter.py | 12 ++-- tests/test_tool_helpers.py | 1 + 8 files changed, 46 insertions(+), 46 deletions(-) diff --git a/.github/workflows/test-application.yml b/.github/workflows/test-application.yml index 8009cc1..e44430e 100644 --- a/.github/workflows/test-application.yml +++ b/.github/workflows/test-application.yml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ['3.9', '3.10', '3.11', '3.12'] + python-version: ['3.9', '3.10', '3.11', '3.12', '3.13'] steps: - uses: actions/checkout@v3 - name: Set up Python ${{ matrix.python-version }} diff --git a/openai_function_calling/__init__.py b/openai_function_calling/__init__.py index fa38338..73a1cc0 100644 --- a/openai_function_calling/__init__.py +++ b/openai_function_calling/__init__.py @@ -8,8 +8,8 @@ __all__: list[str] = [ "Function", "FunctionDict", + "FunctionInferrer", + "JsonSchemaType", "Parameter", "ParameterDict", - "JsonSchemaType", - "FunctionInferrer", ] diff --git a/openai_function_calling/function_inferrer.py b/openai_function_calling/function_inferrer.py index 264708f..bc809b4 100644 --- a/openai_function_calling/function_inferrer.py +++ b/openai_function_calling/function_inferrer.py @@ -177,9 +177,7 @@ def _infer_from_inspection(function_reference: Callable) -> Function: if parameter_type == "null": if isinstance(parameter.annotation, EnumMeta): - enum_values = list( - parameter.annotation._value2member_map_.keys() # noqa: SLF001 - ) + enum_values = list(parameter.annotation._value2member_map_.keys()) parameter_type = FunctionInferrer._infer_list_item_type(enum_values) elif dataclasses.is_dataclass(parameter.annotation): parameter_type = JsonSchemaType.OBJECT.value diff --git a/poetry.lock b/poetry.lock index 443b9fe..d3748d3 100644 --- a/poetry.lock +++ b/poetry.lock @@ -334,13 +334,13 @@ files = [ [[package]] name = "openai" -version = "1.65.2" +version = "1.65.4" description = "The official Python library for the openai API" optional = false python-versions = ">=3.8" files = [ - {file = "openai-1.65.2-py3-none-any.whl", hash = "sha256:27d9fe8de876e31394c2553c4e6226378b6ed85e480f586ccfe25b7193fb1750"}, - {file = "openai-1.65.2.tar.gz", hash = "sha256:729623efc3fd91c956f35dd387fa5c718edd528c4bed9f00b40ef290200fb2ce"}, + {file = "openai-1.65.4-py3-none-any.whl", hash = "sha256:15566d46574b94eae3d18efc2f9a4ebd1366d1d44bfc1bdafeea7a5cf8271bcb"}, + {file = "openai-1.65.4.tar.gz", hash = "sha256:0b08c58625d556f5c6654701af1023689c173eb0989ce8f73c7fd0eb22203c76"}, ] [package.dependencies] @@ -517,13 +517,13 @@ typing-extensions = ">=4.6.0,<4.7.0 || >4.7.0" [[package]] name = "pytest" -version = "7.4.4" +version = "8.3.5" description = "pytest: simple powerful testing with Python" optional = false -python-versions = ">=3.7" +python-versions = ">=3.8" files = [ - {file = "pytest-7.4.4-py3-none-any.whl", hash = "sha256:b090cdf5ed60bf4c45261be03239c2c1c22df034fbffe691abe93cd80cea01d8"}, - {file = "pytest-7.4.4.tar.gz", hash = "sha256:2cf0005922c6ace4a3e2ec8b4080eb0d9753fdc93107415332f50ce9e7994280"}, + {file = "pytest-8.3.5-py3-none-any.whl", hash = "sha256:c69214aa47deac29fad6c2a4f590b9c4a9fdb16a403176fe154b79c0b4d4d820"}, + {file = "pytest-8.3.5.tar.gz", hash = "sha256:f4efe70cc14e511565ac476b57c279e12a855b11f48f212af1080ef2263d3845"}, ] [package.dependencies] @@ -531,36 +531,37 @@ colorama = {version = "*", markers = "sys_platform == \"win32\""} exceptiongroup = {version = ">=1.0.0rc8", markers = "python_version < \"3.11\""} iniconfig = "*" packaging = "*" -pluggy = ">=0.12,<2.0" -tomli = {version = ">=1.0.0", markers = "python_version < \"3.11\""} +pluggy = ">=1.5,<2" +tomli = {version = ">=1", markers = "python_version < \"3.11\""} [package.extras] -testing = ["argcomplete", "attrs (>=19.2.0)", "hypothesis (>=3.56)", "mock", "nose", "pygments (>=2.7.2)", "requests", "setuptools", "xmlschema"] +dev = ["argcomplete", "attrs (>=19.2)", "hypothesis (>=3.56)", "mock", "pygments (>=2.7.2)", "requests", "setuptools", "xmlschema"] [[package]] name = "ruff" -version = "0.3.4" +version = "0.9.9" description = "An extremely fast Python linter and code formatter, written in Rust." optional = false python-versions = ">=3.7" files = [ - {file = "ruff-0.3.4-py3-none-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl", hash = "sha256:60c870a7d46efcbc8385d27ec07fe534ac32f3b251e4fc44b3cbfd9e09609ef4"}, - {file = "ruff-0.3.4-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:6fc14fa742e1d8f24910e1fff0bd5e26d395b0e0e04cc1b15c7c5e5fe5b4af91"}, - {file = "ruff-0.3.4-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d3ee7880f653cc03749a3bfea720cf2a192e4f884925b0cf7eecce82f0ce5854"}, - {file = "ruff-0.3.4-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:cf133dd744f2470b347f602452a88e70dadfbe0fcfb5fd46e093d55da65f82f7"}, - {file = "ruff-0.3.4-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:3f3860057590e810c7ffea75669bdc6927bfd91e29b4baa9258fd48b540a4365"}, - {file = "ruff-0.3.4-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:986f2377f7cf12efac1f515fc1a5b753c000ed1e0a6de96747cdf2da20a1b369"}, - {file = "ruff-0.3.4-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:c4fd98e85869603e65f554fdc5cddf0712e352fe6e61d29d5a6fe087ec82b76c"}, - {file = "ruff-0.3.4-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:64abeed785dad51801b423fa51840b1764b35d6c461ea8caef9cf9e5e5ab34d9"}, - {file = "ruff-0.3.4-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:df52972138318bc7546d92348a1ee58449bc3f9eaf0db278906eb511889c4b50"}, - {file = "ruff-0.3.4-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:98e98300056445ba2cc27d0b325fd044dc17fcc38e4e4d2c7711585bd0a958ed"}, - {file = "ruff-0.3.4-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:519cf6a0ebed244dce1dc8aecd3dc99add7a2ee15bb68cf19588bb5bf58e0488"}, - {file = "ruff-0.3.4-py3-none-musllinux_1_2_i686.whl", hash = "sha256:bb0acfb921030d00070539c038cd24bb1df73a2981e9f55942514af8b17be94e"}, - {file = "ruff-0.3.4-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:cf187a7e7098233d0d0c71175375c5162f880126c4c716fa28a8ac418dcf3378"}, - {file = "ruff-0.3.4-py3-none-win32.whl", hash = "sha256:af27ac187c0a331e8ef91d84bf1c3c6a5dea97e912a7560ac0cef25c526a4102"}, - {file = "ruff-0.3.4-py3-none-win_amd64.whl", hash = "sha256:de0d5069b165e5a32b3c6ffbb81c350b1e3d3483347196ffdf86dc0ef9e37dd6"}, - {file = "ruff-0.3.4-py3-none-win_arm64.whl", hash = "sha256:6810563cc08ad0096b57c717bd78aeac888a1bfd38654d9113cb3dc4d3f74232"}, - {file = "ruff-0.3.4.tar.gz", hash = "sha256:f0f4484c6541a99862b693e13a151435a279b271cff20e37101116a21e2a1ad1"}, + {file = "ruff-0.9.9-py3-none-linux_armv6l.whl", hash = "sha256:628abb5ea10345e53dff55b167595a159d3e174d6720bf19761f5e467e68d367"}, + {file = "ruff-0.9.9-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:b6cd1428e834b35d7493354723543b28cc11dc14d1ce19b685f6e68e07c05ec7"}, + {file = "ruff-0.9.9-py3-none-macosx_11_0_arm64.whl", hash = "sha256:5ee162652869120ad260670706f3cd36cd3f32b0c651f02b6da142652c54941d"}, + {file = "ruff-0.9.9-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:3aa0f6b75082c9be1ec5a1db78c6d4b02e2375c3068438241dc19c7c306cc61a"}, + {file = "ruff-0.9.9-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:584cc66e89fb5f80f84b05133dd677a17cdd86901d6479712c96597a3f28e7fe"}, + {file = "ruff-0.9.9-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:abf3369325761a35aba75cd5c55ba1b5eb17d772f12ab168fbfac54be85cf18c"}, + {file = "ruff-0.9.9-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:3403a53a32a90ce929aa2f758542aca9234befa133e29f4933dcef28a24317be"}, + {file = "ruff-0.9.9-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:18454e7fa4e4d72cffe28a37cf6a73cb2594f81ec9f4eca31a0aaa9ccdfb1590"}, + {file = "ruff-0.9.9-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:0fadfe2c88724c9617339f62319ed40dcdadadf2888d5afb88bf3adee7b35bfb"}, + {file = "ruff-0.9.9-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:6df104d08c442a1aabcfd254279b8cc1e2cbf41a605aa3e26610ba1ec4acf0b0"}, + {file = "ruff-0.9.9-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:d7c62939daf5b2a15af48abbd23bea1efdd38c312d6e7c4cedf5a24e03207e17"}, + {file = "ruff-0.9.9-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:9494ba82a37a4b81b6a798076e4a3251c13243fc37967e998efe4cce58c8a8d1"}, + {file = "ruff-0.9.9-py3-none-musllinux_1_2_i686.whl", hash = "sha256:4efd7a96ed6d36ef011ae798bf794c5501a514be369296c672dab7921087fa57"}, + {file = "ruff-0.9.9-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:ab90a7944c5a1296f3ecb08d1cbf8c2da34c7e68114b1271a431a3ad30cb660e"}, + {file = "ruff-0.9.9-py3-none-win32.whl", hash = "sha256:6b4c376d929c25ecd6d87e182a230fa4377b8e5125a4ff52d506ee8c087153c1"}, + {file = "ruff-0.9.9-py3-none-win_amd64.whl", hash = "sha256:837982ea24091d4c1700ddb2f63b7070e5baec508e43b01de013dc7eff974ff1"}, + {file = "ruff-0.9.9-py3-none-win_arm64.whl", hash = "sha256:3ac78f127517209fe6d96ab00f3ba97cafe38718b23b1db3e96d8b2d39e37ddf"}, + {file = "ruff-0.9.9.tar.gz", hash = "sha256:0062ed13f22173e85f8f7056f9a24016e692efeea8704d1a5e8011b8aa850933"}, ] [[package]] @@ -650,4 +651,4 @@ files = [ [metadata] lock-version = "2.0" python-versions = ">=3.9, <4.0" -content-hash = "7532b4b4b4d71242730afab43c2075725170129ef27fd04dab2a5120a80bf661" +content-hash = "8dd5189486bb5ebe3c8f4835cc99755cd52a0c07a074340406e93c2fd703e13e" diff --git a/pyproject.toml b/pyproject.toml index a1088cb..f35f5e5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -9,14 +9,14 @@ packages = [{ include = "openai_function_calling" }] [tool.poetry.dependencies] python = ">=3.9, <4.0" -typing-extensions = "^4.7.1" +typing-extensions = "^4.12.2" docstring-parser = "^0.16" [tool.poetry.group.dev.dependencies] openai = "^1.3.2" -pytest = "^7.4.3" -ruff = "0.3.4" -coverage = "^7.3.2" +pytest = "^8.3.5" +ruff = "0.9.9" +coverage = "^7.6.12" [build-system] requires = ["poetry-core"] diff --git a/ruff.toml b/ruff.toml index 926cc86..625c5e0 100644 --- a/ruff.toml +++ b/ruff.toml @@ -85,7 +85,7 @@ lint.fixable = [ "UP", "YTT", ] -lint.ignore = ["D407", "D406", "D203", "ANN101", "D213", "PLR0913", "ANN401"] +lint.ignore = ["D407", "D406", "D203", "D213", "PLR0913", "ANN401"] exclude = [ ".bzr", ".direnv", diff --git a/tests/test_parameter.py b/tests/test_parameter.py index 6f667b5..291bb4f 100644 --- a/tests/test_parameter.py +++ b/tests/test_parameter.py @@ -116,12 +116,12 @@ def test_to_json_schema_with_type_array_items_returns_expected_dict() -> None: parameter_dict: ParameterDict = parameter.to_json_schema() - assert ( - "items" in parameter_dict - ), "Expected parameter dict to have 'items' property." - assert ( - "type" in parameter_dict["items"] - ), "Expected parameter 'items' dict to have 'type' property." + assert "items" in parameter_dict, ( + "Expected parameter dict to have 'items' property." + ) + assert "type" in parameter_dict["items"], ( + "Expected parameter 'items' dict to have 'type' property." + ) assert isinstance(parameter_dict["items"]["type"], str) assert parameter_dict["items"]["type"] == JsonSchemaType.STRING diff --git a/tests/test_tool_helpers.py b/tests/test_tool_helpers.py index 8f1e626..6f13ba5 100644 --- a/tests/test_tool_helpers.py +++ b/tests/test_tool_helpers.py @@ -71,6 +71,7 @@ def test_from_functions_dicts_function_parameters_has_expected_type() -> None: [get_current_weather_schema] )[0] + assert "parameters" in tool_param["function"] assert isinstance(tool_param["function"]["parameters"], dict)