Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extracting docstring from nested Pydantic Objects #500

Open
FridrikLax opened this issue Mar 11, 2024 · 2 comments
Open

Extracting docstring from nested Pydantic Objects #500

FridrikLax opened this issue Mar 11, 2024 · 2 comments

Comments

@FridrikLax
Copy link

FridrikLax commented Mar 11, 2024

class Workflow(OpenAISchema):
    """Request to the assistant to help the case to flow to the next step in a workflow."""
    workflow: str

class Assign(Workflow):
    """Request to assign a case to another user."""
    target_user: str

The openai_schema class method only accounts for the docstring of Assign, but not the parent (Workflow).

Current output:
{'function': {'description': 'Request to assign a case to another user.', 'name': 'Assign', 'parameters': {'properties': {'target_user': {'title': 'Target ' 'User', 'type': 'string'}, 'workflow': {'title': 'Workflow', 'type': 'string'}}, 'required': ['target_user', 'workflow'], 'type': 'object'}}, 'type': 'function'}

Desired output:
{'function': {'description': 'Request to the assistant to help the case to flow to the next step in a workflow. Request to assign a case to another user.', 'name': 'Assign', 'parameters': {'properties': {'target_user': {'title': 'Target ' 'User', 'type': 'string'}, 'workflow': {'title': 'Workflow', 'type': 'string'}}, 'required': ['target_user', 'workflow'], 'type': 'object'}}, 'type': 'function'}

@wehnsdaefflae
Copy link

that would be great indeed. in fact i thought a function description would be essential to proper function selection in the first place.

@jxnl
Copy link
Owner

jxnl commented Apr 12, 2024

thats not really how inheretance works, can you submit a PR for what that might look like?

what if they do params in the docstring

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants