INNER CODE UNIT · Python

parse_semantic_response

eugeneyan/obsidian-copilot · src/app.py:79

def parse_semantic_response(
    indices: np.ndarray, embedding_index: Dict[int, str]
) -> List[dict]:
    """
    Parse response from semantic index.

    Args:
        indices: Response from semantic query, an array of ints.

    Returns:
        List of hits with chunkID and rank
    """
    hits = []

    for rank, idx in enumerate(indices):
        hits.append({"id": embedding_index[idx], "rank": rank})

    return hits

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…