Rename embedchain to mem0 and open sourcing code for long term memory (#1474)

Co-authored-by: Deshraj Yadav <deshrajdry@gmail.com>
This commit is contained in:
Taranjeet Singh
2024-07-12 07:51:33 -07:00
committed by GitHub
parent 83e8c97295
commit f842a92e25
665 changed files with 9427 additions and 6592 deletions

View File

@@ -0,0 +1,22 @@
---
title: 'Overview'
description: 'Deploy your RAG application to production'
---
After successfully setting up and testing your RAG app locally, the next step is to deploy it to a hosting service to make it accessible to a wider audience. Embedchain provides integration with different cloud providers so that you can seamlessly deploy your RAG applications to production without having to worry about going through the cloud provider instructions. Embedchain does all the heavy lifting for you.
<CardGroup cols={4}>
<Card title="Fly.io" href="/deployment/fly_io"></Card>
<Card title="Modal.com" href="/deployment/modal_com"></Card>
<Card title="Render.com" href="/deployment/render_com"></Card>
<Card title="Railway.app" href="/deployment/railway"></Card>
<Card title="Streamlit.io" href="/deployment/streamlit_io"></Card>
<Card title="Gradio.app" href="/deployment/gradio_app"></Card>
<Card title="Huggingface.co" href="/deployment/huggingface_spaces"></Card>
</CardGroup>
## Seeking help?
If you run into issues with deployment, please feel free to reach out to us via any of the following methods:
<Snippet file="get-help.mdx" />

View File

@@ -0,0 +1,191 @@
---
title: ❓ FAQs
description: 'Collections of all the frequently asked questions'
---
<AccordionGroup>
<Accordion title="Does Embedchain support OpenAI's Assistant APIs?">
Yes, it does. Please refer to the [OpenAI Assistant docs page](/examples/openai-assistant).
</Accordion>
<Accordion title="How to use MistralAI language model?">
Use the model provided on huggingface: `mistralai/Mistral-7B-v0.1`
<CodeGroup>
```python main.py
import os
from embedchain import App
os.environ["HUGGINGFACE_ACCESS_TOKEN"] = "hf_your_token"
app = App.from_config("huggingface.yaml")
```
```yaml huggingface.yaml
llm:
provider: huggingface
config:
model: 'mistralai/Mistral-7B-v0.1'
temperature: 0.5
max_tokens: 1000
top_p: 0.5
stream: false
embedder:
provider: huggingface
config:
model: 'sentence-transformers/all-mpnet-base-v2'
```
</CodeGroup>
</Accordion>
<Accordion title="How to use ChatGPT 4 turbo model released on OpenAI DevDay?">
Use the model `gpt-4-turbo` provided my openai.
<CodeGroup>
```python main.py
import os
from embedchain import App
os.environ['OPENAI_API_KEY'] = 'xxx'
# load llm configuration from gpt4_turbo.yaml file
app = App.from_config(config_path="gpt4_turbo.yaml")
```
```yaml gpt4_turbo.yaml
llm:
provider: openai
config:
model: 'gpt-4-turbo'
temperature: 0.5
max_tokens: 1000
top_p: 1
stream: false
```
</CodeGroup>
</Accordion>
<Accordion title="How to use GPT-4 as the LLM model?">
<CodeGroup>
```python main.py
import os
from embedchain import App
os.environ['OPENAI_API_KEY'] = 'xxx'
# load llm configuration from gpt4.yaml file
app = App.from_config(config_path="gpt4.yaml")
```
```yaml gpt4.yaml
llm:
provider: openai
config:
model: 'gpt-4'
temperature: 0.5
max_tokens: 1000
top_p: 1
stream: false
```
</CodeGroup>
</Accordion>
<Accordion title="I don't have OpenAI credits. How can I use some open source model?">
<CodeGroup>
```python main.py
from embedchain import App
# load llm configuration from opensource.yaml file
app = App.from_config(config_path="opensource.yaml")
```
```yaml opensource.yaml
llm:
provider: gpt4all
config:
model: 'orca-mini-3b-gguf2-q4_0.gguf'
temperature: 0.5
max_tokens: 1000
top_p: 1
stream: false
embedder:
provider: gpt4all
config:
model: 'all-MiniLM-L6-v2'
```
</CodeGroup>
</Accordion>
<Accordion title="How to stream response while using OpenAI model in Embedchain?">
You can achieve this by setting `stream` to `true` in the config file.
<CodeGroup>
```yaml openai.yaml
llm:
provider: openai
config:
model: 'gpt-3.5-turbo'
temperature: 0.5
max_tokens: 1000
top_p: 1
stream: true
```
```python main.py
import os
from embedchain import App
os.environ['OPENAI_API_KEY'] = 'sk-xxx'
app = App.from_config(config_path="openai.yaml")
app.add("https://www.forbes.com/profile/elon-musk")
response = app.query("What is the net worth of Elon Musk?")
# response will be streamed in stdout as it is generated.
```
</CodeGroup>
</Accordion>
<Accordion title="How to persist data across multiple app sessions?">
Set up the app by adding an `id` in the config file. This keeps the data for future use. You can include this `id` in the yaml config or input it directly in `config` dict.
```python app1.py
import os
from embedchain import App
os.environ['OPENAI_API_KEY'] = 'sk-xxx'
app1 = App.from_config(config={
"app": {
"config": {
"id": "your-app-id",
}
}
})
app1.add("https://www.forbes.com/profile/elon-musk")
response = app1.query("What is the net worth of Elon Musk?")
```
```python app2.py
import os
from embedchain import App
os.environ['OPENAI_API_KEY'] = 'sk-xxx'
app2 = App.from_config(config={
"app": {
"config": {
# this will persist and load data from app1 session
"id": "your-app-id",
}
}
})
response = app2.query("What is the net worth of Elon Musk?")
```
</Accordion>
</AccordionGroup>
#### Still have questions?
If docs aren't sufficient, please feel free to reach out to us using one of the following methods:
<Snippet file="get-help.mdx" />

View File

@@ -0,0 +1,81 @@
---
title: '💻 Full stack'
---
Get started with full-stack RAG applications using Embedchain's easy-to-use CLI tool. Set up everything with just a few commands, whether you prefer Docker or not.
## Prerequisites
Choose your setup method:
* [Without docker](#without-docker)
* [With Docker](#with-docker)
### Without Docker
Ensure these are installed:
- Embedchain python package (`pip install embedchain`)
- [Node.js](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm) and [Yarn](https://classic.yarnpkg.com/lang/en/docs/install/)
### With Docker
Install Docker from [Docker's official website](https://docs.docker.com/engine/install/).
## Quick Start Guide
### Install the package
Before proceeding, make sure you have the Embedchain package installed.
```bash
pip install embedchain -U
```
### Setting Up
For the purpose of the demo, you have to set `OPENAI_API_KEY` to start with but you can choose any llm by changing the configuration easily.
### Installation Commands
<CodeGroup>
```bash without docker
ec create-app my-app
cd my-app
ec start
```
```bash with docker
ec create-app my-app --docker
cd my-app
ec start --docker
```
</CodeGroup>
### What Happens Next?
1. Embedchain fetches a full stack template (FastAPI backend, Next.JS frontend).
2. Installs required components.
3. Launches both frontend and backend servers.
### See It In Action
Open http://localhost:3000 to view the chat UI.
![full stack example](/images/fullstack.png)
### Admin Panel
Check out the Embedchain admin panel to see the document chunks for your RAG application.
![full stack chunks](/images/fullstack-chunks.png)
### API Server
If you want to access the API server, you can do so at http://localhost:8000/docs.
![API Server](/images/fullstack-api-server.png)
You can customize the UI and code as per your requirements.

View File

@@ -0,0 +1,66 @@
---
title: 📚 Introduction
---
## What is Embedchain?
Embedchain is an Open Source Framework that makes it easy to create and deploy personalized AI apps. At its core, Embedchain follows the design principle of being *"Conventional but Configurable"* to serve both software engineers and machine learning engineers.
Embedchain streamlines the creation of personalized LLM applications, offering a seamless process for managing various types of unstructured data. It efficiently segments data into manageable chunks, generates relevant embeddings, and stores them in a vector database for optimized retrieval. With a suite of diverse APIs, it enables users to extract contextual information, find precise answers, or engage in interactive chat conversations, all tailored to their own data.
## Who is Embedchain for?
Embedchain is designed for a diverse range of users, from AI professionals like Data Scientists and Machine Learning Engineers to those just starting their AI journey, including college students, independent developers, and hobbyists. Essentially, it's for anyone with an interest in AI, regardless of their expertise level.
Our APIs are user-friendly yet adaptable, enabling beginners to effortlessly create LLM-powered applications with as few as 4 lines of code. At the same time, we offer extensive customization options for every aspect of building a personalized AI application. This includes the choice of LLMs, vector databases, loaders and chunkers, retrieval strategies, re-ranking, and more.
Our platform's clear and well-structured abstraction layers ensure that users can tailor the system to meet their specific needs, whether they're crafting a simple project or a complex, nuanced AI application.
## Why Use Embedchain?
Developing a personalized AI application for production use presents numerous complexities, such as:
- Integrating and indexing data from diverse sources.
- Determining optimal data chunking methods for each source.
- Synchronizing the RAG pipeline with regularly updated data sources.
- Implementing efficient data storage in a vector store.
- Deciding whether to include metadata with document chunks.
- Handling permission management.
- Configuring Large Language Models (LLMs).
- Selecting effective prompts.
- Choosing suitable retrieval strategies.
- Assessing the performance of your RAG pipeline.
- Deploying the pipeline into a production environment, among other concerns.
Embedchain is designed to simplify these tasks, offering conventional yet customizable APIs. Our solution handles the intricate processes of loading, chunking, indexing, and retrieving data. This enables you to concentrate on aspects that are crucial for your specific use case or business objectives, ensuring a smoother and more focused development process.
## How it works?
Embedchain makes it easy to add data to your RAG pipeline with these straightforward steps:
1. **Automatic Data Handling**: It automatically recognizes the data type and loads it.
2. **Efficient Data Processing**: The system creates embeddings for key parts of your data.
3. **Flexible Data Storage**: You get to choose where to store this processed data in a vector database.
When a user asks a question, whether for chatting, searching, or querying, Embedchain simplifies the response process:
1. **Query Processing**: It turns the user's question into embeddings.
2. **Document Retrieval**: These embeddings are then used to find related documents in the database.
3. **Answer Generation**: The related documents are used by the LLM to craft a precise answer.
With Embedchain, you dont have to worry about the complexities of building a personalized AI application. It offers an easy-to-use interface for developing applications with any kind of data.
## Getting started
Checkout our [quickstart guide](/get-started/quickstart) to start your first AI application.
## Support
Feel free to reach out to us if you have ideas, feedback or questions that we can help out with.
<Snippet file="get-help.mdx" />
## Contribute
- [GitHub](https://github.com/embedchain/embedchain)
- [Contribution docs](/contribution/dev)

View File

@@ -0,0 +1,89 @@
---
title: '⚡ Quickstart'
description: '💡 Create an AI app on your own data in a minute'
---
## Installation
First install the Python package:
```bash
pip install embedchain
```
Once you have installed the package, depending upon your preference you can either use:
<CardGroup cols={2}>
<Card title="Open Source Models" icon="osi" href="#open-source-models">
This includes Open source LLMs like Mistral, Llama, etc.<br/>
Free to use, and runs locally on your machine.
</Card>
<Card title="Paid Models" icon="dollar-sign" href="#paid-models" color="#4A154B">
This includes paid LLMs like GPT 4, Claude, etc.<br/>
Cost money and are accessible via an API.
</Card>
</CardGroup>
## Open Source Models
This section gives a quickstart example of using Mistral as the Open source LLM and Sentence transformers as the Open source embedding model. These models are free and run mostly on your local machine.
We are using Mistral hosted at Hugging Face, so will you need a Hugging Face token to run this example. Its *free* and you can create one [here](https://huggingface.co/docs/hub/security-tokens).
<CodeGroup>
```python huggingface_demo.py
import os
# Replace this with your HF token
os.environ["HUGGINGFACE_ACCESS_TOKEN"] = "hf_xxxx"
from embedchain import App
config = {
'llm': {
'provider': 'huggingface',
'config': {
'model': 'mistralai/Mistral-7B-Instruct-v0.2',
'top_p': 0.5
}
},
'embedder': {
'provider': 'huggingface',
'config': {
'model': 'sentence-transformers/all-mpnet-base-v2'
}
}
}
app = App.from_config(config=config)
app.add("https://www.forbes.com/profile/elon-musk")
app.add("https://en.wikipedia.org/wiki/Elon_Musk")
app.query("What is the net worth of Elon Musk today?")
# Answer: The net worth of Elon Musk today is $258.7 billion.
```
</CodeGroup>
## Paid Models
In this section, we will use both LLM and embedding model from OpenAI.
```python openai_demo.py
import os
from embedchain import App
# Replace this with your OpenAI key
os.environ["OPENAI_API_KEY"] = "sk-xxxx"
app = App()
app.add("https://www.forbes.com/profile/elon-musk")
app.add("https://en.wikipedia.org/wiki/Elon_Musk")
app.query("What is the net worth of Elon Musk today?")
# Answer: The net worth of Elon Musk today is $258.7 billion.
```
# Next Steps
Now that you have created your first app, you can follow any of the links:
* [Introduction](/get-started/introduction)
* [Customization](/components/introduction)
* [Use cases](/use-cases/introduction)
* [Deployment](/get-started/deployment)