From 680052ff62ce08be13f5451d2c9bd7b7eb7e4642 Mon Sep 17 00:00:00 2001 From: Pierce Freeman Date: Thu, 24 Aug 2023 11:52:57 -0700 Subject: [PATCH] Make fn_calling tests optional --- README.md | 2 +- gpt_json/tests/test_fn_calling.py | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 444a3f4..f154aac 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ Specifically this library: - Includes retry logic for the most common API failures - Formats the JSON schema as a flexible prompt that can be added into any message - Supports templating of prompts to allow for dynamic content -- Enables typehinted function calls within the new GPT models, to better support agent creation +- Validate typehinted function calls in the new GPT models, to better support agent creation ## Getting Started diff --git a/gpt_json/tests/test_fn_calling.py b/gpt_json/tests/test_fn_calling.py index 2840704..7675958 100644 --- a/gpt_json/tests/test_fn_calling.py +++ b/gpt_json/tests/test_fn_calling.py @@ -2,6 +2,7 @@ import pytest +from gpt_json.common import get_pydantic_version from gpt_json.fn_calling import get_base_type, parse_function from gpt_json.tests.shared import ( UnitType, @@ -11,6 +12,9 @@ ) +@pytest.mark.skipif( + get_pydantic_version() < 2, reason="Pydantic 2+ required for function calls" +) @pytest.mark.parametrize( "incorrect_fn", [ @@ -29,6 +33,9 @@ def test_get_base_type(): assert get_base_type(Union[UnitType, None]) == UnitType +@pytest.mark.skipif( + get_pydantic_version() < 2, reason="Pydantic 2+ required for function calls" +) def test_parse_function(): """ Assert the formatted schema conforms to the expected JSON-Schema / GPT format.