Embedchain

0.1.128 · active · verified Mon Apr 13

Embedchain is an open-source Retrieval Augmented Generation (RAG) framework designed to simplify the creation and deployment of personalized AI applications. It handles the complex process of loading, chunking, embedding, and storing various types of unstructured data into a vector database for efficient retrieval. The library is actively maintained, currently at version 0.1.128, with frequent updates indicative of its pre-1.0 release phase.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to create an Embedchain application, add web page data, and query it. By default, Embedchain uses OpenAI's models, requiring the `OPENAI_API_KEY` to be set as an environment variable.

import os
from embedchain import App

# Ensure your OpenAI API key is set as an environment variable
# Or replace os.environ.get with your actual key for testing.
# For production, always use environment variables.
os.environ["OPENAI_API_KEY"] = os.environ.get("OPENAI_API_KEY", "sk-YOUR_OPENAI_KEY")

# Create an Embedchain app instance
app = App()

# Add data sources (e.g., URLs, PDFs, YouTube videos, local files)
app.add("https://en.wikipedia.org/wiki/Elon_Musk")
app.add("https://www.forbes.com/profile/elon-musk")

# Query the app
response = app.query("How many companies does Elon Musk run and name those?")
print(response)

# You can also use the chat interface for conversational queries
# app.chat("Tell me more about Tesla.")

view raw JSON →