Skip to content

Commit

Permalink
Automatically copy over "description" from pydantic field to dspy field
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasahle committed Mar 14, 2024
1 parent 6f004cc commit 259d6b0
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions dspy/signatures/field.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ def move_kwargs(**kwargs):
json_schema_extra[k] = v
else:
pydantic_kwargs[k] = v
# Also copy over the pydantic "description" if no dspy "desc" is given.
if "description" in kwargs and "desc" not in json_schema_extra:
json_schema_extra["desc"] = kwargs["description"]
pydantic_kwargs["json_schema_extra"] = json_schema_extra
return pydantic_kwargs

Expand Down

0 comments on commit 259d6b0

Please sign in to comment.