Skip to content

Commit

Permalink
title List -> Array
Browse files Browse the repository at this point in the history
  • Loading branch information
CalebCourier committed Mar 13, 2024
1 parent cf3952e commit 82500da
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion guardrails/utils/pydantic_utils/v1.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ def convert_pydantic_model_to_openai_fn(

# if type_origin == list:
# json_schema = {
# "title": f"List<{json_schema.get('title')}>",
# "title": f"Array<{json_schema.get('title')}>",
# "type": "array",
# "items": json_schema,
# }
Expand Down
2 changes: 1 addition & 1 deletion guardrails/utils/pydantic_utils/v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ def convert_pydantic_model_to_openai_fn(

if type_origin == list:
json_schema = {
"title": f"List<{json_schema.get('title')}>",
"title": f"Array<{json_schema.get('title')}>",
"type": "array",
"items": json_schema,
}
Expand Down
4 changes: 2 additions & 2 deletions tests/unit_tests/utils/pydantic_utils/v1.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,15 @@ def test_list_schema(self):

# fmt: off
expected_schema = {
"title": f"List<{expected_schema.get('title')}>",
"title": f"Array<{expected_schema.get('title')}>",
"type": "array",
"items": expected_schema
}
# fmt: on

# fmt: off
expected_fn_params = { # noqa
"name": "List<Foo>",
"name": "Array<Foo>",
"parameters": expected_schema
}
# fmt: on
Expand Down
4 changes: 2 additions & 2 deletions tests/unit_tests/utils/pydantic_utils/v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,15 @@ def test_list_schema(self):

# fmt: off
expected_schema = {
"title": f"List<{expected_schema.get('title')}>",
"title": f"Array<{expected_schema.get('title')}>",
"type": "array",
"items": expected_schema
}
# fmt: on

# fmt: off
expected_fn_params = {
"name": "List<Foo>",
"name": "Array<Foo>",
"parameters": expected_schema
}
# fmt: on
Expand Down

0 comments on commit 82500da

Please sign in to comment.