-
Notifications
You must be signed in to change notification settings - Fork 13
Open
Description
Line 40 in b3b7f8b
| def _param( |
When using lite_mk_func with dataclasses, field descriptions are not populated from type hints. A fix solve.it help figured out is to support typing.Annotated to specify field descriptions:
from typing import Annotated, Optional
@dataclass
class Adult:
"How adults are supposed to help in this game"
adult_role: Annotated[str, "facilitator | demonstrator | player | observer"]
adults_required: Annotated[int, "Number of adults needed"]
losing_gracefully: Annotated[Optional[bool], "Can adult elegantly lose? None if not competitive"]But this would cause it to produces empty descriptions and incorrect types ('type': 'object' instead of 'string').
{'type': 'function',
'function': {'name': 'Adult',
'description': 'How do adults supposed to help in this game',
'parameters': {'type': 'object',
'properties': {'adult_role': {'type': 'object', 'description': ''},
'adults_required': {'type': 'object', 'description': ''},
'losing_gracefully': {'type': 'object', 'description': ''}},
'title': 'Adult',
'required': ['adult_role', 'adults_required', 'losing_gracefully']}}}
This requires modifying _param and _process_property in funccall.py.
With solve.it's help I explored the fix a bit here: https://share.solve.it.com/d/75ab5d185e67486d066af43420ea2eba
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels