MCPcopy
hub / github.com/HKUDS/MiniRAG / locate_json_string_body_from_string

Function locate_json_string_body_from_string

minirag/utils.py:48–54  ·  view source on GitHub ↗

Locate the JSON string body from a string

(content: str)

Source from the content-addressed store, hash-verified

46
47
48def locate_json_string_body_from_string(content: str) -> Union[str, None]:
49 """Locate the JSON string body from a string"""
50 maybe_json_str = re.search(r"{.*}", content, re.DOTALL)
51 if maybe_json_str is not None:
52 return maybe_json_str.group(0)
53 else:
54 return None
55
56
57def convert_response_to_json(response: str) -> dict:

Callers 9

azure_openai_completeFunction · 0.90
nvidia_openai_completeFunction · 0.90
bedrock_completeFunction · 0.90
hf_model_completeFunction · 0.90
convert_response_to_jsonFunction · 0.85
local_queryFunction · 0.85
global_queryFunction · 0.85
hybrid_queryFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected