You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Guys i think there is some issue with the way things are implemented currently in this repo biggest of which is regarding coding standard
currently you guys use convert_to_openai_tool from langchain_core.utils.function_calling in order to convert python functions to a dict representing a tool but the examples in functions.py don't follow the standard properly
the following function is used to parse things upstream inside langchain
def_parse_python_function_docstring(function: Callable) ->Tuple[str, dict]:
"""Parse the function and argument descriptions from the docstring of a function. Assumes the function docstring follows Google Python style guide. """
and if we use anything but the google python style guide the code messes up the returned dict for example
defcode_interpreter(code_markdown: str) ->dict|str:
"""Execute the provided Python code string on the terminal using exec. The string should contain valid, executable and pure python code in markdown syntax. Code should also import any required python packages. Args: code_markdown: The Python code with markdown syntax to be executed. Returns: A dictionary containing variables declared and values returned by function calls. """
.
.
.
this is proper format and when parsed with convert_to_openai_tool will return
{
'type': 'function','function': {'name': 'code_interpreter','description': 'Execute the provided Python code string on the terminal using exec. The string should contain valid, executable and pure python code inmarkdown syntax.\nCode should also import any required python packages.','parameters': {'type': 'object','properties': {'code_markdown': {'type': 'string', 'description': 'The Python code with markdown syntax to be executed.'}},'required': ['code_markdown']}}}
the current version of the same function in functions.py returns
{
'type': 'function','function': {'name': 'code_interpreter','description': ' Execute the provided Python code string on the terminal using exec.\n The string should contain valid, executable and purepython code in markdown syntax.\n Code should also import any required python packages. Parameters:\n - code_markdown (str): The Python code withmarkdown syntax to be executed.\n for eg. ```python\n<code-string>\n``` Returns:\n dict: A dictionary containing variables declared and valuesreturned by function calls. Note: Use this function with caution, as executing arbitrary code can pose security risks.\n ','parameters': {'type': 'object', 'properties': {'code_markdown': {'type': 'string'}}, 'required': ['code_markdown']}}}
you can clearly see that description messes up a lot of things in short code style for python function tools is really important and this should be mentioned in the repo
Currently using multiple tools breaks everything the reason for which is improper tool dicts so i request a total rewrite of all function descriptions in proper formats it will make examples much better
The text was updated successfully, but these errors were encountered:
we are using convert_to_openai_tool() as is without any modification, so could you point us to where the discrepancy you presented above could be stemming from?
Guys i think there is some issue with the way things are implemented currently in this repo biggest of which is regarding coding standard
currently you guys use
convert_to_openai_tool
fromlangchain_core.utils.function_calling
in order to convert python functions to a dict representing a tool but the examples in functions.py don't follow the standard properlythe following function is used to parse things upstream inside langchain
and if we use anything but the google python style guide the code messes up the returned dict for example
this is proper format and when parsed with convert_to_openai_tool will return
the current version of the same function in functions.py returns
you can clearly see that description messes up a lot of things in short code style for python function tools is really important and this should be mentioned in the repo
Currently using multiple tools breaks everything the reason for which is improper tool dicts so i request a total rewrite of all function descriptions in proper formats it will make examples much better
The text was updated successfully, but these errors were encountered: