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

Function _try_literal_schema

utils/function_catalog.py:327–333  ·  view source on GitHub ↗
(values: Sequence[Any])

Source from the content-addressed store, hash-verified

325
326
327def _try_literal_schema(values: Sequence[Any]) -> Dict[str, Any] | None:
328 if not values:
329 return None
330 literal_type = _infer_literal_type(values)
331 if literal_type is None:
332 return None
333 return {"type": literal_type, "enum": list(values)}
334
335
336def _infer_literal_type(values: Sequence[Any]) -> str | None:

Callers 1

_annotation_to_schemaFunction · 0.85

Calls 1

_infer_literal_typeFunction · 0.85

Tested by

no test coverage detected