code: from components.store import get_storage_context
  from llama_index import VectorStoreIndex
  from llama_index.retrievers import (
      VectorIndexRetriever,
  )
  from models.gpts import get_gpts_by_uuids
  
  
  def search_gpts(question):
      storage_context = get_storage_context()
      index = VectorStoreIndex.from_documents([], storage_context=storage_context)
  
      retriever = VectorIndexRetriever(index=index, similarity_top_k=10)
  
      nodes = retriever.retrieve(question)
  
      uuids = []
      uuids_with_scores = {}
      gpts = []
      for node in nodes:
          print("node metadata", node.metadata)
          if node.score > 0.80:
              uuid = node.metadata['uuid']
              uuids.append(uuid)
              uuids_with_scores[uuid] = node.score
  
      if len(uuids) == 0:
          return gpts
  
      rows = get_gpts_by_uuids(uuids)
      for row in rows:
          gpts.append({
              "uuid": row.uuid,
              "name": row.name,
              "description": row.description,
              "avatar_url": row.avatar_url,
              "author_name": row.author_name,
              "created_at": row.created_at,
              "updated_at": row.updated_at,
              "visit_url": "https://chat.openai.com/g/" + row.short_url,
              "score": uuids_with_scores[row.uuid],
          })
  
      sorted_gpts = sorted(gpts, key=lambda x: x['score'], reverse=True)
      return sorted_gpts
      
  
  
apis: llama_index.VectorStoreIndex.from_documents llama_index.retrievers.VectorIndexRetriever
extract_api: [((248, 269), 'components.store.get_storage_context', 'get_storage_context', ([], {}), '()\n', (267, 269), False, 'from components.store import get_storage_context\n'), ((282, 350), 'llama_index.VectorStoreIndex.from_documents', 'VectorStoreIndex.from_documents', (['[]'], {'storage_context': 'storage_context'}), '([], storage_context=storage_context)\n', (313, 350), False, 'from llama_index import VectorStoreIndex\n'), ((368, 422), 'llama_index.retrievers.VectorIndexRetriever', 'VectorIndexRetriever', ([], {'index': 'index', 'similarity_top_k': '(10)'}), '(index=index, similarity_top_k=10)\n', (388, 422), False, 'from llama_index.retrievers import VectorIndexRetriever\n'), ((799, 823), 'models.gpts.get_gpts_by_uuids', 'get_gpts_by_uuids', (['uuids'], {}), '(uuids)\n', (816, 823), False, 'from models.gpts import get_gpts_by_uuids\n')]