Aller directement au contenu principal

openhands.utils.embeddings

check_llama_index

def check_llama_index()

Utility function to check the availability of llama_index.

Raises:

  • ImportError - If llama_index is not available.

EmbeddingsLoader Objects

class EmbeddingsLoader()

Loader for embedding model initialization.

get_embedding_model

@staticmethod
def get_embedding_model(strategy: str,
llm_config: LLMConfig) -> 'BaseEmbedding'

Initialize and return the appropriate embedding model based on the strategy.

Arguments:

  • strategy: The embedding strategy to use.
  • llm_config: Configuration for the LLM.

Returns:

  • An instance of the selected embedding model or None.

run_pipeline

def run_pipeline(embed_model: 'BaseEmbedding', documents: list['Document'],
num_workers: int) -> list['TextNode']

Run a pipeline embedding documents.

insert_batch_docs

def insert_batch_docs(index: 'VectorStoreIndex', documents: list['Document'],
num_workers: int) -> list['TextNode']

Run the document indexing in parallel.