Open jamesbraza opened 1 week ago
@ishaan-jaff @krrishdholakia I solved this last weekend after I really needed the signature to work. I can propagate the solution here, which involves switching from numpydoc
(only numpy
style) to https://github.com/rr-/docstring_parser for support of any docstring style. Are you okay with this breaking change?
Are you okay with this breaking change?
why is it a breaking change ?
what exactly is breaking here ?
Oh yeah, https://github.com/BerriAI/litellm/blob/v1.40.15/litellm/utils.py#L4376:
--- from numpydoc.docscrape import NumpyDocString
+++ from docstring_parser import parse
Basically it's changing out the package required internally to function_to_dict
. Benefits are mainly that other docstring styles can be supported (e.g. Google docstrings, which I use)
The Feature
As of
litellm==1.40.15
, type unions are not supported withinlitellm.utils.function_to_dict
. It would be great to support type unions in this utility function.For example, the below code will currently crash due to the type union:
To show how a type union is done in JSON schema, we can refer to
pydantic==2.7.4
:Will print (after prettifying):
Motivation, pitch
There are times when a function needs to support multiple types
Twitter / LinkedIn details
No response