class_docstr: Stores data in-memory. It's ephemeral and cannot be saved to disk.
docstr: Computes the similarity scores between the query embedding and the embeddings of the documents.
  
  :param embedding: Embedding of the query.
  :param documents: A list of Documents.
  :param scale_score: Whether to scale the scores of the Documents. Default is False.
  :return: A list of scores.
docstr_tok: ["Computes","the","similarity","scores","between","the","query","embedding","and","the","embeddings","of","the","documents",".",":","param","embedding",":","Embedding","of","the","query",".",":","param","documents",":","A","list","of","Documents",".",":","param","scale_score",":","Whether","to","scale","the","scores","of","the","Documents",".","Default","is","False",".",":","return",":","A","list","of","scores","."]
code: def _compute_query_embedding_similarity_scores(
      self,
      embedding: List[float],
      documents: List[Document],
      scale_score: bool = False,
  ) -> List[float]:
      """
      Computes the similarity scores between the query embedding and the embeddings of the documents.
  
      :param embedding: Embedding of the query.
      :param documents: A list of Documents.
      :param scale_score: Whether to scale the scores of the Documents. Default is False.
      :return: A list of scores.
      """
  
      query_embedding = np.array(embedding)
      if query_embedding.ndim == 1:
          query_embedding = np.expand_dims(a=query_embedding, axis=0)
  
      try:
          document_embeddings = np.array(
              [doc.embedding for doc in documents]
          )
      except ValueError as e:
          if "inhomogeneous shape" in str(e):
              raise DocumentStoreError(
                  "The embedding size of all Documents should be the same. "
                  "Please make sure that the Documents have been embedded with the same model."
              ) from e
          raise e
      if document_embeddings.ndim == 1:
          document_embeddings = np.expand_dims(
              a=document_embeddings, axis=0
          )
  
      if self.embedding_similarity_function == "cosine":
          # cosine similarity is a normed dot product
          query_embedding /= np.linalg.norm(
              x=query_embedding, axis=1, keepdims=True
          )
          document_embeddings /= np.linalg.norm(
              x=document_embeddings, axis=1, keepdims=True
          )
  
      try:
          scores = np.dot(a=query_embedding, b=document_embeddings.T)[
              0
          ].tolist()
      except ValueError as e:
          if "shapes" in str(e) and "not aligned" in str(e):
              raise DocumentStoreError(
                  "The embedding size of the query should be the same as the embedding size of the Documents. "
                  "Please make sure that the query has been embedded with the same model as the Documents."
              ) from e
          raise e
  
      if scale_score:
          if self.embedding_similarity_function == "dot_product":
              scores = [
                  expit(float(score / DOT_PRODUCT_SCALING_FACTOR))
                  for score in scores
              ]
          elif self.embedding_similarity_function == "cosine":
              scores = [(score + 1) / 2 for score in scores]
  
      return scores
  
imports: import re
  from typing import Literal, Any, Dict, List, Optional, Iterable
  import logging
  import numpy
  from haystack_bm25 import rank_bm25
  from tqdm.auto import tqdm
  from haystack import default_from_dict, default_to_dict
  from haystack.dataclasses import Document
  from haystack.document_stores.types import DuplicatePolicy
  from haystack.utils.filters import document_matches_filter, convert
  from haystack.document_stores.errors import DuplicateDocumentError, DocumentStoreError
  from haystack.utils import expit
label_desc: Use image node_id 10 for calling the InMemoryDocumentStore obj's underlying member method code with example usage: obj._compute_query_embedding_similarity_scores(embedding, documents, scale_score) and returns: scores