Search documentation of Ragex

# Ragex.Embeddings.Helper (Ragex v0.4.0)

View Source

Helper functions to generate and store embeddings for analyzed code entities.

This module bridges the gap between code analyzers and the embedding system, automatically generating embeddings for modules, functions, and other entities.

## Summary

### Functions

generate_and_store_embeddings(analysis_result)

Generates and stores embeddings for all entities in an analysis result.

generate_batch_embeddings(entities, entity_type)

Generates embeddings for a batch of entities efficiently.

generate_function_embedding(function_data)

Generates and stores an embedding for a single function.

generate_module_embedding(module_data)

Generates and stores an embedding for a single module.

ready?()

Checks if the embedding system is available and ready.

## Functions

# generate_and_store_embeddings(analysis_result)

Generates and stores embeddings for all entities in an analysis result.

Takes the output from an analyzer and generates embeddings for:

- Modules
- Functions

Returns `:ok` if embeddings were generated, or `{:error, reason}` if the model is not ready or embedding generation fails.

# generate_batch_embeddings(entities, entity_type)

Generates embeddings for a batch of entities efficiently.

Uses batch embedding to process multiple entities at once for better performance.

# generate_function_embedding(function_data)

Generates and stores an embedding for a single function.

# generate_module_embedding(module_data)

Generates and stores an embedding for a single module.

# ready?()

Checks if the embedding system is available and ready.