INNER CODE UNIT · Python
parse_os_response
eugeneyan/obsidian-copilot · src/app.py:61
def parse_os_response(response: dict) -> List[dict]:
"""
Parse response from opensearch index.
Args:
response: Response from opensearch query.
Returns:
List of hits with chunkID and rank
"""
hits = []
for rank, hit in enumerate(response["hits"]["hits"]):
hits.append({"id": hit["_id"], "rank": rank})
return hits