MCPcopy Index your code
hub / github.com/OpenBMB/ChatDev / _extract_description

Function _extract_description

utils/function_catalog.py:160–173  ·  view source on GitHub ↗
(fn: Any)

Source from the content-addressed store, hash-verified

158
159
160def _extract_description(fn: Any) -> str | None:
161 doc = inspect.getdoc(fn)
162 if not doc:
163 return None
164 trimmed = doc.strip()
165 if not trimmed:
166 return None
167 first_paragraph = trimmed.split("\n\n", 1)[0]
168 normalized_lines = [line.strip() for line in first_paragraph.splitlines() if line.strip()]
169 normalized = " ".join(normalized_lines)
170 max_len = 600
171 if len(normalized) > max_len:
172 normalized = normalized[: max_len - 1].rstrip() + "…"
173 return normalized or None
174
175
176def _resolve_annotations(fn: Any) -> Mapping[str, Any]:

Callers 1

_build_function_metadataFunction · 0.85

Calls 1

splitMethod · 0.45

Tested by

no test coverage detected