MCPcopy Create free account
hub / github.com/abetlen/llama-cpp-python / _regex_capture

Method _regex_capture

examples/server/server.py:4497–4504  ·  view source on GitHub ↗
(text: str, pattern: str)

Source from the content-addressed store, hash-verified

4495
4496 @staticmethod
4497 def _regex_capture(text: str, pattern: str) -> Optional[Any]:
4498 match = re.search(pattern, text, re.S)
4499 if match is None:
4500 return None
4501 group_dict = match.groupdict()
4502 if group_dict:
4503 return {key: value for key, value in group_dict.items() if value is not None}
4504 return match.group(1) if match.lastindex else match.group(0)
4505
4506 @staticmethod
4507 def _gemma4_tool_call_to_json(text: str) -> str:

Callers 1

_parse_response_valueMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected