create_index#

langchain_community.retrievers.knn.create_index(contexts: List[str], embeddings: Embeddings) ndarray[source]#

Create an index of embeddings for a list of contexts.

Parameters:
  • contexts (List[str]) – List of contexts to embed.

  • embeddings (Embeddings) – Embeddings model to use.

Returns:

Index of embeddings.

Return type:

ndarray