langchain/libs
hmn falahi 4822beb298
Ignore self/cls from required args of class functions in convert_to_openai_tool (#20691)
Removed redundant self/cls from required args of class functions in
_get_python_function_required_args:

```python
class MemberTool:
    def search_member(
            self,
            keyword: str,
            *args,
            **kwargs,
    ):
        """Search on members with any keyword like first_name, last_name, email

        Args:
            keyword: Any keyword of member
        """

        headers = dict(authorization=kwargs['token'])
        members = []
        try:
            members = request_(
                method='SEARCH',
                url=f'{service_url}/apiv1/members',
                headers=headers,
                json=dict(query=keyword),
            )

        except Exception as e:
            logger.info(e.__doc__)

        return members

convert_to_openai_tool(MemberTool.search_member)
```
expected result:
```
{'type': 'function', 'function': {'name': 'search_member', 'description': 'Search on members with any keyword like first_name, last_name, username, email', 'parameters': {'type': 'object', 'properties': {'keyword': {'type': 'string', 'description': 'Any keyword of member'}}, 'required': ['keyword']}}}
```

#20685

---------

Co-authored-by: Bagatur <22008038+baskaryan@users.noreply.github.com>
Co-authored-by: Bagatur <baskaryan@gmail.com>
2024-04-29 11:46:26 -04:00
..
cli cli[patch]: Update migrations file manually (#21021) 2024-04-29 10:53:31 -04:00
community community[patch]: Neo4j enhanced schema (#20983) 2024-04-29 10:45:55 -04:00
core Ignore self/cls from required args of class functions in convert_to_openai_tool (#20691) 2024-04-29 11:46:26 -04:00
experimental experimental[minor]: Add bind_tools and with_structured_output functions to OllamaFunctions (#20881) 2024-04-29 14:13:33 +00:00
langchain community[patch]: Add OpenSearch as semantic cache (#20254) 2024-04-27 00:20:24 +00:00
partners anthropic[patch]: add tests for secret_str for api key (#20986) 2024-04-29 10:39:14 -04:00
standard-tests standard-tests: split tool calling test (#20803) 2024-04-23 20:59:45 +00:00
text-splitters text-splitters[patch]: fix MarkdownHeaderTextSplitter fails to parse headers with non-printable characters (#20645) 2024-04-25 00:07:42 +00:00