Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

elizaos-plugin-knowledge

Knowledge and RAG (Retrieval Augmented Generation) plugin for elizaOS.

This plugin provides document processing, embedding generation, and semantic search capabilities for elizaOS agents.

Features

  • Document Processing: Extract text from PDF, DOCX, Markdown, and plain text files
  • Text Chunking: Split documents into semantic chunks with configurable overlap
  • Embedding Generation: Generate embeddings using OpenAI, Google, or Anthropic providers
  • Semantic Search: Find relevant knowledge based on query similarity
  • Contextual Retrieval: Optionally enrich chunks with contextual information

Installation

pip install elizaos-plugin-knowledge

Optional Dependencies

# For OpenAI embedding support
pip install elizaos-plugin-knowledge[openai]

# For Anthropic support
pip install elizaos-plugin-knowledge[anthropic]

# For Google AI support
pip install elizaos-plugin-knowledge[google]

# For PDF processing
pip install elizaos-plugin-knowledge[pdf]

# For DOCX processing
pip install elizaos-plugin-knowledge[docx]

# Install all optional dependencies
pip install elizaos-plugin-knowledge[all]

Usage

Basic Usage

from elizaos_plugin_knowledge import KnowledgeService, KnowledgeConfig

# Create configuration
config = KnowledgeConfig(
    embedding_provider="openai",
    embedding_model="text-embedding-3-small",
    embedding_dimension=1536,
)

# Initialize service
service = KnowledgeService(config)

# Add knowledge from text
await service.add_knowledge(
    content="The capital of France is Paris.",
    content_type="text/plain",
    filename="facts.txt",
)

# Search for knowledge
results = await service.search("What is the capital of France?")
for result in results:
    print(f"Score: {result.similarity:.2f} - {result.content}")

With elizaOS Runtime

from elizaos import Plugin
from elizaos_plugin_knowledge import create_knowledge_plugin

# Create the plugin
plugin = create_knowledge_plugin()

# Register with runtime
runtime.register_plugin(plugin)

Configuration

Parameter Type Default Description
embedding_provider str "openai" Provider for embeddings (openai, google)
embedding_model str "text-embedding-3-small" Model name for embeddings
embedding_dimension int 1536 Embedding vector dimension
ctx_knowledge_enabled bool False Enable contextual enrichment
text_provider str None Provider for text generation
text_model str None Model for text generation
chunk_size int 500 Target tokens per chunk
chunk_overlap int 100 Overlap tokens between chunks

API Reference

KnowledgeService

The main service class for knowledge management.

Methods

  • add_knowledge(content, content_type, filename, metadata) - Add a document to the knowledge base
  • search(query, count, threshold) - Search for relevant knowledge
  • get_knowledge(message) - Get knowledge relevant to a message
  • delete_knowledge(knowledge_id) - Delete a knowledge item

KnowledgeProvider

Provider that supplies knowledge context to agent prompts.

License

MIT License - see LICENSE file for details.

Metadata

Release files for elizaos-plugin-knowledge 2.0.0a5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for elizaos-plugin-knowledge 2.0.0a5
File Size Uploaded
elizaos_plugin_knowledge-2.0.0a5.tar.gz 23.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for elizaos-plugin-knowledge 2.0.0a5
File Interpreter ABI Platform
elizaos_plugin_knowledge-2.0.0a5-py3-none-any.whl Python 3 none any Details

Total release size: 44.6 kB

Release files / elizaos_plugin_knowledge-2.0.0a5.tar.gz

Download URL elizaos_plugin_knowledge-2.0.0a5.tar.gz
Size 23.8 kB
Tags Source
SHA-256 checksum
How to use checksums
2954be842e26d8581b003d870c66260d9452dffdb81fe78459c3e6cbe085815a
BLAKE2b-256 checksum
How to use checksums
55361ed8c2804e1967c75ce6ac0e00f33756055c5147d0b3d250c69af314848f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Release files / elizaos_plugin_knowledge-2.0.0a5-py3-none-any.whl

Download URL elizaos_plugin_knowledge-2.0.0a5-py3-none-any.whl
Size 20.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
db7c324abf06b706f8ff2d19a22e2d311d264755723c1ebad6f951b342be67f5
BLAKE2b-256 checksum
How to use checksums
93af1112c350a35fce505949a96a86e04eb8c7465d7be163869dec5f1b6edf11
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.10

Release history Release notifications | RSS feed

This release

2.0.0a5 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page