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

docs : Update docstrings for OpenAI base.py #22221

Merged
merged 4 commits into from
Jun 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 21 additions & 2 deletions libs/community/langchain_community/agents/openai_assistant/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,12 @@ def _get_openai_async_client() -> openai.AsyncOpenAI:
def _convert_file_ids_into_attachments(file_ids: list) -> list:
"""
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 = []
for id in file_ids:
Expand All @@ -77,7 +82,15 @@ def _convert_file_ids_into_attachments(file_ids: list) -> list:
def _is_assistants_builtin_tool(
tool: Union[Dict[str, Any], Type[BaseModel], Callable, BaseTool],
) -> 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")
return (
isinstance(tool, dict)
Expand All @@ -93,6 +106,12 @@ def _get_assistants_tool(

Note that OpenAI assistants supports several built-in tools,
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):
return tool # type: ignore
Expand Down
Loading