Skip to main content

elizaOS Local Embedding Plugin - Local text embedding and tokenization

Project description

Local AI Plugin

This plugin provides local AI model capabilities through the elizaOS platform, supporting text generation, image analysis, speech synthesis, and audio transcription.

Usage

Add the plugin to your character configuration:

"plugins": ["@elizaos-plugins/plugin-local-ai"]

Configuration

The plugin is configured using environment variables (typically set in a .env file or via your deployment settings):

Or in .env file:

# Optional: Specify a custom directory for models (GGUF files)
# MODELS_DIR=/path/to/your/models

# Optional: Specify a custom directory for caching other components (tokenizers, etc.)
# CACHE_DIR=/path/to/your/cache

# Optional: Specify filenames for the text generation and embedding models within the models directory
# LOCAL_SMALL_MODEL=my-custom-small-model.gguf
# LOCAL_LARGE_MODEL=my-custom-large-model.gguf
# LOCAL_EMBEDDING_MODEL=my-custom-embedding-model.gguf

# Optional: Fallback dimension size for embeddings if generation fails. Defaults to the model's default (e.g., 384).
# LOCAL_EMBEDDING_DIMENSIONS=384

Configuration Options

  • MODELS_DIR (Optional): Specifies a custom directory for storing model files (GGUF format). If not set, defaults to ~/.eliza/models.
  • CACHE_DIR (Optional): Specifies a custom directory for caching other components like tokenizers. If not set, defaults to ~/.eliza/cache.
  • LOCAL_SMALL_MODEL (Optional): Specifies the filename for the small text generation model (e.g., DeepHermes-3-Llama-3-3B-Preview-q4.gguf) located in the models directory.
  • LOCAL_LARGE_MODEL (Optional): Specifies the filename for the large text generation model (e.g., DeepHermes-3-Llama-3-8B-q4.gguf) located in the models directory.
  • LOCAL_EMBEDDING_MODEL (Optional): Specifies the filename for the text embedding model (e.g., bge-small-en-v1.5.Q4_K_M.gguf) located in the models directory.
  • LOCAL_EMBEDDING_DIMENSIONS (Optional): Defines the expected dimension size for text embeddings. This is primarily used as a fallback dimension if the embedding model fails to generate an embedding. If not set, it defaults to the embedding model's native dimension size (e.g., 384 for bge-small-en-v1.5.Q4_K_M.gguf).

Features

The plugin provides these model classes:

  • TEXT_SMALL: Fast, efficient text generation using smaller models
  • TEXT_LARGE: More capable text generation using larger models
  • TEXT_EMBEDDING: Generates text embeddings locally.
  • IMAGE_DESCRIPTION: Local image analysis using Florence-2 vision model
  • TEXT_TO_SPEECH: Local text-to-speech synthesis
  • TRANSCRIPTION: Local audio transcription using Whisper

Text Generation

// Using small model
const smallResponse = await runtime.useModel(ModelType.TEXT_SMALL, {
  prompt: 'Generate a short response',
  stopSequences: [],
});

// Using large model
const largeResponse = await runtime.useModel(ModelType.TEXT_LARGE, {
  prompt: 'Generate a detailed response',
  stopSequences: [],
});

Text Embedding

const embedding = await runtime.useModel(ModelType.TEXT_EMBEDDING, {
  text: 'Text to get embedding for',
});

Image Analysis

const { title, description } = await runtime.useModel(
  ModelType.IMAGE_DESCRIPTION,
  'https://example.com/image.jpg'
);

Text-to-Speech

const audioStream = await runtime.useModel(ModelType.TEXT_TO_SPEECH, 'Text to convert to speech');

Audio Transcription

const transcription = await runtime.useModel(ModelType.TRANSCRIPTION, audioBuffer);

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

elizaos_plugin_local_embedding-2.0.0a5.tar.gz (9.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file elizaos_plugin_local_embedding-2.0.0a5.tar.gz.

File metadata

File hashes

Hashes for elizaos_plugin_local_embedding-2.0.0a5.tar.gz
Algorithm Hash digest
SHA256 43a65ab1a27713d3d0c99462bf1d6bbe7ffce57c1e73c99ebb7fb4e0c7a203d9
MD5 0116148f47f1b13fb191a84d18bc0745
BLAKE2b-256 e11a0f3a5410dc4b5d1f61e28e038590f2bb4b36c709af6cf6412a19e4420185

See more details on using hashes here.

File details

Details for the file elizaos_plugin_local_embedding-2.0.0a5-py3-none-any.whl.

File metadata

File hashes

Hashes for elizaos_plugin_local_embedding-2.0.0a5-py3-none-any.whl
Algorithm Hash digest
SHA256 bbed1d7c07e4cced993190785762472ca64f87003a827cef73775f8075d1f0fd
MD5 1973e1f2d485df3a6079b8e5463d8034
BLAKE2b-256 4a6c30f80a6dbf05d1a3f5f994b9805b32a5eb5e4eda8f9d9c8c16c0e1034e18

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page