MCPcopy Create free account
hub / github.com/algorithmicsuperintelligence/optillm / _clean_response

Function _clean_response

optillm/plugins/deepthink_plugin.py:241–253  ·  view source on GitHub ↗

Clean up the final response.

(response: str)

Source from the content-addressed store, hash-verified

239 return enhanced_prompt
240
241def _clean_response(response: str) -> str:
242 """Clean up the final response."""
243
244 # Remove any trailing whitespace
245 response = response.strip()
246
247 # Ensure the response doesn't end abruptly
248 if response and not response.endswith(('.', '!', '?', ':', '"', "'")):
249 # Don't add punctuation if it's a number or simple phrase
250 if not (response.replace(' ', '').replace(',', '').replace('.', '').isdigit() or len(response.split()) <= 3):
251 response += "."
252
253 return response

Callers 1

runFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected