MCPcopy
hub / github.com/maziyarpanahi/openmed / validate_output_format

Function validate_output_format

openmed/utils/validation.py:129–151  ·  view source on GitHub ↗

Validate output format name. Args: format_name: Output format to validate. Returns: Validated format name. Raises: ValueError: If format is not supported.

(format_name: str)

Source from the content-addressed store, hash-verified

127
128
129def validate_output_format(format_name: str) -> str:
130 """Validate output format name.
131
132 Args:
133 format_name: Output format to validate.
134
135 Returns:
136 Validated format name.
137
138 Raises:
139 ValueError: If format is not supported.
140 """
141 valid_formats = ["dict", "json", "html", "csv"]
142
143 if not isinstance(format_name, str):
144 raise ValueError("Output format must be a string")
145
146 format_name = format_name.lower().strip()
147
148 if format_name not in valid_formats:
149 raise ValueError(f"Unsupported output format. Valid formats: {valid_formats}")
150
151 return format_name
152
153
154def validate_batch_size(batch_size: int, max_batch_size: int = 100) -> int:

Calls

no outgoing calls