Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/lfrqa/tests/test_lfrqa_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def test_availability() -> None:
@pytest.fixture(name="mini_lfrqa", scope="module")
def fixture_mini_lfrqa() -> list[LFRQAQuestion]:
return [
LFRQAQuestion(**row) # type: ignore[misc]
LFRQAQuestion(**row) # type: ignore[arg-type]
for row in pd.read_csv(MINI_LFRQA_CSV)[
["qid", "question", "answer", "gold_doc_ids"]
].to_dict(orient="records")
Expand Down
7 changes: 3 additions & 4 deletions src/aviary/tools/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ def from_function(
"""Hydrate this class via inspection from a free function with a docstring."""
fxn_name = function.__name__
# now we parse descriptions from the docstring
docstring = parse(function.__doc__, style=docstring_style) # type: ignore[arg-type] # SEE: https://github.com/rr-/docstring_parser/issues/88
docstring = parse(function.__doc__, style=docstring_style)
if not docstring.description:
raise ValueError(f"Missing docstring for function {fxn_name}.")
# now we parse descriptions from the docstring
Expand Down Expand Up @@ -447,9 +447,8 @@ def from_function(
Field(**field_config),
)

json_schema = create_model( # type: ignore[call-overload]
"FieldDefinitions", **field_definitions
).model_json_schema()
model_cls = create_model("FieldDefinitions", **field_definitions) # type: ignore[call-overload]
json_schema = model_cls.model_json_schema()
json_schema.pop("title") # Remove the throwaway model name
if "required" not in json_schema:
# The API schema doesn't require this, and gpt-3.5-turbo doesn't
Expand Down
Loading