code: def find_top_k_closest_embeddings(
      embedded_prompt: list[float], embs: list[list[float]], k: int
  ):
      # Normalize the embeddings
      norm_embedded_prompt = embedded_prompt / np.linalg.norm(
          embedded_prompt
      )
      norm_embs = embs / np.linalg.norm(embs, axis=1)[:, np.newaxis]
  
      # Calculate cosine similarity
      cosine_similarities = np.dot(norm_embs, norm_embedded_prompt)
  
      # Get the indices of the top k closest embeddings
      top_k_indices = np.argsort(cosine_similarities)[-k:]
  
      return top_k_indices[::-1]
  
file_path: evals/evals/completion_fns/retrieval.py
imports: import os
  from ast import literal_eval
  from typing import Any, Optional, Union
  import numpy
  import pandas
  from openai import OpenAI
  from evals.api import CompletionFn, CompletionResult
  from evals.prompt.base import ChatCompletionPrompt, CompletionPrompt
  from evals.record import record_sampling
  from evals.registry import Registry
label_desc: Use image node_id 2 for calling a global function with example usage: find_top_k_closest_embeddings(embedded_prompt, embs, k) and returns: top_k_indices