mirror of
https://github.com/hwchase17/langchain.git
synced 2025-06-27 08:58:48 +00:00
docs : Update docstrings for OpenAI base.py (#22221)
- [x] **PR title**: Update docstrings for OpenAI base.py -**Description:** Updated the docstring of few OpenAI functions for a better understanding of the function. - **Issue:** #21983 --------- Co-authored-by: Bagatur <baskaryan@gmail.com>
This commit is contained in:
parent
7a197539aa
commit
9d4350e69a
@ -61,7 +61,12 @@ def _get_openai_async_client() -> openai.AsyncOpenAI:
|
|||||||
def _convert_file_ids_into_attachments(file_ids: list) -> list:
|
def _convert_file_ids_into_attachments(file_ids: list) -> list:
|
||||||
"""
|
"""
|
||||||
Convert file_ids into attachments
|
Convert file_ids into attachments
|
||||||
File search and Code interpreter will be turned on by default
|
File search and Code interpreter will be turned on by default.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
file_ids (list): List of file_ids that need to be converted into attachments.
|
||||||
|
Returns:
|
||||||
|
A list of attachments that are converted from file_ids.
|
||||||
"""
|
"""
|
||||||
attachments = []
|
attachments = []
|
||||||
for id in file_ids:
|
for id in file_ids:
|
||||||
@ -77,7 +82,15 @@ def _convert_file_ids_into_attachments(file_ids: list) -> list:
|
|||||||
def _is_assistants_builtin_tool(
|
def _is_assistants_builtin_tool(
|
||||||
tool: Union[Dict[str, Any], Type[BaseModel], Callable, BaseTool],
|
tool: Union[Dict[str, Any], Type[BaseModel], Callable, BaseTool],
|
||||||
) -> bool:
|
) -> bool:
|
||||||
"""Determine if tool corresponds to OpenAI Assistants built-in."""
|
"""
|
||||||
|
Determine if tool corresponds to OpenAI Assistants built-in.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
tool : Tool that needs to be determined
|
||||||
|
Returns:
|
||||||
|
A boolean response of true or false indicating if the tool corresponds to
|
||||||
|
OpenAI Assistants built-in.
|
||||||
|
"""
|
||||||
assistants_builtin_tools = ("code_interpreter", "retrieval")
|
assistants_builtin_tools = ("code_interpreter", "retrieval")
|
||||||
return (
|
return (
|
||||||
isinstance(tool, dict)
|
isinstance(tool, dict)
|
||||||
@ -93,6 +106,12 @@ def _get_assistants_tool(
|
|||||||
|
|
||||||
Note that OpenAI assistants supports several built-in tools,
|
Note that OpenAI assistants supports several built-in tools,
|
||||||
such as "code_interpreter" and "retrieval."
|
such as "code_interpreter" and "retrieval."
|
||||||
|
|
||||||
|
Args:
|
||||||
|
tool: Tools or functions that need to be converted to OpenAI tools.
|
||||||
|
Returns:
|
||||||
|
A dictionary of tools that are converted into OpenAI tools.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
if _is_assistants_builtin_tool(tool):
|
if _is_assistants_builtin_tool(tool):
|
||||||
return tool # type: ignore
|
return tool # type: ignore
|
||||||
|
Loading…
Reference in New Issue
Block a user