MCPcopy Create free account
hub / github.com/HKUDS/OpenSpace / fetch_metadata

Method fetch_metadata

openspace/cloud/client.py:134–165  ·  view source on GitHub ↗

GET /records/metadata — fetch all visible records with pagination.

(
        self,
        *,
        include_embedding: bool = False,
        limit: int = 200,
    )

Source from the content-addressed store, hash-verified

132 return data
133
134 def fetch_metadata(
135 self,
136 *,
137 include_embedding: bool = False,
138 limit: int = 200,
139 ) -> List[Dict[str, Any]]:
140 """GET /records/metadata — fetch all visible records with pagination."""
141 all_items: List[Dict[str, Any]] = []
142 cursor: Optional[str] = None
143
144 while True:
145 params: Dict[str, str] = {"limit": str(limit)}
146 if include_embedding:
147 params["include_embedding"] = "true"
148 if cursor:
149 params["cursor"] = cursor
150
151 path = f"/records/metadata?{urllib.parse.urlencode(params)}"
152 data = self._get_json(path, timeout=15)
153
154 all_items.extend(
155 self._normalize_record_payload(item)
156 for item in data.get("items", [])
157 )
158
159 if not data.get("has_more"):
160 break
161 cursor = data.get("next_cursor")
162 if not cursor:
163 break
164
165 return all_items
166
167 def search_record_embeddings(
168 self,

Callers

nothing calls this directly

Calls 3

_get_jsonMethod · 0.95
getMethod · 0.80

Tested by

no test coverage detected