the name size limit

This commit is contained in:
leo-gan
2023-10-23 14:37:08 -07:00
parent 03efe76585
commit 74ced52f0f

View File

@@ -88,16 +88,19 @@ def _load_module_members(module_path: str, namespace: str) -> ModuleMembers:
is_public=not name.startswith("_"),
)
)
elif inspect.isfunction(type_) and name != "create_conversational_retrieval_agent":
"""TODO: find a better solution.
elif inspect.isfunction(type_):
"""A border case:
'agents.agent_toolkits.conversational_retrieval.openai_functions
.create_conversational_retrieval_agent' is a too long name.
It makes the 'agents/functions' table inside API Reference unreadable.
This is a temporary solution to hide this function from API Reference."""
We limit the length of the qualified name to 65 characters.
qualified_name = f"{namespace}.{name}"""
if len(qualified_name) > 62:
qualified_name = '...' + qualified_name[-62:]
functions.append(
FunctionInfo(
name=name,
qualified_name=f"{namespace}.{name}",
qualified_name=qualified_name,
is_public=not name.startswith("_"),
)
)