Compare commits
97 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 050706e95e | |||
| 6d2389de1c | |||
| dd97fad5a4 | |||
| 0f73ba9677 | |||
| 210fe9bb80 | |||
| ec8549d0e1 | |||
| b77d9d750f | |||
| a10823d309 | |||
| 3a09c2bd62 | |||
| a1394ce32e | |||
| 1020a4121f | |||
| 737837ae0b | |||
| 7ee2d0653b | |||
| 43926fb527 | |||
| 7bcc9e35dd | |||
| 6437661837 | |||
| b5f84f27ff | |||
| 48c38b5dc3 | |||
| b4f3bbbbc9 | |||
| 3cd50c4cd9 | |||
| cd2c40a9c4 | |||
| 33dcfe42b5 | |||
| db37b2ac15 | |||
| bee4e834b1 | |||
| 0272459435 | |||
| c0b5e93967 | |||
| 6983ebba49 | |||
| 9943d1e015 | |||
| b348251484 | |||
| e719b5bac3 | |||
| 54f43215cd | |||
| b246d9823e | |||
| 65c8dd445b | |||
| 0efbc80ac9 | |||
| 151746beec | |||
| c0ee680546 | |||
| 9303a1bf81 | |||
| d54cdc5b00 | |||
| b7a44ef472 | |||
| ae6f866901 | |||
| 7910cee259 | |||
| d66e647f99 | |||
| ff4a333be7 | |||
| 111749a95d | |||
| adde398b65 | |||
| d8897ce356 | |||
| 0ea8ab228c | |||
| d62a23edf6 | |||
| 51ebf3439b | |||
| 4a5ed1dd8d | |||
| e84b5034ea | |||
| a4831d6ed9 | |||
| 51b4966801 | |||
| 1d4e00ccef | |||
| c9fbc2e7d6 | |||
| fa34788df6 | |||
| 0f4f220119 | |||
| 512cfc9466 | |||
| 541b1cb7c7 | |||
| 36af1a7615 | |||
| b02e8feeda | |||
| 406c46e7f4 | |||
| e35eaf1bfc | |||
| 38426a7af1 | |||
| 141a23fb1e | |||
| bb28569abf | |||
| 1df46b2bb3 | |||
| 58f72e1ffe | |||
| 33409140b4 | |||
| f6b80e01a1 | |||
| 798d3fcc5a | |||
| 85f3ac428b | |||
| 9fcf2130b5 | |||
| 51df00729e | |||
| 023a61446f | |||
| e0b73e6a5a | |||
| 28460f725c | |||
| c93e49d2b8 | |||
| 07fb6bee54 | |||
| 3fa7db8420 | |||
| c14bd7b73b | |||
| 5201beaab0 | |||
| 122313d8a5 | |||
| 82fd595306 | |||
| 95c0d47236 | |||
| 919cc74e94 | |||
| d839991acb | |||
| 539286aafd | |||
| 23522b7b55 | |||
| bf3fac56e4 | |||
| a5bf8e9075 | |||
| 1d31b8f7e4 | |||
| b144c7dccc | |||
| 1364975396 | |||
| deaa7f50f8 | |||
| 744ab5156f | |||
| c45413969a |
@@ -3,7 +3,15 @@ name: ci
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
paths:
|
||||
- 'embedchain/**'
|
||||
- 'tests/**'
|
||||
- 'examples/**'
|
||||
pull_request:
|
||||
paths:
|
||||
- 'embedchain/**'
|
||||
- 'tests/**'
|
||||
- 'examples/**'
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
@@ -37,6 +37,7 @@ clean:
|
||||
lint:
|
||||
poetry run ruff .
|
||||
|
||||
# for example: make test file=tests/test_factory.py
|
||||
test:
|
||||
poetry run pytest $(file)
|
||||
|
||||
|
||||
@@ -10,6 +10,9 @@
|
||||
<a href="https://pypi.org/project/embedchain/">
|
||||
<img src="https://img.shields.io/pypi/v/embedchain" alt="PyPI">
|
||||
</a>
|
||||
<a href="https://pepy.tech/project/embedchain">
|
||||
<img src="https://static.pepy.tech/badge/embedchain" alt="Downloads">
|
||||
</a>
|
||||
<a href="https://join.slack.com/t/embedchain/shared_invite/zt-22uwz3c46-Zg7cIh5rOBteT_xe1jwLDw">
|
||||
<img src="https://img.shields.io/badge/slack-embedchain-brightgreen.svg?logo=slack" alt="Slack">
|
||||
</a>
|
||||
@@ -19,9 +22,6 @@
|
||||
<a href="https://twitter.com/embedchain">
|
||||
<img src="https://img.shields.io/twitter/follow/embedchain" alt="Twitter">
|
||||
</a>
|
||||
<a href="https://embedchain.substack.com/">
|
||||
<img src="https://img.shields.io/badge/Substack-%23006f5c.svg?logo=substack" alt="Substack">
|
||||
</a>
|
||||
<a href="https://colab.research.google.com/drive/138lMWhENGeEu7Q1-6lNbNTHGLZXBBz_B?usp=sharing">
|
||||
<img src="https://camo.githubusercontent.com/84f0493939e0c4de4e6dbe113251b4bfb5353e57134ffd9fcab6b8714514d4d1/68747470733a2f2f636f6c61622e72657365617263682e676f6f676c652e636f6d2f6173736574732f636f6c61622d62616467652e737667" alt="Open in Colab">
|
||||
</a>
|
||||
@@ -32,25 +32,22 @@
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
> ### Checkout our latest [Sadhguru AI app](https://sadhguru-ai.streamlit.app/) built using Embedchain.
|
||||
|
||||
## What is Embedchain?
|
||||
Embedchain is a Data Platform for Large Language Models (LLMs). Seamlessly load, index, retrieve, and sync unstructured data to build dynamic, LLM-powered applications. Check out [embedchain-js](https://github.com/embedchain/embedchain/tree/main/embedchain-js) for a JavaScript implementation.
|
||||
|
||||
Embedchain is an Open Source RAG Framework that makes it easy to create and deploy 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 RAG 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.
|
||||
|
||||
## 🔧 Quick install
|
||||
|
||||
### Python API
|
||||
```bash
|
||||
pip install --upgrade embedchain
|
||||
pip install embedchain
|
||||
```
|
||||
|
||||
### REST API
|
||||
You can also run Embedchain as a REST API server using the following command:
|
||||
|
||||
```bash
|
||||
docker run --name embedchain -p 8080:8080 embedchain/rest-api:latest
|
||||
```
|
||||
|
||||
Then, navigate to http://0.0.0.0:8080/docs to interact with the API.
|
||||
|
||||
## 🔍 Usage and Demo
|
||||
|
||||
<!-- Demo GIF or Image -->
|
||||
@@ -71,22 +68,10 @@ elon_bot = App()
|
||||
# Embed online resources
|
||||
elon_bot.add("https://en.wikipedia.org/wiki/Elon_Musk")
|
||||
elon_bot.add("https://www.forbes.com/profile/elon-musk")
|
||||
elon_bot.add("https://www.youtube.com/watch?v=RcYjXbSJBN8")
|
||||
|
||||
# Query the bot
|
||||
elon_bot.query("How many companies does Elon Musk run and name those?")
|
||||
# Answer: Elon Musk currently runs several companies. As of my knowledge, he is the CEO and lead designer of SpaceX, the CEO and product architect of Tesla, Inc., the CEO and founder of Neuralink, and the CEO and founder of The Boring Company. However, please note that this information may change over time, so it's always good to verify the latest updates.
|
||||
|
||||
# (Optional): Deploy app to Embedchain Platform
|
||||
app.deploy()
|
||||
# 🔑 Enter your Embedchain API key. You can find the API key at https://app.embedchain.ai/settings/keys/
|
||||
# ec-xxxxxx
|
||||
|
||||
# 🛠️ Creating pipeline on the platform...
|
||||
# 🎉🎉🎉 Pipeline created successfully! View your pipeline: https://app.embedchain.ai/pipelines/xxxxx
|
||||
|
||||
# 🛠️ Adding data to your pipeline...
|
||||
# ✅ Data of type: web_page, value: https://www.forbes.com/profile/elon-musk added successfully.
|
||||
```
|
||||
|
||||
You can also try it in your browser with Google Colab:
|
||||
@@ -96,18 +81,18 @@ You can also try it in your browser with Google Colab:
|
||||
## 📖 Documentation
|
||||
Comprehensive guides and API documentation are available to help you get the most out of Embedchain:
|
||||
|
||||
- [Getting Started](https://docs.embedchain.ai/get-started/quickstart)
|
||||
- [Introduction](https://docs.embedchain.ai/get-started/introduction#what-is-embedchain)
|
||||
- [Examples](https://docs.embedchain.ai/get-started/examples)
|
||||
- [Supported data types](https://docs.embedchain.ai/data-sources/)
|
||||
- [Getting Started](https://docs.embedchain.ai/get-started/quickstart)
|
||||
- [Examples](https://docs.embedchain.ai/examples)
|
||||
- [Supported data types](https://docs.embedchain.ai/components/data-sources/overview)
|
||||
|
||||
## 🔗 Join the Community
|
||||
|
||||
Connect with fellow developers and users by joining our [Slack Workspace](https://join.slack.com/t/embedchain/shared_invite/zt-22uwz3c46-Zg7cIh5rOBteT_xe1jwLDw). Dive into discussions, ask questions, and share your experiences.
|
||||
Connect with fellow developers and users by joining our [Slack Workspace](https://join.slack.com/t/embedchain/shared_invite/zt-22uwz3c46-Zg7cIh5rOBteT_xe1jwLDw) or [Discord Community](https://discord.gg/CUU9FPhRNt). Dive into discussions, ask questions, and share your experiences.
|
||||
|
||||
## 🤝 Schedule a 1-on-1 Session
|
||||
|
||||
Book a [1-on-1 Session](https://cal.com/taranjeetio/ec) with Taranjeet, the founder, to discuss any issues, provide feedback, or explore how we can improve Embedchain for you.
|
||||
Book a [1-on-1 Session](https://cal.com/taranjeetio/ec) with the founders, to discuss any issues, provide feedback, or explore how we can improve Embedchain for you.
|
||||
|
||||
## 🌐 Contributing
|
||||
|
||||
@@ -120,9 +105,9 @@ For more reference, please go through [Development Guide](https://docs.embedchai
|
||||
<img src="https://contrib.rocks/image?repo=embedchain/embedchain" />
|
||||
</a>
|
||||
|
||||
## Telemetry
|
||||
## Anonymous Telemetry
|
||||
|
||||
We collect anonymous usage metrics to enhance our package's quality and user experience. This includes data like feature usage frequency and system info, but never personal details. The data helps us prioritize improvements and ensure compatibility. If you wish to opt-out, set the `app.config.collect_metrics = False` in the code. We prioritize data security and don't share this data externally.
|
||||
We collect anonymous usage metrics to enhance our package's quality and user experience. This includes data like feature usage frequency and system info, but never personal details. The data helps us prioritize improvements and ensure compatibility. If you wish to opt-out, set the environment variable `EC_TELEMETRY=false`. We prioritize data security and don't share this data externally.
|
||||
|
||||
## Citation
|
||||
|
||||
|
||||
@@ -23,4 +23,3 @@ embedder:
|
||||
provider: openai
|
||||
config:
|
||||
model: 'text-embedding-ada-002'
|
||||
deployment_name: 'test-deployment'
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
llm:
|
||||
provider: google
|
||||
config:
|
||||
model: gemini-pro
|
||||
max_tokens: 1000
|
||||
temperature: 0.9
|
||||
top_p: 1.0
|
||||
stream: false
|
||||
|
||||
embedder:
|
||||
provider: google
|
||||
config:
|
||||
model: models/embedding-001
|
||||
@@ -0,0 +1,8 @@
|
||||
llm:
|
||||
provider: openai
|
||||
config:
|
||||
model: 'gpt-4'
|
||||
temperature: 0.5
|
||||
max_tokens: 1000
|
||||
top_p: 1
|
||||
stream: false
|
||||
@@ -0,0 +1,12 @@
|
||||
llm:
|
||||
provider: ollama
|
||||
config:
|
||||
model: 'llama2'
|
||||
temperature: 0.5
|
||||
top_p: 1
|
||||
stream: true
|
||||
|
||||
embedder:
|
||||
provider: huggingface
|
||||
config:
|
||||
model: 'BAAI/bge-small-en-v1.5'
|
||||
@@ -1,11 +1,11 @@
|
||||
<CardGroup cols={3}>
|
||||
<Card title="Talk to founders" icon="calendar" href="https://cal.com/taranjeetio/ec">
|
||||
Schedule a call
|
||||
</Card>
|
||||
<Card title="Slack" icon="slack" href="https://join.slack.com/t/embedchain/shared_invite/zt-22uwz3c46-Zg7cIh5rOBteT_xe1jwLDw" color="#4A154B">
|
||||
Join our slack community
|
||||
</Card>
|
||||
<Card title="Discord" icon="discord" href="https://discord.gg/6PzXDgEjG5" color="#7289DA">
|
||||
Join our discord community
|
||||
</Card>
|
||||
<Card title="Schedule a call" icon="calendar" href="https://cal.com/taranjeetio/ec">
|
||||
Schedule a call with Embedchain founder
|
||||
</Card>
|
||||
</CardGroup>
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
<p>If you can't find the specific data source, please feel free to request through one of the following channels and help us prioritize.</p>
|
||||
|
||||
<CardGroup cols={2}>
|
||||
<Card title="Google Form" icon="file" href="https://forms.gle/NDRCKsRpUHsz2Wcm8" color="#7387d0">
|
||||
Fill out this form
|
||||
</Card>
|
||||
<Card title="Slack" icon="slack" href="https://join.slack.com/t/embedchain/shared_invite/zt-22uwz3c46-Zg7cIh5rOBteT_xe1jwLDw" color="#4A154B">
|
||||
Let us know on our slack community
|
||||
</Card>
|
||||
|
||||
@@ -1,84 +0,0 @@
|
||||
---
|
||||
title: '⚙️ Custom configurations'
|
||||
---
|
||||
|
||||
Embedchain is made to work out of the box. However, for advanced users we're also offering configuration options. All of these configuration options are optional and have sane defaults.
|
||||
|
||||
You can configure different components of your app (`llm`, `embedding model`, or `vector database`) through a simple yaml configuration that Embedchain offers. Here is a generic full-stack example of the yaml config:
|
||||
|
||||
```yaml
|
||||
app:
|
||||
config:
|
||||
id: 'full-stack-app'
|
||||
|
||||
chunker:
|
||||
chunk_size: 100
|
||||
chunk_overlap: 20
|
||||
length_function: 'len'
|
||||
|
||||
llm:
|
||||
provider: openai
|
||||
config:
|
||||
model: 'gpt-3.5-turbo'
|
||||
temperature: 0.5
|
||||
max_tokens: 1000
|
||||
top_p: 1
|
||||
stream: false
|
||||
template: |
|
||||
Use the following pieces of context to answer the query at the end.
|
||||
If you don't know the answer, just say that you don't know, don't try to make up an answer.
|
||||
|
||||
$context
|
||||
|
||||
Query: $query
|
||||
|
||||
Helpful Answer:
|
||||
system_prompt: |
|
||||
Act as William Shakespeare. Answer the following questions in the style of William Shakespeare.
|
||||
|
||||
vectordb:
|
||||
provider: chroma
|
||||
config:
|
||||
collection_name: 'full-stack-app'
|
||||
dir: db
|
||||
allow_reset: true
|
||||
|
||||
embedder:
|
||||
provider: openai
|
||||
config:
|
||||
model: 'text-embedding-ada-002'
|
||||
```
|
||||
|
||||
Alright, let's dive into what each key means in the yaml config above:
|
||||
|
||||
1. `app` Section:
|
||||
- `config`:
|
||||
- `id` (String): The ID or name of your full-stack application.
|
||||
2. `chunker` Section:
|
||||
- `chunk_size` (Integer): The size of each chunk of text that is sent to the language model.
|
||||
- `chunk_overlap` (Integer): The amount of overlap between each chunk of text.
|
||||
- `length_function` (String): The function used to calculate the length of each chunk of text. In this case, it's set to 'len'. You can also use any function import directly as a string here.
|
||||
3. `llm` Section:
|
||||
- `provider` (String): The provider for the language model, which is set to 'openai'. You can find the full list of llm providers in [our docs](/components/llms).
|
||||
- `model` (String): The specific model being used, 'gpt-3.5-turbo'.
|
||||
- `config`:
|
||||
- `temperature` (Float): Controls the randomness of the model's output. A higher value (closer to 1) makes the output more random.
|
||||
- `max_tokens` (Integer): Controls how many tokens are used in the response.
|
||||
- `top_p` (Float): Controls the diversity of word selection. A higher value (closer to 1) makes word selection more diverse.
|
||||
- `stream` (Boolean): Controls if the response is streamed back to the user (set to false).
|
||||
- `template` (String): A custom template for the prompt that the model uses to generate responses.
|
||||
- `system_prompt` (String): A system prompt for the model to follow when generating responses, in this case, it's set to the style of William Shakespeare.
|
||||
4. `vectordb` Section:
|
||||
- `provider` (String): The provider for the vector database, set to 'chroma'. You can find the full list of vector database providers in [our docs](/components/vector-databases).
|
||||
- `config`:
|
||||
- `collection_name` (String): The initial collection name for the database, set to 'full-stack-app'.
|
||||
- `dir` (String): The directory for the database, set to 'db'.
|
||||
- `allow_reset` (Boolean): Indicates whether resetting the database is allowed, set to true.
|
||||
5. `embedder` Section:
|
||||
- `provider` (String): The provider for the embedder, set to 'openai'. You can find the full list of embedding model providers in [our docs](/components/embedding-models).
|
||||
- `config`:
|
||||
- `model` (String): The specific model used for text embedding, 'text-embedding-ada-002'.
|
||||
|
||||
If you have questions about the configuration above, please feel free to reach out to us using one of the following methods:
|
||||
|
||||
<Snippet file="get-help.mdx" />
|
||||
@@ -0,0 +1,190 @@
|
||||
---
|
||||
title: 'Custom configurations'
|
||||
---
|
||||
|
||||
Embedchain offers several configuration options for your LLM, vector database, and embedding model. All of these configuration options are optional and have sane defaults.
|
||||
|
||||
You can configure different components of your app (`llm`, `embedding model`, or `vector database`) through a simple yaml configuration that Embedchain offers. Here is a generic full-stack example of the yaml config:
|
||||
|
||||
|
||||
<Tip>
|
||||
Embedchain applications are configurable using YAML file, JSON file or by directly passing the config dictionary. Checkout the [docs here](/api-reference/pipeline/overview#usage) on how to use other formats.
|
||||
</Tip>
|
||||
|
||||
<CodeGroup>
|
||||
```yaml config.yaml
|
||||
app:
|
||||
config:
|
||||
name: 'full-stack-app'
|
||||
|
||||
llm:
|
||||
provider: openai
|
||||
config:
|
||||
model: 'gpt-3.5-turbo'
|
||||
temperature: 0.5
|
||||
max_tokens: 1000
|
||||
top_p: 1
|
||||
stream: false
|
||||
template: |
|
||||
Use the following pieces of context to answer the query at the end.
|
||||
If you don't know the answer, just say that you don't know, don't try to make up an answer.
|
||||
|
||||
$context
|
||||
|
||||
Query: $query
|
||||
|
||||
Helpful Answer:
|
||||
system_prompt: |
|
||||
Act as William Shakespeare. Answer the following questions in the style of William Shakespeare.
|
||||
|
||||
vectordb:
|
||||
provider: chroma
|
||||
config:
|
||||
collection_name: 'full-stack-app'
|
||||
dir: db
|
||||
allow_reset: true
|
||||
|
||||
embedder:
|
||||
provider: openai
|
||||
config:
|
||||
model: 'text-embedding-ada-002'
|
||||
|
||||
chunker:
|
||||
chunk_size: 2000
|
||||
chunk_overlap: 100
|
||||
length_function: 'len'
|
||||
min_chunk_size: 0
|
||||
```
|
||||
|
||||
```json config.json
|
||||
{
|
||||
"app": {
|
||||
"config": {
|
||||
"name": "full-stack-app"
|
||||
}
|
||||
},
|
||||
"llm": {
|
||||
"provider": "openai",
|
||||
"config": {
|
||||
"model": "gpt-3.5-turbo",
|
||||
"temperature": 0.5,
|
||||
"max_tokens": 1000,
|
||||
"top_p": 1,
|
||||
"stream": false,
|
||||
"template": "Use the following pieces of context to answer the query at the end.\nIf you don't know the answer, just say that you don't know, don't try to make up an answer.\n$context\n\nQuery: $query\n\nHelpful Answer:",
|
||||
"system_prompt": "Act as William Shakespeare. Answer the following questions in the style of William Shakespeare."
|
||||
}
|
||||
},
|
||||
"vectordb": {
|
||||
"provider": "chroma",
|
||||
"config": {
|
||||
"collection_name": "full-stack-app",
|
||||
"dir": "db",
|
||||
"allow_reset": true
|
||||
}
|
||||
},
|
||||
"embedder": {
|
||||
"provider": "openai",
|
||||
"config": {
|
||||
"model": "text-embedding-ada-002"
|
||||
}
|
||||
},
|
||||
"chunker": {
|
||||
"chunk_size": 2000,
|
||||
"chunk_overlap": 100,
|
||||
"length_function": "len",
|
||||
"min_chunk_size": 0
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
```python config.py
|
||||
config = {
|
||||
'app': {
|
||||
'config': {
|
||||
'name': 'full-stack-app'
|
||||
}
|
||||
},
|
||||
'llm': {
|
||||
'provider': 'openai',
|
||||
'config': {
|
||||
'model': 'gpt-3.5-turbo',
|
||||
'temperature': 0.5,
|
||||
'max_tokens': 1000,
|
||||
'top_p': 1,
|
||||
'stream': False,
|
||||
'template': (
|
||||
"Use the following pieces of context to answer the query at the end.\n"
|
||||
"If you don't know the answer, just say that you don't know, don't try to make up an answer.\n"
|
||||
"$context\n\nQuery: $query\n\nHelpful Answer:"
|
||||
),
|
||||
'system_prompt': (
|
||||
"Act as William Shakespeare. Answer the following questions in the style of William Shakespeare."
|
||||
)
|
||||
}
|
||||
},
|
||||
'vectordb': {
|
||||
'provider': 'chroma',
|
||||
'config': {
|
||||
'collection_name': 'full-stack-app',
|
||||
'dir': 'db',
|
||||
'allow_reset': True
|
||||
}
|
||||
},
|
||||
'embedder': {
|
||||
'provider': 'openai',
|
||||
'config': {
|
||||
'model': 'text-embedding-ada-002'
|
||||
}
|
||||
},
|
||||
'chunker': {
|
||||
'chunk_size': 2000,
|
||||
'chunk_overlap': 100,
|
||||
'length_function': 'len',
|
||||
'min_chunk_size': 0
|
||||
}
|
||||
}
|
||||
```
|
||||
</CodeGroup>
|
||||
|
||||
Alright, let's dive into what each key means in the yaml config above:
|
||||
|
||||
1. `app` Section:
|
||||
- `config`:
|
||||
- `name` (String): The name of your full-stack application.
|
||||
- `id` (String): The id of your full-stack application.
|
||||
<Note>Only use this to reload already created apps. We recommend users to not create their own ids.</Note>
|
||||
- `collect_metrics` (Boolean): Indicates whether metrics should be collected for the app, defaults to `True`
|
||||
- `log_level` (String): The log level for the app, defaults to `WARNING`
|
||||
2. `llm` Section:
|
||||
- `provider` (String): The provider for the language model, which is set to 'openai'. You can find the full list of llm providers in [our docs](/components/llms).
|
||||
- `config`:
|
||||
- `model` (String): The specific model being used, 'gpt-3.5-turbo'.
|
||||
- `temperature` (Float): Controls the randomness of the model's output. A higher value (closer to 1) makes the output more random.
|
||||
- `max_tokens` (Integer): Controls how many tokens are used in the response.
|
||||
- `top_p` (Float): Controls the diversity of word selection. A higher value (closer to 1) makes word selection more diverse.
|
||||
- `stream` (Boolean): Controls if the response is streamed back to the user (set to false).
|
||||
- `template` (String): A custom template for the prompt that the model uses to generate responses.
|
||||
- `system_prompt` (String): A system prompt for the model to follow when generating responses, in this case, it's set to the style of William Shakespeare.
|
||||
- `stream` (Boolean): Controls if the response is streamed back to the user (set to false).
|
||||
- `number_documents` (Integer): Number of documents to pull from the vectordb as context, defaults to 1
|
||||
3. `vectordb` Section:
|
||||
- `provider` (String): The provider for the vector database, set to 'chroma'. You can find the full list of vector database providers in [our docs](/components/vector-databases).
|
||||
- `config`:
|
||||
- `collection_name` (String): The initial collection name for the vectordb, set to 'full-stack-app'.
|
||||
- `dir` (String): The directory for the local database, set to 'db'.
|
||||
- `allow_reset` (Boolean): Indicates whether resetting the vectordb is allowed, set to true.
|
||||
<Note>We recommend you to checkout vectordb specific config [here](https://docs.embedchain.ai/components/vector-databases)</Note>
|
||||
4. `embedder` Section:
|
||||
- `provider` (String): The provider for the embedder, set to 'openai'. You can find the full list of embedding model providers in [our docs](/components/embedding-models).
|
||||
- `config`:
|
||||
- `model` (String): The specific model used for text embedding, 'text-embedding-ada-002'.
|
||||
5. `chunker` Section:
|
||||
- `chunk_size` (Integer): The size of each chunk of text that is sent to the language model.
|
||||
- `chunk_overlap` (Integer): The amount of overlap between each chunk of text.
|
||||
- `length_function` (String): The function used to calculate the length of each chunk of text. In this case, it's set to 'len'. You can also use any function import directly as a string here.
|
||||
- `min_chunk_size` (Integer): The minimum size of each chunk of text that is sent to the language model. Must be less than `chunk_size`, and greater than `chunk_overlap`.
|
||||
|
||||
If you have questions about the configuration above, please feel free to reach out to us using one of the following methods:
|
||||
|
||||
<Snippet file="get-help.mdx" />
|
||||
@@ -0,0 +1,44 @@
|
||||
---
|
||||
title: '📊 add'
|
||||
---
|
||||
|
||||
`add()` method is used to load the data sources from different data sources to a RAG pipeline. You can find the signature below:
|
||||
|
||||
### Parameters
|
||||
|
||||
<ParamField path="source" type="str">
|
||||
The data to embed, can be a URL, local file or raw content, depending on the data type.. You can find the full list of supported data sources [here](/components/data-sources/overview).
|
||||
</ParamField>
|
||||
<ParamField path="data_type" type="str" optional>
|
||||
Type of data source. It can be automatically detected but user can force what data type to load as.
|
||||
</ParamField>
|
||||
<ParamField path="metadata" type="dict" optional>
|
||||
Any metadata that you want to store with the data source. Metadata is generally really useful for doing metadata filtering on top of semantic search to yield faster search and better results.
|
||||
</ParamField>
|
||||
|
||||
## Usage
|
||||
|
||||
### Load data from webpage
|
||||
|
||||
```python Code example
|
||||
from embedchain import Pipeline as App
|
||||
|
||||
app = App()
|
||||
app.add("https://www.forbes.com/profile/elon-musk")
|
||||
# Inserting batches in chromadb: 100%|███████████████| 1/1 [00:00<00:00, 1.19it/s]
|
||||
# Successfully saved https://www.forbes.com/profile/elon-musk (DataType.WEB_PAGE). New chunks count: 4
|
||||
```
|
||||
|
||||
### Load data from sitemap
|
||||
|
||||
```python Code example
|
||||
from embedchain import Pipeline as App
|
||||
|
||||
app = App()
|
||||
app.add("https://python.langchain.com/sitemap.xml", data_type="sitemap")
|
||||
# Loading pages: 100%|█████████████| 1108/1108 [00:47<00:00, 23.17it/s]
|
||||
# Inserting batches in chromadb: 100%|█████████| 111/111 [04:41<00:00, 2.54s/it]
|
||||
# Successfully saved https://python.langchain.com/sitemap.xml (DataType.SITEMAP). New chunks count: 11024
|
||||
```
|
||||
|
||||
You can find complete list of supported data sources [here](/components/data-sources/overview).
|
||||
@@ -0,0 +1,97 @@
|
||||
---
|
||||
title: '💬 chat'
|
||||
---
|
||||
|
||||
`chat()` method allows you to chat over your data sources using a user-friendly chat API. You can find the signature below:
|
||||
|
||||
### Parameters
|
||||
|
||||
<ParamField path="input_query" type="str">
|
||||
Question to ask
|
||||
</ParamField>
|
||||
<ParamField path="config" type="BaseLlmConfig" optional>
|
||||
Configure different llm settings such as prompt, temprature, number_documents etc.
|
||||
</ParamField>
|
||||
<ParamField path="dry_run" type="bool" optional>
|
||||
The purpose is to test the prompt structure without actually running LLM inference. Defaults to `False`
|
||||
</ParamField>
|
||||
<ParamField path="where" type="dict" optional>
|
||||
A dictionary of key-value pairs to filter the chunks from the vector database. Defaults to `None`
|
||||
</ParamField>
|
||||
<ParamField path="citations" type="bool" optional>
|
||||
Return citations along with the LLM answer. Defaults to `False`
|
||||
</ParamField>
|
||||
|
||||
### Returns
|
||||
|
||||
<ResponseField name="answer" type="str | tuple">
|
||||
If `citations=False`, return a stringified answer to the question asked. <br />
|
||||
If `citations=True`, returns a tuple with answer and citations respectively.
|
||||
</ResponseField>
|
||||
|
||||
## Usage
|
||||
|
||||
### With citations
|
||||
|
||||
If you want to get the answer to question and return both answer and citations, use the following code snippet:
|
||||
|
||||
```python With Citations
|
||||
from embedchain import Pipeline as App
|
||||
|
||||
# Initialize app
|
||||
app = App()
|
||||
|
||||
# Add data source
|
||||
app.add("https://www.forbes.com/profile/elon-musk")
|
||||
|
||||
# Get relevant answer for your query
|
||||
answer, sources = app.chat("What is the net worth of Elon?", citations=True)
|
||||
print(answer)
|
||||
# Answer: The net worth of Elon Musk is $221.9 billion.
|
||||
|
||||
print(sources)
|
||||
# [
|
||||
# (
|
||||
# 'Elon Musk PROFILEElon MuskCEO, Tesla$247.1B$2.3B (0.96%)Real Time Net Worthas of 12/7/23 ...',
|
||||
# 'https://www.forbes.com/profile/elon-musk',
|
||||
# '4651b266--4aa78839fe97'
|
||||
# ),
|
||||
# (
|
||||
# '74% of the company, which is now called X.Wealth HistoryHOVER TO REVEAL NET WORTH BY YEARForbes ...',
|
||||
# 'https://www.forbes.com/profile/elon-musk',
|
||||
# '4651b266--4aa78839fe97'
|
||||
# ),
|
||||
# (
|
||||
# 'founded in 2002, is worth nearly $150 billion after a $750 million tender offer in June 2023 ...',
|
||||
# 'https://www.forbes.com/profile/elon-musk',
|
||||
# '4651b266--4aa78839fe97'
|
||||
# )
|
||||
# ]
|
||||
```
|
||||
|
||||
<Note>
|
||||
When `citations=True`, note that the returned `sources` are a list of tuples where each tuple has three elements (in the following order):
|
||||
1. source chunk
|
||||
2. link of the source document
|
||||
3. document id (used for book keeping purposes)
|
||||
</Note>
|
||||
|
||||
|
||||
### Without citations
|
||||
|
||||
If you just want to return answers and don't want to return citations, you can use the following example:
|
||||
|
||||
```python Without Citations
|
||||
from embedchain import Pipeline as App
|
||||
|
||||
# Initialize app
|
||||
app = App()
|
||||
|
||||
# Add data source
|
||||
app.add("https://www.forbes.com/profile/elon-musk")
|
||||
|
||||
# Chat on your data using `.chat()`
|
||||
answer = app.chat("What is the net worth of Elon?")
|
||||
print(answer)
|
||||
# Answer: The net worth of Elon Musk is $221.9 billion.
|
||||
```
|
||||
@@ -0,0 +1,19 @@
|
||||
---
|
||||
title: 🗑 delete
|
||||
---
|
||||
|
||||
`delete_chat_history()` method allows you to delete all previous messages in a chat history.
|
||||
|
||||
## Usage
|
||||
|
||||
```python
|
||||
from embedchain import Pipeline as App
|
||||
|
||||
app = App()
|
||||
|
||||
app.add("https://www.forbes.com/profile/elon-musk")
|
||||
|
||||
app.chat("What is the net worth of Elon Musk?")
|
||||
|
||||
app.delete_chat_history()
|
||||
```
|
||||
@@ -0,0 +1,31 @@
|
||||
---
|
||||
title: 🚀 deploy
|
||||
---
|
||||
|
||||
Using the `deploy()` method, Embedchain allows developers to easily launch their LLM-powered applications on the [Embedchain Platform](https://app.embedchain.ai). This platform facilitates seamless access to your data's context via a free and user-friendly REST API. Once your pipeline is deployed, you can update your data sources at any time.
|
||||
|
||||
The `deploy()` method not only deploys your pipeline but also efficiently manages LLMs, vector databases, embedding models, and data syncing, enabling you to focus on querying, chatting, or searching without the hassle of infrastructure management.
|
||||
|
||||
## Usage
|
||||
|
||||
```python
|
||||
from embedchain import Pipeline as App
|
||||
|
||||
# Initialize app
|
||||
app = App()
|
||||
|
||||
# Add data source
|
||||
app.add("https://www.forbes.com/profile/elon-musk")
|
||||
|
||||
# Deploy your pipeline to Embedchain Platform
|
||||
app.deploy()
|
||||
|
||||
# 🔑 Enter your Embedchain API key. You can find the API key at https://app.embedchain.ai/settings/keys/
|
||||
# ec-xxxxxx
|
||||
|
||||
# 🛠️ Creating pipeline on the platform...
|
||||
# 🎉🎉🎉 Pipeline created successfully! View your pipeline: https://app.embedchain.ai/pipelines/xxxxx
|
||||
|
||||
# 🛠️ Adding data to your pipeline...
|
||||
# ✅ Data of type: web_page, value: https://www.forbes.com/profile/elon-musk added successfully.
|
||||
```
|
||||
@@ -0,0 +1,130 @@
|
||||
---
|
||||
title: "Pipeline"
|
||||
---
|
||||
|
||||
Create a RAG pipeline object on Embedchain. This is the main entrypoint for a developer to interact with Embedchain APIs. A pipeline configures the llm, vector database, embedding model, and retrieval strategy of your choice.
|
||||
|
||||
### Attributes
|
||||
|
||||
<ParamField path="local_id" type="str">
|
||||
Pipeline ID
|
||||
</ParamField>
|
||||
<ParamField path="name" type="str" optional>
|
||||
Name of the pipeline
|
||||
</ParamField>
|
||||
<ParamField path="config" type="BaseConfig">
|
||||
Configuration of the pipeline
|
||||
</ParamField>
|
||||
<ParamField path="llm" type="BaseLlm">
|
||||
Configured LLM for the RAG pipeline
|
||||
</ParamField>
|
||||
<ParamField path="db" type="BaseVectorDB">
|
||||
Configured vector database for the RAG pipeline
|
||||
</ParamField>
|
||||
<ParamField path="embedding_model" type="BaseEmbedder">
|
||||
Configured embedding model for the RAG pipeline
|
||||
</ParamField>
|
||||
<ParamField path="chunker" type="ChunkerConfig">
|
||||
Chunker configuration
|
||||
</ParamField>
|
||||
<ParamField path="client" type="Client" optional>
|
||||
Client object (used to deploy a pipeline to Embedchain platform)
|
||||
</ParamField>
|
||||
<ParamField path="logger" type="logging.Logger">
|
||||
Logger object
|
||||
</ParamField>
|
||||
|
||||
## Usage
|
||||
|
||||
You can create an embedchain pipeline instance using the following methods:
|
||||
|
||||
### Default setting
|
||||
|
||||
```python Code Example
|
||||
from embedchain import Pipeline as App
|
||||
app = App()
|
||||
```
|
||||
|
||||
|
||||
### Python Dict
|
||||
|
||||
```python Code Example
|
||||
from embedchain import Pipeline as App
|
||||
|
||||
config_dict = {
|
||||
'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'
|
||||
}
|
||||
}
|
||||
|
||||
# load llm configuration from config dict
|
||||
app = App.from_config(config=config_dict)
|
||||
```
|
||||
|
||||
### YAML Config
|
||||
|
||||
<CodeGroup>
|
||||
|
||||
```python main.py
|
||||
from embedchain import Pipeline as App
|
||||
|
||||
# load llm configuration from config.yaml file
|
||||
app = App.from_config(config_path="config.yaml")
|
||||
```
|
||||
|
||||
```yaml config.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
|
||||
```
|
||||
|
||||
</CodeGroup>
|
||||
|
||||
### JSON Config
|
||||
|
||||
<CodeGroup>
|
||||
|
||||
```python main.py
|
||||
from embedchain import Pipeline as App
|
||||
|
||||
# load llm configuration from config.json file
|
||||
app = App.from_config(config_path="config.json")
|
||||
```
|
||||
|
||||
```json config.json
|
||||
{
|
||||
"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"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
</CodeGroup>
|
||||
@@ -0,0 +1,97 @@
|
||||
---
|
||||
title: '❓ query'
|
||||
---
|
||||
|
||||
`.query()` method empowers developers to ask questions and receive relevant answers through a user-friendly query API. Function signature is given below:
|
||||
|
||||
### Parameters
|
||||
|
||||
<ParamField path="input_query" type="str">
|
||||
Question to ask
|
||||
</ParamField>
|
||||
<ParamField path="config" type="BaseLlmConfig" optional>
|
||||
Configure different llm settings such as prompt, temprature, number_documents etc.
|
||||
</ParamField>
|
||||
<ParamField path="dry_run" type="bool" optional>
|
||||
The purpose is to test the prompt structure without actually running LLM inference. Defaults to `False`
|
||||
</ParamField>
|
||||
<ParamField path="where" type="dict" optional>
|
||||
A dictionary of key-value pairs to filter the chunks from the vector database. Defaults to `None`
|
||||
</ParamField>
|
||||
<ParamField path="citations" type="bool" optional>
|
||||
Return citations along with the LLM answer. Defaults to `False`
|
||||
</ParamField>
|
||||
|
||||
### Returns
|
||||
|
||||
<ResponseField name="answer" type="str | tuple">
|
||||
If `citations=False`, return a stringified answer to the question asked. <br />
|
||||
If `citations=True`, returns a tuple with answer and citations respectively.
|
||||
</ResponseField>
|
||||
|
||||
## Usage
|
||||
|
||||
### With citations
|
||||
|
||||
If you want to get the answer to question and return both answer and citations, use the following code snippet:
|
||||
|
||||
```python With Citations
|
||||
from embedchain import Pipeline as App
|
||||
|
||||
# Initialize app
|
||||
app = App()
|
||||
|
||||
# Add data source
|
||||
app.add("https://www.forbes.com/profile/elon-musk")
|
||||
|
||||
# Get relevant answer for your query
|
||||
answer, sources = app.query("What is the net worth of Elon?", citations=True)
|
||||
print(answer)
|
||||
# Answer: The net worth of Elon Musk is $221.9 billion.
|
||||
|
||||
print(sources)
|
||||
# [
|
||||
# (
|
||||
# 'Elon Musk PROFILEElon MuskCEO, Tesla$247.1B$2.3B (0.96%)Real Time Net Worthas of 12/7/23 ...',
|
||||
# 'https://www.forbes.com/profile/elon-musk',
|
||||
# '4651b266--4aa78839fe97'
|
||||
# ),
|
||||
# (
|
||||
# '74% of the company, which is now called X.Wealth HistoryHOVER TO REVEAL NET WORTH BY YEARForbes ...',
|
||||
# 'https://www.forbes.com/profile/elon-musk',
|
||||
# '4651b266--4aa78839fe97'
|
||||
# ),
|
||||
# (
|
||||
# 'founded in 2002, is worth nearly $150 billion after a $750 million tender offer in June 2023 ...',
|
||||
# 'https://www.forbes.com/profile/elon-musk',
|
||||
# '4651b266--4aa78839fe97'
|
||||
# )
|
||||
# ]
|
||||
```
|
||||
|
||||
<Note>
|
||||
When `citations=True`, note that the returned `sources` are a list of tuples where each tuple has three elements (in the following order):
|
||||
1. source chunk
|
||||
2. link of the source document
|
||||
3. document id (used for book keeping purposes)
|
||||
</Note>
|
||||
|
||||
### Without citations
|
||||
|
||||
If you just want to return answers and don't want to return citations, you can use the following example:
|
||||
|
||||
```python Without Citations
|
||||
from embedchain import Pipeline as App
|
||||
|
||||
# Initialize app
|
||||
app = App()
|
||||
|
||||
# Add data source
|
||||
app.add("https://www.forbes.com/profile/elon-musk")
|
||||
|
||||
# Get relevant answer for your query
|
||||
answer = app.query("What is the net worth of Elon?")
|
||||
print(answer)
|
||||
# Answer: The net worth of Elon Musk is $221.9 billion.
|
||||
```
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
---
|
||||
title: 🔄 reset
|
||||
---
|
||||
|
||||
`reset()` method allows you to wipe the data from your RAG application and start from scratch.
|
||||
|
||||
## Usage
|
||||
|
||||
```python
|
||||
from embedchain import Pipeline as App
|
||||
|
||||
app = App()
|
||||
app.add("https://www.forbes.com/profile/elon-musk")
|
||||
|
||||
# Reset the app
|
||||
app.reset()
|
||||
```
|
||||
@@ -0,0 +1,51 @@
|
||||
---
|
||||
title: '🔍 search'
|
||||
---
|
||||
|
||||
`.search()` enables you to uncover the most pertinent context by performing a semantic search across your data sources based on a given query. Refer to the function signature below:
|
||||
|
||||
### Parameters
|
||||
|
||||
<ParamField path="query" type="str">
|
||||
Question
|
||||
</ParamField>
|
||||
<ParamField path="num_documents" type="int" optional>
|
||||
Number of relevant documents to fetch. Defaults to `3`
|
||||
</ParamField>
|
||||
|
||||
### Returns
|
||||
|
||||
<ResponseField name="answer" type="dict">
|
||||
Return list of dictionaries that contain the relevant chunk and their source information.
|
||||
</ResponseField>
|
||||
|
||||
## Usage
|
||||
|
||||
Refer to the following example on how to use the search api:
|
||||
|
||||
```python Code example
|
||||
from embedchain import Pipeline as App
|
||||
|
||||
# Initialize app
|
||||
app = App()
|
||||
|
||||
# Add data source
|
||||
app.add("https://www.forbes.com/profile/elon-musk")
|
||||
|
||||
# Get relevant context using semantic search
|
||||
context = app.search("What is the net worth of Elon?", num_documents=2)
|
||||
print(context)
|
||||
# Context:
|
||||
# [
|
||||
# {
|
||||
# 'context': 'Elon Musk PROFILEElon MuskCEO, Tesla$221.9BReal Time Net Worthas of 10/29/23Reflects change since 5 pm ET of prior trading day. 1 in the world todayPhoto by Martin Schoeller for ForbesAbout Elon MuskElon Musk cofounded six companies, including electric car maker Tesla, rocket producer SpaceX and tunneling startup Boring Company.He owns about 21% of Tesla between stock and options, but has pledged more than half his shares as collateral for personal loans of up to $3.5 billion.SpaceX, founded in',
|
||||
# 'source': 'https://www.forbes.com/profile/elon-musk',
|
||||
# 'document_id': 'some_document_id'
|
||||
# },
|
||||
# {
|
||||
# 'context': 'company, which is now called X.Wealth HistoryHOVER TO REVEAL NET WORTH BY YEARForbes Lists 1Forbes 400 (2023)The Richest Person In Every State (2023) 2Billionaires (2023) 1Innovative Leaders (2019) 25Powerful People (2018) 12Richest In Tech (2017)Global Game Changers (2016)More ListsPersonal StatsAge52Source of WealthTesla, SpaceX, Self MadeSelf-Made Score8Philanthropy Score1ResidenceAustin, TexasCitizenshipUnited StatesMarital StatusSingleChildren11EducationBachelor of Arts/Science, University',
|
||||
# 'source': 'https://www.forbes.com/profile/elon-musk',
|
||||
# 'document_id': 'some_document_id'
|
||||
# }
|
||||
# ]
|
||||
```
|
||||
@@ -0,0 +1,54 @@
|
||||
---
|
||||
title: 'AI Assistant'
|
||||
---
|
||||
|
||||
The `AIAssistant` class, an alternative to the OpenAI Assistant API, is designed for those who prefer using large language models (LLMs) other than those provided by OpenAI. It facilitates the creation of AI Assistants with several key benefits:
|
||||
|
||||
- **Visibility into Citations**: It offers transparent access to the sources and citations used by the AI, enhancing the understanding and trustworthiness of its responses.
|
||||
|
||||
- **Debugging Capabilities**: Users have the ability to delve into and debug the AI's processes, allowing for a deeper understanding and fine-tuning of its performance.
|
||||
|
||||
- **Customizable Prompts**: The class provides the flexibility to modify and tailor prompts according to specific needs, enabling more precise and relevant interactions.
|
||||
|
||||
- **Chain of Thought Integration**: It supports the incorporation of a 'chain of thought' approach, which helps in breaking down complex queries into simpler, sequential steps, thereby improving the clarity and accuracy of responses.
|
||||
|
||||
It is ideal for those who value customization, transparency, and detailed control over their AI Assistant's functionalities.
|
||||
|
||||
### Arguments
|
||||
|
||||
<ParamField path="name" type="string" optional>
|
||||
Name for your AI assistant
|
||||
</ParamField>
|
||||
|
||||
<ParamField path="instructions" type="string" optional>
|
||||
How the Assistant and model should behave or respond
|
||||
</ParamField>
|
||||
|
||||
<ParamField path="assistant_id" type="string" optional>
|
||||
Load existing AI Assistant. If you pass this, you don't have to pass other arguments.
|
||||
</ParamField>
|
||||
|
||||
<ParamField path="thread_id" type="string" optional>
|
||||
Existing thread id if exists
|
||||
</ParamField>
|
||||
|
||||
<ParamField path="yaml_path" type="str" Optional>
|
||||
Embedchain pipeline config yaml path to use. This will define the configuration of the AI Assistant (such as configuring the LLM, vector database, and embedding model)
|
||||
</ParamField>
|
||||
|
||||
<ParamField path="data_sources" type="list" default="[]">
|
||||
Add data sources to your assistant. You can add in the following format: `[{"source": "https://example.com", "data_type": "web_page"}]`
|
||||
</ParamField>
|
||||
|
||||
<ParamField path="collect_metrics" type="boolean" default="True">
|
||||
Anonymous telemetry (doesn't collect any user information or user's files). Used to improve the Embedchain package utilization. Default is `True`.
|
||||
</ParamField>
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
For detailed guidance on creating your own AI Assistant, click the link below. It provides step-by-step instructions to help you through the process:
|
||||
|
||||
<Card title="Guide to Creating Your AI Assistant" icon="link" href="/examples/opensource-assistant">
|
||||
Learn how to build a customized AI Assistant using the `AIAssistant` class.
|
||||
</Card>
|
||||
@@ -0,0 +1,45 @@
|
||||
---
|
||||
title: 'OpenAI Assistant'
|
||||
---
|
||||
|
||||
### Arguments
|
||||
|
||||
<ParamField path="name" type="string">
|
||||
Name for your AI assistant
|
||||
</ParamField>
|
||||
|
||||
<ParamField path="instructions" type="string">
|
||||
how the Assistant and model should behave or respond
|
||||
</ParamField>
|
||||
|
||||
<ParamField path="assistant_id" type="string">
|
||||
Load existing OpenAI Assistant. If you pass this, you don't have to pass other arguments.
|
||||
</ParamField>
|
||||
|
||||
<ParamField path="thread_id" type="string">
|
||||
Existing OpenAI thread id if exists
|
||||
</ParamField>
|
||||
|
||||
<ParamField path="model" type="str" default="gpt-4-1106-preview">
|
||||
OpenAI model to use
|
||||
</ParamField>
|
||||
|
||||
<ParamField path="tools" type="list">
|
||||
OpenAI tools to use. Default set to `[{"type": "retrieval"}]`
|
||||
</ParamField>
|
||||
|
||||
<ParamField path="data_sources" type="list" default="[]">
|
||||
Add data sources to your assistant. You can add in the following format: `[{"source": "https://example.com", "data_type": "web_page"}]`
|
||||
</ParamField>
|
||||
|
||||
<ParamField path="telemetry" type="boolean" default="True">
|
||||
Anonymous telemetry (doesn't collect any user information or user's files). Used to improve the Embedchain package utilization. Default is `True`.
|
||||
</ParamField>
|
||||
|
||||
## Usage
|
||||
|
||||
For detailed guidance on creating your own OpenAI Assistant, click the link below. It provides step-by-step instructions to help you through the process:
|
||||
|
||||
<Card title="Guide to Creating Your OpenAI Assistant" icon="link" href="/examples/openai-assistant">
|
||||
Learn how to build an OpenAI Assistant using the `OpenAIAssistant` class.
|
||||
</Card>
|
||||
@@ -0,0 +1,16 @@
|
||||
---
|
||||
title: "🐝 Beehiiv"
|
||||
---
|
||||
|
||||
To add any Beehiiv data sources to your app, just add the base url as the source and set the data_type to `beehiiv`.
|
||||
|
||||
```python
|
||||
from embedchain import Pipeline as App
|
||||
|
||||
app = App()
|
||||
|
||||
# source: just add the base url and set the data_type to 'beehiiv'
|
||||
app.add('https://aibreakfast.beehiiv.com', data_type='beehiiv')
|
||||
app.query("How much is OpenAI paying developers?")
|
||||
# Answer: OpenAI is aggressively recruiting Google's top AI researchers with offers ranging between $5 to $10 million annually, primarily in stock options.
|
||||
```
|
||||
@@ -0,0 +1,41 @@
|
||||
---
|
||||
title: '⚙️ Custom'
|
||||
---
|
||||
|
||||
When we say "custom", we mean that you can customize the loader and chunker to your needs. This is done by passing a custom loader and chunker to the `add` method.
|
||||
|
||||
```python
|
||||
from embedchain import Pipeline as App
|
||||
import your_loader
|
||||
import your_chunker
|
||||
|
||||
app = App()
|
||||
loader = your_loader()
|
||||
chunker = your_chunker()
|
||||
|
||||
app.add("source", data_type="custom", loader=loader, chunker=chunker)
|
||||
```
|
||||
|
||||
<Note>
|
||||
The custom loader and chunker must be a class that inherits from the [`BaseLoader`](https://github.com/embedchain/embedchain/blob/main/embedchain/loaders/base_loader.py) and [`BaseChunker`](https://github.com/embedchain/embedchain/blob/main/embedchain/chunkers/base_chunker.py) classes respectively.
|
||||
</Note>
|
||||
|
||||
<Note>
|
||||
If the `data_type` is not a valid data type, the `add` method will fallback to the `custom` data type and expect a custom loader and chunker to be passed by the user.
|
||||
</Note>
|
||||
|
||||
Example:
|
||||
|
||||
```python
|
||||
from embedchain import Pipeline as App
|
||||
from embedchain.loaders.github import GithubLoader
|
||||
|
||||
app = App()
|
||||
|
||||
loader = GithubLoader(config={"token": "ghp_xxx"})
|
||||
|
||||
app.add("repo:embedchain/embedchain type:repo", data_type="github", loader=loader)
|
||||
|
||||
app.query("What is Embedchain?")
|
||||
# Answer: Embedchain is a Data Platform for Large Language Models (LLMs). It allows users to seamlessly load, index, retrieve, and sync unstructured data in order to build dynamic, LLM-powered applications. There is also a JavaScript implementation called embedchain-js available on GitHub.
|
||||
```
|
||||
+12
@@ -50,3 +50,15 @@ from embedchain import Pipeline as App
|
||||
naval_chat_bot = App()
|
||||
print(naval_chat_bot.query("What unique capacity does Naval argue humans possess when it comes to understanding explanations or concepts?"))
|
||||
```
|
||||
|
||||
## Resetting an app and vector database
|
||||
|
||||
You can reset the app by simply calling the `reset` method. This will delete the vector database and all other app related files.
|
||||
|
||||
```python
|
||||
from embedchain import Pipeline as App
|
||||
|
||||
app = App()
|
||||
app.add("https://www.youtube.com/watch?v=3qHkcs3kG44")
|
||||
app.reset()
|
||||
```
|
||||
@@ -0,0 +1,41 @@
|
||||
---
|
||||
title: '📁 Directory'
|
||||
---
|
||||
|
||||
To use an entire directory as data source, just add `data_type` as `directory` and pass in the path of the local directory.
|
||||
|
||||
### Without customization
|
||||
|
||||
```python
|
||||
import os
|
||||
from embedchain import Pipeline as App
|
||||
|
||||
os.environ["OPENAI_API_KEY"] = "sk-xxx"
|
||||
|
||||
app = App()
|
||||
app.add("./elon-musk", data_type="directory")
|
||||
response = app.query("list all files")
|
||||
print(response)
|
||||
# Answer: Files are elon-musk-1.txt, elon-musk-2.pdf.
|
||||
```
|
||||
|
||||
### Customization
|
||||
|
||||
```python
|
||||
import os
|
||||
from embedchain import Pipeline as App
|
||||
from embedchain.loaders.directory_loader import DirectoryLoader
|
||||
|
||||
os.environ["OPENAI_API_KEY"] = "sk-xxx"
|
||||
lconfig = {
|
||||
"recursive": True,
|
||||
"extensions": [".txt"]
|
||||
}
|
||||
loader = DirectoryLoader(config=lconfig)
|
||||
app = App()
|
||||
app.add("./elon-musk", loader=loader)
|
||||
response = app.query("what are all the files related to?")
|
||||
print(response)
|
||||
|
||||
# Answer: The files are related to Elon Musk.
|
||||
```
|
||||
@@ -0,0 +1,28 @@
|
||||
---
|
||||
title: "💬 Discord"
|
||||
---
|
||||
|
||||
To add any Discord channel messages to your app, just add the `channel_id` as the source and set the `data_type` to `discord`.
|
||||
|
||||
<Note>
|
||||
This loader requires a Discord bot token with read messages access.
|
||||
To obtain the token, follow the instructions provided in this tutorial:
|
||||
<a href="https://www.writebots.com/discord-bot-token/">How to Get a Discord Bot Token?</a>.
|
||||
</Note>
|
||||
|
||||
```python
|
||||
import os
|
||||
from embedchain import Pipeline as App
|
||||
|
||||
# add your discord "BOT" token
|
||||
os.environ["DISCORD_TOKEN"] = "xxx"
|
||||
|
||||
app = App()
|
||||
|
||||
app.add("1177296711023075338", data_type="discord")
|
||||
|
||||
response = app.query("What is Joe saying about Elon Musk?")
|
||||
|
||||
print(response)
|
||||
# Answer: Joe is saying "Elon Musk is a genius".
|
||||
```
|
||||
@@ -0,0 +1,44 @@
|
||||
---
|
||||
title: '🗨️ Discourse'
|
||||
---
|
||||
|
||||
You can now easily load data from your community built with [Discourse](https://discourse.org/).
|
||||
|
||||
## Example
|
||||
|
||||
1. Setup the Discourse Loader with your community url.
|
||||
```Python
|
||||
from embedchain.loaders.discourse import DiscourseLoader
|
||||
|
||||
dicourse_loader = DiscourseLoader(config={"domain": "https://community.openai.com"})
|
||||
```
|
||||
|
||||
2. Once you setup the loader, you can create an app and load data using the above discourse loader
|
||||
```Python
|
||||
import os
|
||||
from embedchain.pipeline import Pipeline as App
|
||||
|
||||
os.environ["OPENAI_API_KEY"] = "sk-xxx"
|
||||
|
||||
app = App()
|
||||
|
||||
app.add("openai after:2023-10-1", data_type="discourse", loader=dicourse_loader)
|
||||
|
||||
question = "Where can I find the OpenAI API status page?"
|
||||
app.query(question)
|
||||
# Answer: You can find the OpenAI API status page at https:/status.openai.com/.
|
||||
```
|
||||
|
||||
NOTE: The `add` function of the app will accept any executable search query to load data. Refer [Discourse API Docs](https://docs.discourse.org/#tag/Search) to learn more about search queries.
|
||||
|
||||
3. We automatically create a chunker to chunk your discourse data, however if you wish to provide your own chunker class. Here is how you can do that:
|
||||
```Python
|
||||
|
||||
from embedchain.chunkers.discourse import DiscourseChunker
|
||||
from embedchain.config.add_config import ChunkerConfig
|
||||
|
||||
discourse_chunker_config = ChunkerConfig(chunk_size=1000, chunk_overlap=0, length_function=len)
|
||||
discourse_chunker = DiscourseChunker(config=discourse_chunker_config)
|
||||
|
||||
app.add("openai", data_type='discourse', loader=dicourse_loader, chunker=discourse_chunker)
|
||||
```
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: '📚🌐 Code documentation'
|
||||
title: '📚 Code documentation'
|
||||
---
|
||||
|
||||
To add any code documentation website as a loader, use the data_type as `docs_site`. Eg:
|
||||
@@ -10,5 +10,5 @@ from embedchain import Pipeline as App
|
||||
app = App()
|
||||
app.add("https://docs.embedchain.ai/", data_type="docs_site")
|
||||
app.query("What is Embedchain?")
|
||||
# Answer: Embedchain is a platform that utilizes various components, including paid/proprietary ones, to provide what is believed to be the best configuration available. It uses LLM (Language Model) providers such as OpenAI, Anthpropic, Vertex_AI, GPT4ALL, Azure_OpenAI, LLAMA2, JINA, and COHERE. Embedchain allows users to import and utilize these LLM providers for their applications.'
|
||||
# Answer: Embedchain is a platform that utilizes various components, including paid/proprietary ones, to provide what is believed to be the best configuration available. It uses LLM (Language Model) providers such as OpenAI, Anthpropic, Vertex_AI, GPT4ALL, Azure_OpenAI, LLAMA2, JINA, Ollama and COHERE. Embedchain allows users to import and utilize these LLM providers for their applications.'
|
||||
```
|
||||
@@ -0,0 +1,50 @@
|
||||
---
|
||||
title: 📝 Github
|
||||
---
|
||||
|
||||
1. Setup the Github loader by configuring the Github account with username and personal access token (PAT). Check out [this](https://docs.github.com/en/enterprise-server@3.6/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#creating-a-personal-access-token) link to learn how to create a PAT.
|
||||
```Python
|
||||
from embedchain.loaders.github import GithubLoader
|
||||
|
||||
loader = GithubLoader(
|
||||
config={
|
||||
"token":"ghp_xxxx"
|
||||
}
|
||||
)
|
||||
```
|
||||
|
||||
2. Once you setup the loader, you can create an app and load data using the above Github loader
|
||||
```Python
|
||||
import os
|
||||
from embedchain.pipeline import Pipeline as App
|
||||
|
||||
os.environ["OPENAI_API_KEY"] = "sk-xxxx"
|
||||
|
||||
app = App()
|
||||
|
||||
app.add("repo:embedchain/embedchain type:repo", data_type="github", loader=loader)
|
||||
|
||||
response = app.query("What is Embedchain?")
|
||||
# Answer: Embedchain is a Data Platform for Large Language Models (LLMs). It allows users to seamlessly load, index, retrieve, and sync unstructured data in order to build dynamic, LLM-powered applications. There is also a JavaScript implementation called embedchain-js available on GitHub.
|
||||
```
|
||||
The `add` function of the app will accept any valid github query with qualifiers. It only supports loading github code, repository, issues and pull-requests.
|
||||
<Note>
|
||||
You must provide qualifiers `type:` and `repo:` in the query. The `type:` qualifier can be a combination of `code`, `repo`, `pr`, `issue`. The `repo:` qualifier must be a valid github repository name.
|
||||
</Note>
|
||||
|
||||
<Card title="Valid queries" icon="lightbulb" iconType="duotone" color="#ca8b04">
|
||||
- `repo:embedchain/embedchain type:repo` - to load the repository
|
||||
- `repo:embedchain/embedchain type:issue,pr` - to load the issues and pull-requests of the repository
|
||||
- `repo:embedchain/embedchain type:issue state:closed` - to load the closed issues of the repository
|
||||
</Card>
|
||||
|
||||
3. We automatically create a chunker to chunk your GitHub data, however if you wish to provide your own chunker class. Here is how you can do that:
|
||||
```Python
|
||||
from embedchain.chunkers.common_chunker import CommonChunker
|
||||
from embedchain.config.add_config import ChunkerConfig
|
||||
|
||||
github_chunker_config = ChunkerConfig(chunk_size=2000, chunk_overlap=0, length_function=len)
|
||||
github_chunker = CommonChunker(config=github_chunker_config)
|
||||
|
||||
app.add(load_query, data_type="github", loader=loader, chunker=github_chunker)
|
||||
```
|
||||
@@ -0,0 +1,47 @@
|
||||
---
|
||||
title: '🐬 MySQL'
|
||||
---
|
||||
|
||||
1. Setup the MySQL loader by configuring the SQL db.
|
||||
```Python
|
||||
from embedchain.loaders.mysql import MySQLLoader
|
||||
|
||||
config = {
|
||||
"host": "host",
|
||||
"port": "port",
|
||||
"database": "database",
|
||||
"user": "username",
|
||||
"password": "password",
|
||||
}
|
||||
|
||||
mysql_loader = MySQLLoader(config=config)
|
||||
```
|
||||
|
||||
For more details on how to setup with valid config, check MySQL [documentation](https://dev.mysql.com/doc/connector-python/en/connector-python-connectargs.html).
|
||||
|
||||
2. Once you setup the loader, you can create an app and load data using the above MySQL loader
|
||||
```Python
|
||||
from embedchain.pipeline import Pipeline as App
|
||||
|
||||
app = App()
|
||||
|
||||
app.add("SELECT * FROM table_name;", data_type='mysql', loader=mysql_loader)
|
||||
# Adds `(1, 'What is your net worth, Elon Musk?', "As of October 2023, Elon Musk's net worth is $255.2 billion.")`
|
||||
|
||||
response = app.query(question)
|
||||
# Answer: As of October 2023, Elon Musk's net worth is $255.2 billion.
|
||||
```
|
||||
|
||||
NOTE: The `add` function of the app will accept any executable query to load data. DO NOT pass the `CREATE`, `INSERT` queries in `add` function.
|
||||
|
||||
3. We automatically create a chunker to chunk your SQL data, however if you wish to provide your own chunker class. Here is how you can do that:
|
||||
``Python
|
||||
|
||||
from embedchain.chunkers.mysql import MySQLChunker
|
||||
from embedchain.config.add_config import ChunkerConfig
|
||||
|
||||
mysql_chunker_config = ChunkerConfig(chunk_size=1000, chunk_overlap=0, length_function=len)
|
||||
mysql_chunker = MySQLChunker(config=mysql_chunker_config)
|
||||
|
||||
app.add("SELECT * FROM table_name;", data_type='mysql', loader=mysql_loader, chunker=mysql_chunker)
|
||||
```
|
||||
@@ -0,0 +1,37 @@
|
||||
---
|
||||
title: Overview
|
||||
---
|
||||
|
||||
Embedchain comes with built-in support for various data sources. We handle the complexity of loading unstructured data from these data sources, allowing you to easily customize your app through a user-friendly interface.
|
||||
|
||||
<CardGroup cols={4}>
|
||||
<Card title="📰 PDF file" href="/components/data-sources/pdf-file"></Card>
|
||||
<Card title="📊 CSV file" href="/components/data-sources/csv"></Card>
|
||||
<Card title="📃 JSON file" href="/components/data-sources/json"></Card>
|
||||
<Card title="📺 Youtube" href="/components/data-sources/youtube-video"></Card>
|
||||
<Card title="📝 Text" href="/components/data-sources/text"></Card>
|
||||
<Card title="📚 Documentation website" href="/components/data-sources/docs-site"></Card>
|
||||
<Card title="📄 DOCX file" href="/components/data-sources/docx"></Card>
|
||||
<Card title="📝 MDX file" href="/components/data-sources/mdx"></Card>
|
||||
<Card title="📓 Notion" href="/components/data-sources/notion"></Card>
|
||||
<Card title="❓💬 Q&A pair" href="/components/data-sources/qna"></Card>
|
||||
<Card title="🗺️ Sitemap" href="/components/data-sources/sitemap"></Card>
|
||||
<Card title="🌐 Web page" href="/components/data-sources/web-page"></Card>
|
||||
<Card title="🧾 XML file" href="/components/data-sources/xml"></Card>
|
||||
<Card title="🙌 OpenAPI" href="/components/data-sources/openapi"></Card>
|
||||
<Card title="📬 Gmail" href="/components/data-sources/gmail"></Card>
|
||||
<Card title="🐘 Postgres" href="/components/data-sources/postgres"></Card>
|
||||
<Card title="🐬 MySQL" href="/components/data-sources/mysql"></Card>
|
||||
<Card title="🤖 Slack" href="/components/data-sources/slack"></Card>
|
||||
<Card title="🗨️ Discourse" href="/components/data-sources/discourse"></Card>
|
||||
<Card title="💬 Discord" href="/components/data-sources/discord"></Card>
|
||||
<Card title="📝 Github" href="/components/data-sources/github"></Card>
|
||||
<Card title="⚙️ Custom" href="/components/data-sources/custom"></Card>
|
||||
<Card title="📝 Substack" href="/components/data-sources/substack"></Card>
|
||||
<Card title="🐝 Beehiiv" href="/components/data-sources/beehiiv"></Card>
|
||||
<Card title="📁 Directory" href="/components/data-sources/directory"></Card>
|
||||
</CardGroup>
|
||||
|
||||
<br/ >
|
||||
|
||||
<Snippet file="missing-data-source-tip.mdx" />
|
||||
@@ -0,0 +1,71 @@
|
||||
---
|
||||
title: '🤖 Slack'
|
||||
---
|
||||
|
||||
## Pre-requisite
|
||||
- Download required packages by running `pip install --upgrade "embedchain[slack]"`.
|
||||
- Configure your slack bot token as environment variable `SLACK_USER_TOKEN`.
|
||||
- Find your user token on your [Slack Account](https://api.slack.com/authentication/token-types)
|
||||
- Make sure your slack user token includes [search](https://api.slack.com/scopes/search:read) scope.
|
||||
|
||||
## Example
|
||||
|
||||
### Get Started
|
||||
|
||||
This will automatically retrieve data from the workspace associated with the user's token.
|
||||
|
||||
```python
|
||||
import os
|
||||
from embedchain import Pipeline as App
|
||||
|
||||
os.environ["SLACK_USER_TOKEN"] = "xoxp-xxx"
|
||||
app = App()
|
||||
|
||||
app.add("in:general", data_type="slack")
|
||||
|
||||
result = app.query("what are the messages in general channel?")
|
||||
|
||||
print(result)
|
||||
```
|
||||
|
||||
|
||||
### Customize your SlackLoader
|
||||
1. Setup the Slack loader by configuring the Slack Webclient.
|
||||
```Python
|
||||
from embedchain.loaders.slack import SlackLoader
|
||||
|
||||
os.environ["SLACK_USER_TOKEN"] = "xoxp-*"
|
||||
|
||||
config = {
|
||||
'base_url': slack_app_url,
|
||||
'headers': web_headers,
|
||||
'team_id': slack_team_id,
|
||||
}
|
||||
|
||||
loader = SlackLoader(config)
|
||||
```
|
||||
|
||||
NOTE: you can also pass the `config` with `base_url`, `headers`, `team_id` to setup your SlackLoader.
|
||||
|
||||
2. Once you setup the loader, you can create an app and load data using the above slack loader
|
||||
```Python
|
||||
import os
|
||||
from embedchain.pipeline import Pipeline as App
|
||||
|
||||
app = App()
|
||||
|
||||
app.add("in:random", data_type="slack", loader=loader)
|
||||
question = "Which bots are available in the slack workspace's random channel?"
|
||||
# Answer: The available bot in the slack workspace's random channel is the Embedchain bot.
|
||||
```
|
||||
|
||||
3. We automatically create a chunker to chunk your slack data, however if you wish to provide your own chunker class. Here is how you can do that:
|
||||
```Python
|
||||
from embedchain.chunkers.slack import SlackChunker
|
||||
from embedchain.config.add_config import ChunkerConfig
|
||||
|
||||
slack_chunker_config = ChunkerConfig(chunk_size=1000, chunk_overlap=0, length_function=len)
|
||||
slack_chunker = SlackChunker(config=slack_chunker_config)
|
||||
|
||||
app.add(slack_chunker, data_type="slack", loader=loader, chunker=slack_chunker)
|
||||
```
|
||||
@@ -0,0 +1,16 @@
|
||||
---
|
||||
title: "📝 Substack"
|
||||
---
|
||||
|
||||
To add any Substack data sources to your app, just add the main base url as the source and set the data_type to `substack`.
|
||||
|
||||
```python
|
||||
from embedchain import Pipeline as App
|
||||
|
||||
app = App()
|
||||
|
||||
# source: for any substack just add the root URL
|
||||
app.add('https://www.lennysnewsletter.com', data_type='substack')
|
||||
app.query("Who is Brian Chesky?")
|
||||
# Answer: Brian Chesky is the co-founder and CEO of Airbnb.
|
||||
```
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: '🌐📄 Web page'
|
||||
title: '🌐 Web page'
|
||||
---
|
||||
|
||||
To add any web page, use the data_type as `web_page`. Eg:
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: '🎥📺 Youtube video'
|
||||
title: '📺 Youtube'
|
||||
---
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ Embedchain supports several embedding models from the following providers:
|
||||
|
||||
<CardGroup cols={4}>
|
||||
<Card title="OpenAI" href="#openai"></Card>
|
||||
<Card title="GoogleAI" href="#google-ai"></Card>
|
||||
<Card title="Azure OpenAI" href="#azure-openai"></Card>
|
||||
<Card title="GPT4All" href="#gpt4all"></Card>
|
||||
<Card title="Hugging Face" href="#hugging-face"></Card>
|
||||
@@ -29,7 +30,7 @@ from embedchain import Pipeline as App
|
||||
os.environ['OPENAI_API_KEY'] = 'xxx'
|
||||
|
||||
# load embedding model configuration from config.yaml file
|
||||
app = App.from_config(yaml_path="config.yaml")
|
||||
app = App.from_config(config_path="config.yaml")
|
||||
|
||||
app.add("https://en.wikipedia.org/wiki/OpenAI")
|
||||
app.query("What is OpenAI?")
|
||||
@@ -44,6 +45,34 @@ embedder:
|
||||
|
||||
</CodeGroup>
|
||||
|
||||
## Google AI
|
||||
|
||||
To use Google AI embedding function, you have to set the `GOOGLE_API_KEY` environment variable. You can obtain the Google API key from the [Google Maker Suite](https://makersuite.google.com/app/apikey)
|
||||
|
||||
<CodeGroup>
|
||||
```python main.py
|
||||
import os
|
||||
from embedchain import Pipeline as App
|
||||
|
||||
os.environ["GOOGLE_API_KEY"] = "xxx"
|
||||
|
||||
app = App.from_config(config_path="config.yaml")
|
||||
```
|
||||
|
||||
```yaml config.yaml
|
||||
embedder:
|
||||
provider: google
|
||||
config:
|
||||
model: 'models/embedding-001'
|
||||
task_type: "retrieval_document"
|
||||
title: "Embeddings for Embedchain"
|
||||
```
|
||||
</CodeGroup>
|
||||
<br/>
|
||||
<Note>
|
||||
For more details regarding the Google AI embedding model, please refer to the [Google AI documentation](https://ai.google.dev/tutorials/python_quickstart#use_embeddings).
|
||||
</Note>
|
||||
|
||||
## Azure OpenAI
|
||||
|
||||
To use Azure OpenAI embedding model, you have to set some of the azure openai related environment variables as given in the code block below:
|
||||
@@ -55,11 +84,11 @@ import os
|
||||
from embedchain import Pipeline as App
|
||||
|
||||
os.environ["OPENAI_API_TYPE"] = "azure"
|
||||
os.environ["OPENAI_API_BASE"] = "https://xxx.openai.azure.com/"
|
||||
os.environ["OPENAI_API_KEY"] = "xxx"
|
||||
os.environ["AZURE_OPENAI_ENDPOINT"] = "https://xxx.openai.azure.com/"
|
||||
os.environ["AZURE_OPENAI_API_KEY"] = "xxx"
|
||||
os.environ["OPENAI_API_VERSION"] = "xxx"
|
||||
|
||||
app = App.from_config(yaml_path="config.yaml")
|
||||
app = App.from_config(config_path="config.yaml")
|
||||
```
|
||||
|
||||
```yaml config.yaml
|
||||
@@ -93,7 +122,7 @@ GPT4All supports generating high quality embeddings of arbitrary length document
|
||||
from embedchain import Pipeline as App
|
||||
|
||||
# load embedding model configuration from config.yaml file
|
||||
app = App.from_config(yaml_path="config.yaml")
|
||||
app = App.from_config(config_path="config.yaml")
|
||||
```
|
||||
|
||||
```yaml config.yaml
|
||||
@@ -122,7 +151,7 @@ Hugging Face supports generating embeddings of arbitrary length documents of tex
|
||||
from embedchain import Pipeline as App
|
||||
|
||||
# load embedding model configuration from config.yaml file
|
||||
app = App.from_config(yaml_path="config.yaml")
|
||||
app = App.from_config(config_path="config.yaml")
|
||||
```
|
||||
|
||||
```yaml config.yaml
|
||||
@@ -153,7 +182,7 @@ Embedchain supports Google's VertexAI embeddings model through a simple interfac
|
||||
from embedchain import Pipeline as App
|
||||
|
||||
# load embedding model configuration from config.yaml file
|
||||
app = App.from_config(yaml_path="config.yaml")
|
||||
app = App.from_config(config_path="config.yaml")
|
||||
```
|
||||
|
||||
```yaml config.yaml
|
||||
|
||||
+200
-11
@@ -8,9 +8,11 @@ Embedchain comes with built-in support for various popular large language models
|
||||
|
||||
<CardGroup cols={4}>
|
||||
<Card title="OpenAI" href="#openai"></Card>
|
||||
<Card title="Google AI" href="#google-ai"></Card>
|
||||
<Card title="Azure OpenAI" href="#azure-openai"></Card>
|
||||
<Card title="Anthropic" href="#anthropic"></Card>
|
||||
<Card title="Cohere" href="#cohere"></Card>
|
||||
<Card title="Ollama" href="#Ollama"></Card>
|
||||
<Card title="GPT4All" href="#gpt4all"></Card>
|
||||
<Card title="JinaChat" href="#jinachat"></Card>
|
||||
<Card title="Hugging Face" href="#hugging-face"></Card>
|
||||
@@ -46,7 +48,7 @@ from embedchain import Pipeline as App
|
||||
os.environ['OPENAI_API_KEY'] = 'xxx'
|
||||
|
||||
# load llm configuration from config.yaml file
|
||||
app = App.from_config(yaml_path="config.yaml")
|
||||
app = App.from_config(config_path="config.yaml")
|
||||
```
|
||||
|
||||
```yaml config.yaml
|
||||
@@ -59,9 +61,170 @@ llm:
|
||||
top_p: 1
|
||||
stream: false
|
||||
```
|
||||
|
||||
</CodeGroup>
|
||||
|
||||
### Function Calling
|
||||
To enable [function calling](https://platform.openai.com/docs/guides/function-calling) in your application using embedchain and OpenAI, you need to pass functions into `OpenAILlm` class as an array of functions. Here are several ways in which you can achieve that:
|
||||
|
||||
Examples:
|
||||
<Accordion title="Using Pydantic Models">
|
||||
```python
|
||||
import os
|
||||
from embedchain import Pipeline as App
|
||||
from embedchain.llm.openai import OpenAILlm
|
||||
import requests
|
||||
from pydantic import BaseModel, Field, ValidationError, field_validator
|
||||
|
||||
os.environ["OPENAI_API_KEY"] = "sk-xxx"
|
||||
|
||||
class QA(BaseModel):
|
||||
"""
|
||||
A question and answer pair.
|
||||
"""
|
||||
|
||||
question: str = Field(
|
||||
..., description="The question.", example="What is a mountain?"
|
||||
)
|
||||
answer: str = Field(
|
||||
..., description="The answer.", example="A mountain is a hill."
|
||||
)
|
||||
person_who_is_asking: str = Field(
|
||||
..., description="The person who is asking the question.", example="John"
|
||||
)
|
||||
|
||||
@field_validator("question")
|
||||
def question_must_end_with_a_question_mark(cls, v):
|
||||
"""
|
||||
Validate that the question ends with a question mark.
|
||||
"""
|
||||
if not v.endswith("?"):
|
||||
raise ValueError("question must end with a question mark")
|
||||
return v
|
||||
|
||||
@field_validator("answer")
|
||||
def answer_must_end_with_a_period(cls, v):
|
||||
"""
|
||||
Validate that the answer ends with a period.
|
||||
"""
|
||||
if not v.endswith("."):
|
||||
raise ValueError("answer must end with a period")
|
||||
return v
|
||||
|
||||
llm = OpenAILlm(config=None,functions=[QA])
|
||||
app = App(llm=llm)
|
||||
|
||||
result = app.query("Hey I am Sid. What is a mountain? A mountain is a hill.")
|
||||
|
||||
print(result)
|
||||
```
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="Using OpenAI JSON schema">
|
||||
```python
|
||||
import os
|
||||
from embedchain import Pipeline as App
|
||||
from embedchain.llm.openai import OpenAILlm
|
||||
import requests
|
||||
from pydantic import BaseModel, Field, ValidationError, field_validator
|
||||
|
||||
os.environ["OPENAI_API_KEY"] = "sk-xxx"
|
||||
|
||||
json_schema = {
|
||||
"name": "get_qa",
|
||||
"description": "A question and answer pair and the user who is asking the question.",
|
||||
"parameters": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"question": {"type": "string", "description": "The question."},
|
||||
"answer": {"type": "string", "description": "The answer."},
|
||||
"person_who_is_asking": {
|
||||
"type": "string",
|
||||
"description": "The person who is asking the question.",
|
||||
}
|
||||
},
|
||||
"required": ["question", "answer", "person_who_is_asking"],
|
||||
},
|
||||
}
|
||||
|
||||
llm = OpenAILlm(config=None,functions=[json_schema])
|
||||
app = App(llm=llm)
|
||||
|
||||
result = app.query("Hey I am Sid. What is a mountain? A mountain is a hill.")
|
||||
|
||||
print(result)
|
||||
```
|
||||
</Accordion>
|
||||
<Accordion title="Using actual python functions">
|
||||
```python
|
||||
import os
|
||||
from embedchain import Pipeline as App
|
||||
from embedchain.llm.openai import OpenAILlm
|
||||
import requests
|
||||
from pydantic import BaseModel, Field, ValidationError, field_validator
|
||||
|
||||
os.environ["OPENAI_API_KEY"] = "sk-xxx"
|
||||
|
||||
def find_info_of_pokemon(pokemon: str):
|
||||
"""
|
||||
Find the information of the given pokemon.
|
||||
Args:
|
||||
pokemon: The pokemon.
|
||||
"""
|
||||
req = requests.get(f"https://pokeapi.co/api/v2/pokemon/{pokemon}")
|
||||
if req.status_code == 404:
|
||||
raise ValueError("pokemon not found")
|
||||
return req.json()
|
||||
|
||||
llm = OpenAILlm(config=None,functions=[find_info_of_pokemon])
|
||||
app = App(llm=llm)
|
||||
|
||||
result = app.query("Tell me more about the pokemon pikachu.")
|
||||
|
||||
print(result)
|
||||
```
|
||||
</Accordion>
|
||||
|
||||
## Google AI
|
||||
|
||||
To use Google AI model, you have to set the `GOOGLE_API_KEY` environment variable. You can obtain the Google API key from the [Google Maker Suite](https://makersuite.google.com/app/apikey)
|
||||
|
||||
<CodeGroup>
|
||||
```python main.py
|
||||
import os
|
||||
from embedchain import Pipeline as App
|
||||
|
||||
os.environ["GOOGLE_API_KEY"] = "xxx"
|
||||
|
||||
app = App.from_config(config_path="config.yaml")
|
||||
|
||||
app.add("https://www.forbes.com/profile/elon-musk")
|
||||
|
||||
response = app.query("What is the net worth of Elon Musk?")
|
||||
if app.llm.config.stream: # if stream is enabled, response is a generator
|
||||
for chunk in response:
|
||||
print(chunk)
|
||||
else:
|
||||
print(response)
|
||||
```
|
||||
|
||||
```yaml config.yaml
|
||||
llm:
|
||||
provider: google
|
||||
config:
|
||||
model: gemini-pro
|
||||
max_tokens: 1000
|
||||
temperature: 0.5
|
||||
top_p: 1
|
||||
stream: false
|
||||
|
||||
embedder:
|
||||
provider: google
|
||||
config:
|
||||
model: 'models/embedding-001'
|
||||
task_type: "retrieval_document"
|
||||
title: "Embeddings for Embedchain"
|
||||
```
|
||||
</CodeGroup>
|
||||
|
||||
## Azure OpenAI
|
||||
|
||||
@@ -78,7 +241,7 @@ os.environ["OPENAI_API_BASE"] = "https://xxx.openai.azure.com/"
|
||||
os.environ["OPENAI_API_KEY"] = "xxx"
|
||||
os.environ["OPENAI_API_VERSION"] = "xxx"
|
||||
|
||||
app = App.from_config(yaml_path="config.yaml")
|
||||
app = App.from_config(config_path="config.yaml")
|
||||
```
|
||||
|
||||
```yaml config.yaml
|
||||
@@ -115,7 +278,7 @@ from embedchain import Pipeline as App
|
||||
os.environ["ANTHROPIC_API_KEY"] = "xxx"
|
||||
|
||||
# load llm configuration from config.yaml file
|
||||
app = App.from_config(yaml_path="config.yaml")
|
||||
app = App.from_config(config_path="config.yaml")
|
||||
```
|
||||
|
||||
```yaml config.yaml
|
||||
@@ -152,7 +315,7 @@ from embedchain import Pipeline as App
|
||||
os.environ["COHERE_API_KEY"] = "xxx"
|
||||
|
||||
# load llm configuration from config.yaml file
|
||||
app = App.from_config(yaml_path="config.yaml")
|
||||
app = App.from_config(config_path="config.yaml")
|
||||
```
|
||||
|
||||
```yaml config.yaml
|
||||
@@ -167,6 +330,32 @@ llm:
|
||||
|
||||
</CodeGroup>
|
||||
|
||||
## Ollama
|
||||
|
||||
Setup Ollama using https://github.com/jmorganca/ollama
|
||||
|
||||
<CodeGroup>
|
||||
|
||||
```python main.py
|
||||
import os
|
||||
from embedchain import Pipeline as App
|
||||
|
||||
# load llm configuration from config.yaml file
|
||||
app = App.from_config(config_path="config.yaml")
|
||||
```
|
||||
|
||||
```yaml config.yaml
|
||||
llm:
|
||||
provider: ollama
|
||||
config:
|
||||
model: 'llama2'
|
||||
temperature: 0.5
|
||||
top_p: 1
|
||||
stream: true
|
||||
```
|
||||
|
||||
</CodeGroup>
|
||||
|
||||
## GPT4ALL
|
||||
|
||||
Install related dependencies using the following command:
|
||||
@@ -183,7 +372,7 @@ GPT4all is a free-to-use, locally running, privacy-aware chatbot. No GPU or inte
|
||||
from embedchain import Pipeline as App
|
||||
|
||||
# load llm configuration from config.yaml file
|
||||
app = App.from_config(yaml_path="config.yaml")
|
||||
app = App.from_config(config_path="config.yaml")
|
||||
```
|
||||
|
||||
```yaml config.yaml
|
||||
@@ -216,7 +405,7 @@ from embedchain import Pipeline as App
|
||||
|
||||
os.environ["JINACHAT_API_KEY"] = "xxx"
|
||||
# load llm configuration from config.yaml file
|
||||
app = App.from_config(yaml_path="config.yaml")
|
||||
app = App.from_config(config_path="config.yaml")
|
||||
```
|
||||
|
||||
```yaml config.yaml
|
||||
@@ -237,7 +426,7 @@ llm:
|
||||
Install related dependencies using the following command:
|
||||
|
||||
```bash
|
||||
pip install --upgrade 'embedchain[huggingface_hub]'
|
||||
pip install --upgrade 'embedchain[huggingface-hub]'
|
||||
```
|
||||
|
||||
First, set `HUGGINGFACE_ACCESS_TOKEN` in environment variable which you can obtain from [their platform](https://huggingface.co/settings/tokens).
|
||||
@@ -253,7 +442,7 @@ from embedchain import Pipeline as App
|
||||
os.environ["HUGGINGFACE_ACCESS_TOKEN"] = "xxx"
|
||||
|
||||
# load llm configuration from config.yaml file
|
||||
app = App.from_config(yaml_path="config.yaml")
|
||||
app = App.from_config(config_path="config.yaml")
|
||||
```
|
||||
|
||||
```yaml config.yaml
|
||||
@@ -283,7 +472,7 @@ from embedchain import Pipeline as App
|
||||
os.environ["REPLICATE_API_TOKEN"] = "xxx"
|
||||
|
||||
# load llm configuration from config.yaml file
|
||||
app = App.from_config(yaml_path="config.yaml")
|
||||
app = App.from_config(config_path="config.yaml")
|
||||
```
|
||||
|
||||
```yaml config.yaml
|
||||
@@ -308,7 +497,7 @@ Setup Google Cloud Platform application credentials by following the instruction
|
||||
from embedchain import Pipeline as App
|
||||
|
||||
# load llm configuration from config.yaml file
|
||||
app = App.from_config(yaml_path="config.yaml")
|
||||
app = App.from_config(config_path="config.yaml")
|
||||
```
|
||||
|
||||
```yaml config.yaml
|
||||
|
||||
@@ -25,7 +25,7 @@ Utilizing a vector database alongside Embedchain is a seamless process. All you
|
||||
from embedchain import Pipeline as App
|
||||
|
||||
# load chroma configuration from yaml file
|
||||
app = App.from_config(yaml_path="config1.yaml")
|
||||
app = App.from_config(config_path="config1.yaml")
|
||||
```
|
||||
|
||||
```yaml config1.yaml
|
||||
@@ -58,13 +58,19 @@ Install related dependencies using the following command:
|
||||
pip install --upgrade 'embedchain[elasticsearch]'
|
||||
```
|
||||
|
||||
<Note>
|
||||
You can configure the Elasticsearch connection by providing either `es_url` or `cloud_id`. If you are using the Elasticsearch Service on Elastic Cloud, you can find the `cloud_id` on the [Elastic Cloud dashboard](https://cloud.elastic.co/deployments).
|
||||
</Note>
|
||||
|
||||
You can authorize the connection to Elasticsearch by providing either `basic_auth`, `api_key`, or `bearer_auth`.
|
||||
|
||||
<CodeGroup>
|
||||
|
||||
```python main.py
|
||||
from embedchain import Pipeline as App
|
||||
|
||||
# load elasticsearch configuration from yaml file
|
||||
app = App.from_config(yaml_path="config.yaml")
|
||||
app = App.from_config(config_path="config.yaml")
|
||||
```
|
||||
|
||||
```yaml config.yaml
|
||||
@@ -72,9 +78,11 @@ vectordb:
|
||||
provider: elasticsearch
|
||||
config:
|
||||
collection_name: 'es-index'
|
||||
es_url: http://localhost:9200
|
||||
allow_reset: true
|
||||
api_key: xxx
|
||||
cloud_id: 'deployment-name:xxxx'
|
||||
basic_auth:
|
||||
- elastic
|
||||
- <your_password>
|
||||
verify_certs: false
|
||||
```
|
||||
</CodeGroup>
|
||||
|
||||
@@ -92,19 +100,19 @@ pip install --upgrade 'embedchain[opensearch]'
|
||||
from embedchain import Pipeline as App
|
||||
|
||||
# load opensearch configuration from yaml file
|
||||
app = App.from_config(yaml_path="config.yaml")
|
||||
app = App.from_config(config_path="config.yaml")
|
||||
```
|
||||
|
||||
```yaml config.yaml
|
||||
vectordb:
|
||||
provider: opensearch
|
||||
config:
|
||||
collection_name: 'my-app'
|
||||
opensearch_url: 'https://localhost:9200'
|
||||
http_auth:
|
||||
- admin
|
||||
- admin
|
||||
vector_dimension: 1536
|
||||
collection_name: 'my-app'
|
||||
use_ssl: false
|
||||
verify_certs: false
|
||||
```
|
||||
@@ -131,7 +139,7 @@ os.environ['ZILLIZ_CLOUD_URI'] = 'https://xxx.zillizcloud.com'
|
||||
os.environ['ZILLIZ_CLOUD_TOKEN'] = 'xxx'
|
||||
|
||||
# load zilliz configuration from yaml file
|
||||
app = App.from_config(yaml_path="config.yaml")
|
||||
app = App.from_config(config_path="config.yaml")
|
||||
```
|
||||
|
||||
```yaml config.yaml
|
||||
@@ -167,7 +175,7 @@ In order to use Pinecone as vector database, set the environment variables `PINE
|
||||
from embedchain import Pipeline as App
|
||||
|
||||
# load pinecone configuration from yaml file
|
||||
app = App.from_config(yaml_path="config.yaml")
|
||||
app = App.from_config(config_path="config.yaml")
|
||||
```
|
||||
|
||||
```yaml config.yaml
|
||||
@@ -190,7 +198,7 @@ In order to use Qdrant as a vector database, set the environment variables `QDRA
|
||||
from embedchain import Pipeline as App
|
||||
|
||||
# load qdrant configuration from yaml file
|
||||
app = App.from_config(yaml_path="config.yaml")
|
||||
app = App.from_config(config_path="config.yaml")
|
||||
```
|
||||
|
||||
```yaml config.yaml
|
||||
@@ -210,7 +218,7 @@ In order to use Weaviate as a vector database, set the environment variables `WE
|
||||
from embedchain import Pipeline as App
|
||||
|
||||
# load weaviate configuration from yaml file
|
||||
app = App.from_config(yaml_path="config.yaml")
|
||||
app = App.from_config(config_path="config.yaml")
|
||||
```
|
||||
|
||||
```yaml config.yaml
|
||||
|
||||
@@ -22,17 +22,6 @@ make lint format
|
||||
|
||||
5. **Create a pull request**: When you are ready to contribute your changes, submit a pull request to the EmbedChain repository. Provide a clear and descriptive title for your pull request, along with a detailed description of the changes you have made.
|
||||
|
||||
# Tech Stack
|
||||
|
||||
embedchain is built on the following stack:
|
||||
|
||||
- [Langchain](https://github.com/hwchase17/langchain) as an LLM framework to load, chunk and index data
|
||||
- [OpenAI's Ada embedding model](https://platform.openai.com/docs/guides/embeddings) to create embeddings
|
||||
- [OpenAI's ChatGPT API](https://platform.openai.com/docs/guides/gpt/chat-completions-api) as LLM to get answers given the context
|
||||
- [Chroma](https://github.com/chroma-core/chroma) as the vector database to store embeddings
|
||||
- [gpt4all](https://github.com/nomic-ai/gpt4all) as an open source LLM
|
||||
- [sentence-transformers](https://huggingface.co/sentence-transformers) as open source embedding model
|
||||
|
||||
## Team
|
||||
|
||||
### Authors
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
---
|
||||
title: Overview
|
||||
---
|
||||
|
||||
Embedchain comes with built-in support for various data sources. We handle the complexity of loading unstructured data from these data sources, allowing you to easily customize your app through a user-friendly interface.
|
||||
|
||||
<CardGroup cols={4}>
|
||||
<Card title="📊 csv" href="/data-sources/csv"></Card>
|
||||
<Card title="📃 JSON" href="/data-sources/json"></Card>
|
||||
<Card title="📚🌐 docs site" href="/data-sources/docs-site"></Card>
|
||||
<Card title="📄 docx" href="/data-sources/docx"></Card>
|
||||
<Card title="📝 mdx" href="/data-sources/mdx"></Card>
|
||||
<Card title="📓 notion" href="/data-sources/notion"></Card>
|
||||
<Card title="📰 pdf" href="/data-sources/pdf-file"></Card>
|
||||
<Card title="❓💬 q&a pair" href="/data-sources/qna"></Card>
|
||||
<Card title="🗺️ sitemap" href="/data-sources/sitemap"></Card>
|
||||
<Card title="📝 text" href="/data-sources/text"></Card>
|
||||
<Card title="🌐📄 web page" href="/data-sources/web-page"></Card>
|
||||
<Card title="🧾 xml" href="/data-sources/xml"></Card>
|
||||
<Card title="🙌 OpenAPI" href="/data-sources/openapi"></Card>
|
||||
<Card title="🎥📺 youtube video" href="/data-sources/youtube-video"></Card>
|
||||
<Card title="📬 Gmail" href="/data-sources/gmail"></Card>
|
||||
<Card title="🐘 Postgres" href="/data-sources/postgres"></Card>
|
||||
</CardGroup>
|
||||
|
||||
<br/ >
|
||||
|
||||
<Snippet file="missing-data-source-tip.mdx" />
|
||||
@@ -0,0 +1,38 @@
|
||||
---
|
||||
title: 'Embedchain.ai'
|
||||
description: 'Deploy your RAG application to embedchain.ai platform'
|
||||
---
|
||||
|
||||
## Deploy on Embedchain Platform
|
||||
|
||||
Embedchain enables developers to deploy their LLM-powered apps in production using the [Embedchain platform](https://app.embedchain.ai). The platform offers free access to context on your data through its REST API. Once the pipeline is deployed, you can update your data sources anytime after deployment.
|
||||
|
||||
See the example below on how to use the deploy your app (for free):
|
||||
|
||||
```python
|
||||
from embedchain import Pipeline as App
|
||||
|
||||
# Initialize app
|
||||
app = App()
|
||||
|
||||
# Add data source
|
||||
app.add("https://www.forbes.com/profile/elon-musk")
|
||||
|
||||
# Deploy your pipeline to Embedchain Platform
|
||||
app.deploy()
|
||||
|
||||
# 🔑 Enter your Embedchain API key. You can find the API key at https://app.embedchain.ai/settings/keys/
|
||||
# ec-xxxxxx
|
||||
|
||||
# 🛠️ Creating pipeline on the platform...
|
||||
# 🎉🎉🎉 Pipeline created successfully! View your pipeline: https://app.embedchain.ai/pipelines/xxxxx
|
||||
|
||||
# 🛠️ Adding data to your pipeline...
|
||||
# ✅ Data of type: web_page, value: https://www.forbes.com/profile/elon-musk added successfully.
|
||||
```
|
||||
|
||||
## 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" />
|
||||
@@ -0,0 +1,101 @@
|
||||
---
|
||||
title: 'Fly.io'
|
||||
description: 'Deploy your RAG application to fly.io platform'
|
||||
---
|
||||
|
||||
Embedchain has a nice and simple abstraction on top of the [Fly.io](https://fly.io/) tools to let developers deploy RAG application to fly.io platform seamlessly.
|
||||
|
||||
Follow the instructions given below to deploy your first application quickly:
|
||||
|
||||
|
||||
## Step-1: Install flyctl command line
|
||||
|
||||
<CodeGroup>
|
||||
```bash OSX
|
||||
brew install flyctl
|
||||
```
|
||||
|
||||
```bash Linux
|
||||
curl -L https://fly.io/install.sh | sh
|
||||
```
|
||||
|
||||
```bash Windows
|
||||
pwsh -Command "iwr https://fly.io/install.ps1 -useb | iex"
|
||||
```
|
||||
</CodeGroup>
|
||||
|
||||
Once you have installed the fly.io cli tool, signup/login to their platform using the following command:
|
||||
|
||||
<CodeGroup>
|
||||
```bash Sign up
|
||||
fly auth signup
|
||||
```
|
||||
|
||||
```bash Sign in
|
||||
fly auth login
|
||||
```
|
||||
</CodeGroup>
|
||||
|
||||
In case you run into issues, refer to official [fly.io docs](https://fly.io/docs/hands-on/install-flyctl/).
|
||||
|
||||
## Step-2: Create RAG app
|
||||
|
||||
We provide a command line utility called `ec` in embedchain that inherits the template for `fly.io` platform and help you deploy the app. Follow the instructions to create a fly.io app using the template provided:
|
||||
|
||||
```bash Install embedchain
|
||||
pip install embedchain
|
||||
```
|
||||
|
||||
```bash Create application
|
||||
mkdir my-rag-app
|
||||
ec create --template=fly.io
|
||||
```
|
||||
|
||||
This will generate a directory structure like this:
|
||||
|
||||
```bash
|
||||
├── Dockerfile
|
||||
├── app.py
|
||||
├── fly.toml
|
||||
├── .env
|
||||
├── .env.example
|
||||
├── embedchain.json
|
||||
└── requirements.txt
|
||||
```
|
||||
|
||||
Feel free to edit the files as required.
|
||||
- `Dockerfile`: Defines the steps to setup the application
|
||||
- `app.py`: Contains API app code
|
||||
- `fly.toml`: fly.io config file
|
||||
- `.env`: Contains environment variables for production
|
||||
- `.env.example`: Contains dummy environment variables (can ignore this file)
|
||||
- `embedchain.json`: Contains embedchain specific configuration for deployment (you don't need to configure this)
|
||||
- `requirements.txt`: Contains python dependencies for your application
|
||||
|
||||
## Step-3: Test app locally
|
||||
|
||||
You can run the app locally by simply doing:
|
||||
|
||||
```bash Run locally
|
||||
pip install -r requirements.txt
|
||||
ec dev
|
||||
```
|
||||
|
||||
## Step-4: Deploy to fly.io
|
||||
|
||||
You can deploy to fly.io using the following command:
|
||||
```bash Deploy app
|
||||
ec deploy
|
||||
```
|
||||
|
||||
Once this step finished, it will provide you with the deployment endpoint where you can access the app live. It will look something like this (Swagger docs):
|
||||
|
||||
You can also check the logs, monitor app status etc on their dashboard by running command `fly dashboard`.
|
||||
|
||||
<img src="/images/fly_io.png" />
|
||||
|
||||
## 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" />
|
||||
@@ -0,0 +1,59 @@
|
||||
---
|
||||
title: 'Gradio.app'
|
||||
description: 'Deploy your RAG application to gradio.app platform'
|
||||
---
|
||||
|
||||
Embedchain offers a Streamlit template to facilitate the development of RAG chatbot applications in just three easy steps.
|
||||
|
||||
Follow the instructions given below to deploy your first application quickly:
|
||||
|
||||
## Step-1: Create RAG app
|
||||
|
||||
We provide a command line utility called `ec` in embedchain that inherits the template for `gradio.app` platform and help you deploy the app. Follow the instructions to create a gradio.app app using the template provided:
|
||||
|
||||
```bash Install embedchain
|
||||
pip install embedchain
|
||||
```
|
||||
|
||||
```bash Create application
|
||||
mkdir my-rag-app
|
||||
ec create --template=gradio.app
|
||||
```
|
||||
|
||||
This will generate a directory structure like this:
|
||||
|
||||
```bash
|
||||
├── app.py
|
||||
├── embedchain.json
|
||||
└── requirements.txt
|
||||
```
|
||||
|
||||
Feel free to edit the files as required.
|
||||
- `app.py`: Contains API app code
|
||||
- `embedchain.json`: Contains embedchain specific configuration for deployment (you don't need to configure this)
|
||||
- `requirements.txt`: Contains python dependencies for your application
|
||||
|
||||
## Step-2: Test app locally
|
||||
|
||||
You can run the app locally by simply doing:
|
||||
|
||||
```bash Run locally
|
||||
pip install -r requirements.txt
|
||||
ec dev
|
||||
```
|
||||
|
||||
## Step-3: Deploy to gradio.app
|
||||
|
||||
```bash Deploy to gradio.app
|
||||
ec deploy
|
||||
```
|
||||
|
||||
This will run `gradio deploy` which will prompt you questions and deploy your app directly to huggingface spaces.
|
||||
|
||||
<img src="/images/gradio_app.png" alt="gradio app" />
|
||||
|
||||
## 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" />
|
||||
@@ -0,0 +1,103 @@
|
||||
---
|
||||
title: 'Huggingface.co'
|
||||
description: 'Deploy your RAG application to huggingface.co platform'
|
||||
---
|
||||
|
||||
With Embedchain, you can directly host your apps in just three steps to huggingface spaces where you can view and deploy your app to the world.
|
||||
|
||||
We support two types of deployment to huggingface spaces:
|
||||
|
||||
<CardGroup cols={2}>
|
||||
<Card title="" href="#using-streamlit-io">
|
||||
Streamlit.io
|
||||
</Card>
|
||||
<Card title="" href="#using-gradio-app">
|
||||
Gradio.app
|
||||
</Card>
|
||||
</CardGroup>
|
||||
|
||||
## Using streamlit.io
|
||||
|
||||
### Step 1: Create a new RAG app
|
||||
|
||||
Create a new RAG app using the following command:
|
||||
|
||||
```bash
|
||||
mkdir my-rag-app
|
||||
ec create --template=hf/streamlit.io # inside my-rag-app directory
|
||||
```
|
||||
|
||||
When you run this for the first time, you'll be asked to login to huggingface.co. Once you login, you'll need to create a **write** token. You can create a write token by going to [huggingface.co settings](https://huggingface.co/settings/token). Once you create a token, you'll be asked to enter the token in the terminal.
|
||||
|
||||
This will also create an `embedchain.json` file in your app directory. Add a `name` key into the `embedchain.json` file. This will be the "repo-name" of your app in huggingface spaces.
|
||||
|
||||
```json embedchain.json
|
||||
{
|
||||
"name": "my-rag-app",
|
||||
"provider": "hf/streamlit.io"
|
||||
}
|
||||
```
|
||||
|
||||
### Step-2: Test app locally
|
||||
|
||||
You can run the app locally by simply doing:
|
||||
|
||||
```bash Run locally
|
||||
pip install -r requirements.txt
|
||||
ec dev
|
||||
```
|
||||
|
||||
### Step-3: Deploy to huggingface spaces
|
||||
|
||||
```bash Deploy to huggingface spaces
|
||||
ec deploy
|
||||
```
|
||||
|
||||
This will deploy your app to huggingface spaces. You can view your app at `https://huggingface.co/spaces/<your-username>/my-rag-app`. This will get prompted in the terminal once the app is deployed.
|
||||
|
||||
## Using gradio.app
|
||||
|
||||
Similar to streamlit.io, you can deploy your app to gradio.app in just three steps.
|
||||
|
||||
### Step 1: Create a new RAG app
|
||||
|
||||
Create a new RAG app using the following command:
|
||||
|
||||
```bash
|
||||
mkdir my-rag-app
|
||||
ec create --template=hf/gradio.app # inside my-rag-app directory
|
||||
```
|
||||
|
||||
When you run this for the first time, you'll be asked to login to huggingface.co. Once you login, you'll need to create a **write** token. You can create a write token by going to [huggingface.co settings](https://huggingface.co/settings/token). Once you create a token, you'll be asked to enter the token in the terminal.
|
||||
|
||||
This will also create an `embedchain.json` file in your app directory. Add a `name` key into the `embedchain.json` file. This will be the "repo-name" of your app in huggingface spaces.
|
||||
|
||||
```json embedchain.json
|
||||
{
|
||||
"name": "my-rag-app",
|
||||
"provider": "hf/gradio.app"
|
||||
}
|
||||
```
|
||||
|
||||
### Step-2: Test app locally
|
||||
|
||||
You can run the app locally by simply doing:
|
||||
|
||||
```bash Run locally
|
||||
pip install -r requirements.txt
|
||||
ec dev
|
||||
```
|
||||
|
||||
### Step-3: Deploy to huggingface spaces
|
||||
|
||||
```bash Deploy to huggingface spaces
|
||||
ec deploy
|
||||
```
|
||||
|
||||
This will deploy your app to huggingface spaces. You can view your app at `https://huggingface.co/spaces/<your-username>/my-rag-app`. This will get prompted in the terminal once the app is deployed.
|
||||
|
||||
## 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" />
|
||||
@@ -0,0 +1,63 @@
|
||||
---
|
||||
title: 'Modal.com'
|
||||
description: 'Deploy your RAG application to modal.com platform'
|
||||
---
|
||||
|
||||
Embedchain has a nice and simple abstraction on top of the [Modal.com](https://modal.com/) tools to let developers deploy RAG application to modal.com platform seamlessly.
|
||||
|
||||
Follow the instructions given below to deploy your first application quickly:
|
||||
|
||||
|
||||
## Step-1 Create RAG application:
|
||||
|
||||
We provide a command line utility called `ec` in embedchain that inherits the template for `modal.com` platform and help you deploy the app. Follow the instructions to create a modal.com app using the template provided:
|
||||
|
||||
|
||||
```bash Create application
|
||||
pip install embedchain[modal]
|
||||
mkdir my-rag-app
|
||||
ec create --template=modal.com
|
||||
```
|
||||
|
||||
This `create` command will open a browser window and ask you to login to your modal.com account and will generate a directory structure like this:
|
||||
|
||||
```bash
|
||||
├── app.py
|
||||
├── .env
|
||||
├── .env.example
|
||||
├── embedchain.json
|
||||
└── requirements.txt
|
||||
```
|
||||
|
||||
Feel free to edit the files as required.
|
||||
- `app.py`: Contains API app code
|
||||
- `.env`: Contains environment variables for production
|
||||
- `.env.example`: Contains dummy environment variables (can ignore this file)
|
||||
- `embedchain.json`: Contains embedchain specific configuration for deployment (you don't need to configure this)
|
||||
- `requirements.txt`: Contains python dependencies for your FastAPI application
|
||||
|
||||
## Step-2: Test app locally
|
||||
|
||||
You can run the app locally by simply doing:
|
||||
|
||||
```bash Run locally
|
||||
pip install -r requirements.txt
|
||||
ec dev
|
||||
```
|
||||
|
||||
## Step-3: Deploy to modal.com
|
||||
|
||||
You can deploy to modal.com using the following command:
|
||||
```bash Deploy app
|
||||
ec deploy
|
||||
```
|
||||
|
||||
Once this step finished, it will provide you with the deployment endpoint where you can access the app live. It will look something like this (Swagger docs):
|
||||
|
||||
<img src="/images/fly_io.png" />
|
||||
|
||||
## 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" />
|
||||
@@ -0,0 +1,93 @@
|
||||
---
|
||||
title: 'Render.com'
|
||||
description: 'Deploy your RAG application to render.com platform'
|
||||
---
|
||||
|
||||
Embedchain has a nice and simple abstraction on top of the [render.com](https://render.com/) tools to let developers deploy RAG application to render.com platform seamlessly.
|
||||
|
||||
Follow the instructions given below to deploy your first application quickly:
|
||||
|
||||
## Step-1: Install `render` command line
|
||||
|
||||
<CodeGroup>
|
||||
```bash OSX
|
||||
brew tap render-oss/render
|
||||
brew install render
|
||||
```
|
||||
|
||||
```bash Linux
|
||||
# Make sure you have deno installed -> https://docs.render.com/docs/cli#from-source-unsupported-operating-systems
|
||||
git clone https://github.com/render-oss/render-cli
|
||||
cd render-cli
|
||||
make deps
|
||||
deno task run
|
||||
deno compile
|
||||
```
|
||||
|
||||
```bash Windows
|
||||
choco install rendercli
|
||||
```
|
||||
</CodeGroup>
|
||||
|
||||
In case you run into issues, refer to official [render.com docs](https://docs.render.com/docs/cli).
|
||||
|
||||
## Step-2 Create RAG application:
|
||||
|
||||
We provide a command line utility called `ec` in embedchain that inherits the template for `render.com` platform and help you deploy the app. Follow the instructions to create a render.com app using the template provided:
|
||||
|
||||
|
||||
```bash Create application
|
||||
pip install embedchain
|
||||
mkdir my-rag-app
|
||||
ec create --template=render.com
|
||||
```
|
||||
|
||||
This `create` command will open a browser window and ask you to login to your render.com account and will generate a directory structure like this:
|
||||
|
||||
```bash
|
||||
├── app.py
|
||||
├── .env
|
||||
├── render.yaml
|
||||
├── embedchain.json
|
||||
└── requirements.txt
|
||||
```
|
||||
|
||||
Feel free to edit the files as required.
|
||||
- `app.py`: Contains API app code
|
||||
- `.env`: Contains environment variables for production
|
||||
- `render.yaml`: Contains render.com specific configuration for deployment (configure this according to your needs, follow [this](https://docs.render.com/docs/blueprint-spec) for more info)
|
||||
- `embedchain.json`: Contains embedchain specific configuration for deployment (you don't need to configure this)
|
||||
- `requirements.txt`: Contains python dependencies for your application
|
||||
|
||||
## Step-3: Test app locally
|
||||
|
||||
You can run the app locally by simply doing:
|
||||
|
||||
```bash Run locally
|
||||
pip install -r requirements.txt
|
||||
ec dev
|
||||
```
|
||||
|
||||
## Step-4: Deploy to render.com
|
||||
|
||||
Before deploying to render.com, you only have to set up one thing.
|
||||
|
||||
In the render.yaml file, make sure to modify the repo key by inserting the URL of your Git repository where your application will be hosted. You can create a repository from [GitHub](https://github.com) or [GitLab](https://gitlab.com/users/sign_in).
|
||||
|
||||
After that, you're ready to deploy on render.com.
|
||||
|
||||
```bash Deploy app
|
||||
ec deploy
|
||||
```
|
||||
|
||||
When you run this, it should open up your render dashboard and you can see the app being deployed. You can find your hosted link over there only.
|
||||
|
||||
You can also check the logs, monitor app status etc on their dashboard by running command `render dashboard`.
|
||||
|
||||
<img src="/images/fly_io.png" />
|
||||
|
||||
## 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" />
|
||||
@@ -0,0 +1,62 @@
|
||||
---
|
||||
title: 'Streamlit.io'
|
||||
description: 'Deploy your RAG application to streamlit.io platform'
|
||||
---
|
||||
|
||||
Embedchain offers a Streamlit template to facilitate the development of RAG chatbot applications in just three easy steps.
|
||||
|
||||
Follow the instructions given below to deploy your first application quickly:
|
||||
|
||||
## Step-1: Create RAG app
|
||||
|
||||
We provide a command line utility called `ec` in embedchain that inherits the template for `streamlit.io` platform and help you deploy the app. Follow the instructions to create a streamlit.io app using the template provided:
|
||||
|
||||
```bash Install embedchain
|
||||
pip install embedchain
|
||||
```
|
||||
|
||||
```bash Create application
|
||||
mkdir my-rag-app
|
||||
ec create --template=streamlit.io
|
||||
```
|
||||
|
||||
This will generate a directory structure like this:
|
||||
|
||||
```bash
|
||||
├── .streamlit
|
||||
│ └── secrets.toml
|
||||
├── app.py
|
||||
├── embedchain.json
|
||||
└── requirements.txt
|
||||
```
|
||||
|
||||
Feel free to edit the files as required.
|
||||
- `app.py`: Contains API app code
|
||||
- `.streamlit/secrets.toml`: Contains secrets for your application
|
||||
- `embedchain.json`: Contains embedchain specific configuration for deployment (you don't need to configure this)
|
||||
- `requirements.txt`: Contains python dependencies for your application
|
||||
|
||||
Add your `OPENAI_API_KEY` in `.streamlit/secrets.toml` file to run and deploy the app.
|
||||
|
||||
## Step-2: Test app locally
|
||||
|
||||
You can run the app locally by simply doing:
|
||||
|
||||
```bash Run locally
|
||||
pip install -r requirements.txt
|
||||
ec dev
|
||||
```
|
||||
|
||||
## Step-3: Deploy to streamlit.io
|
||||
|
||||

|
||||
|
||||
Use the deploy button from the streamlit website to deploy your app.
|
||||
|
||||
You can refer this [guide](https://docs.streamlit.io/streamlit-community-cloud/deploy-your-app) if you run into any problems.
|
||||
|
||||
## 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" />
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: '🌐 Full Stack'
|
||||
title: 'Full Stack'
|
||||
---
|
||||
|
||||
The Full Stack app example can be found [here](https://github.com/embedchain/embedchain/tree/main/examples/full_stack).
|
||||
|
||||
@@ -1,8 +1,15 @@
|
||||
---
|
||||
title: 🔎 Examples
|
||||
description: 'Collection of Google colab notebook and Replit links for users'
|
||||
title: Notebooks & Replits
|
||||
---
|
||||
|
||||
# Explore awesome apps
|
||||
|
||||
Check out the remarkable work accomplished using [Embedchain](https://app.embedchain.ai/custom-gpts/).
|
||||
|
||||
## Collection of Google colab notebook and Replit links for users
|
||||
|
||||
Get started with Embedchain by trying out the examples below. You can run the examples in your browser using Google Colab or Replit.
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -37,6 +44,10 @@ description: 'Collection of Google colab notebook and Replit links for users'
|
||||
<td className="align-middle"><a target="_blank" href="https://colab.research.google.com/github/embedchain/embedchain/blob/main/notebooks/cohere.ipynb"><img src="https://colab.research.google.com/assets/colab-badge.svg" noZoom alt="Open In Colab"/></a></td>
|
||||
<td className="align-middle"><a target="_blank" href="https://replit.com/@taranjeetio/cohere#main.py"><img src="https://replit.com/badge?caption=Try%20with%20Replit&variant=small" noZoom alt="Try with Replit Badge"/></a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td className="align-middle">Ollama</td>
|
||||
<td className="align-middle"><a target="_blank" href="https://colab.research.google.com/github/embedchain/embedchain/blob/main/notebooks/ollama.ipynb"><img src="https://colab.research.google.com/assets/colab-badge.svg" noZoom alt="Open In Colab"/></a></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td className="align-middle">Hugging Face</td>
|
||||
<td className="align-middle"><a target="_blank" href="https://colab.research.google.com/github/embedchain/embedchain/blob/main/notebooks/hugging_face_hub.ipynb"><img src="https://colab.research.google.com/assets/colab-badge.svg" noZoom alt="Open In Colab"/></a></td>
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
title: '🤖 OpenAI Assistant'
|
||||
title: 'OpenAI Assistant'
|
||||
---
|
||||
|
||||
<img src="https://blogs.swarthmore.edu/its/wp-content/uploads/2022/05/openai.jpg" align="center" width="500" alt="OpenAI Logo"/>
|
||||
@@ -38,40 +38,6 @@ assistant = OpenAIAssistant(assistant_id="asst_xxx")
|
||||
assistant = OpenAIAssistant(assistant_id="asst_xxx", thread_id="thread_xxx")
|
||||
```
|
||||
|
||||
### Arguments
|
||||
|
||||
<ResponseField name="name" type="string">
|
||||
Name for your AI assistant
|
||||
</ResponseField>
|
||||
|
||||
<ResponseField name="instructions" type="string">
|
||||
how the Assistant and model should behave or respond
|
||||
</ResponseField>
|
||||
|
||||
<ResponseField name="assistant_id" type="string">
|
||||
Load existing OpenAI Assistant. If you pass this, you don't have to pass other arguments.
|
||||
</ResponseField>
|
||||
|
||||
<ResponseField name="thread_id" type="string">
|
||||
Existing OpenAI thread id if exists
|
||||
</ResponseField>
|
||||
|
||||
<ResponseField name="model" type="str" default="gpt-4-1106-preview">
|
||||
OpenAI model to use
|
||||
</ResponseField>
|
||||
|
||||
<ResponseField name="tools" type="list">
|
||||
OpenAI tools to use. Default set to `[{"type": "retrieval"}]`
|
||||
</ResponseField>
|
||||
|
||||
<ResponseField name="data_sources" type="list" default="[]">
|
||||
Add data sources to your assistant. You can add in the following format: `[{"source": "https://example.com", "data_type": "web_page"}]`
|
||||
</ResponseField>
|
||||
|
||||
<ResponseField name="telemetry" type="boolean" default="True">
|
||||
Anonymous telemetry (doesn't collect any user information or user's files). Used to improve the Embedchain package utilization. Default is `True`.
|
||||
</ResponseField>
|
||||
|
||||
## Step-2: Add data to thread
|
||||
|
||||
You can add any custom data source that is supported by Embedchain. Else, you can directly pass the file path on your local system and Embedchain propagates it to OpenAI Assistant.
|
||||
@@ -92,4 +58,3 @@ You can try it out yourself using the following Google Colab notebook:
|
||||
<a href="https://colab.research.google.com/drive/1BKlXZYSl6AFRgiHZ5XIzXrXC_24kDYHQ?usp=sharing">
|
||||
<img src="https://camo.githubusercontent.com/84f0493939e0c4de4e6dbe113251b4bfb5353e57134ffd9fcab6b8714514d4d1/68747470733a2f2f636f6c61622e72657365617263682e676f6f676c652e636f6d2f6173736574732f636f6c61622d62616467652e737667" alt="Open in Colab" />
|
||||
</a>
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
---
|
||||
title: 'Open-Source AI Assistant'
|
||||
---
|
||||
|
||||
Embedchain also provides support for creating Open-Source AI Assistants (similar to [OpenAI Assistants API](https://platform.openai.com/docs/assistants/overview)) which allows you to build AI assistants within your own applications using any LLM (OpenAI or otherwise). An Assistant has instructions and can leverage models, tools, and knowledge to respond to user queries.
|
||||
|
||||
At a high level, the Open-Source AI Assistants API has the following flow:
|
||||
|
||||
1. Create an AI Assistant by picking a model
|
||||
2. Create a Thread when a user starts a conversation
|
||||
3. Add Messages to the Thread as the user ask questions
|
||||
4. Run the Assistant on the Thread to trigger responses. This automatically calls the relevant tools.
|
||||
|
||||
Creating an Open-Source AI Assistant is a simple 3 step process.
|
||||
|
||||
## Step 1: Instantiate AI Assistant
|
||||
|
||||
```python Initialize
|
||||
from embedchain.store.assistants import AIAssistant
|
||||
|
||||
assistant = AIAssistant(
|
||||
name="My Assistant",
|
||||
data_sources=[{"source": "https://www.youtube.com/watch?v=U9mJuUkhUzk"}])
|
||||
```
|
||||
|
||||
If you want to use the existing assistant, you can do something like this:
|
||||
|
||||
```python Initialize
|
||||
# Load an assistant and create a new thread
|
||||
assistant = AIAssistant(assistant_id="asst_xxx")
|
||||
|
||||
# Load a specific thread for an assistant
|
||||
assistant = AIAssistant(assistant_id="asst_xxx", thread_id="thread_xxx")
|
||||
```
|
||||
|
||||
## Step-2: Add data to thread
|
||||
|
||||
You can add any custom data source that is supported by Embedchain. Else, you can directly pass the file path on your local system and Embedchain propagates it to OpenAI Assistant.
|
||||
|
||||
```python Add data
|
||||
assistant.add("/path/to/file.pdf")
|
||||
assistant.add("https://www.youtube.com/watch?v=U9mJuUkhUzk")
|
||||
assistant.add("https://openai.com/blog/new-models-and-developer-products-announced-at-devday")
|
||||
```
|
||||
|
||||
## Step-3: Chat with your AI Assistant
|
||||
|
||||
```python Chat
|
||||
assistant.chat("How much OpenAI credits were offered to attendees during OpenAI DevDay?")
|
||||
# Response: 'Every attendee of OpenAI DevDay 2023 was offered $500 in OpenAI credits.'
|
||||
```
|
||||
@@ -0,0 +1,115 @@
|
||||
---
|
||||
title: '🎪 Community showcase'
|
||||
---
|
||||
|
||||
Embedchain community has been super active in creating demos on top of Embedchain. On this page, we showcase all the apps, blogs, videos, and tutorials created by the community. ❤️
|
||||
|
||||
## Apps
|
||||
|
||||
### Open Source
|
||||
|
||||
- [My GSoC23 bot- Streamlit chat](https://github.com/lucifertrj/EmbedChain_GSoC23_BOT) by Tarun Jain
|
||||
- [Discord Bot for LLM chat](https://github.com/Reidond/discord_bots_playground/tree/c8b0c36541e4b393782ee506804c4b6962426dd6/python/chat-channel-bot) by Reidond
|
||||
- [EmbedChain-Streamlit-Docker App](https://github.com/amjadraza/embedchain-streamlit-app) by amjadraza
|
||||
- [Harry Potter Philosphers Stone Bot](https://github.com/vinayak-kempawad/Harry_Potter_Philosphers_Stone_Bot/) by Vinayak Kempawad, ([LinkedIn post](https://www.linkedin.com/feed/update/urn:li:activity:7080907532155686912/))
|
||||
- [LLM bot trained on own messages](https://github.com/Harin329/harinBot) by Hao Wu
|
||||
|
||||
### Closed Source
|
||||
|
||||
- [Taobot.io](https://taobot.io) - chatbot & knowledgebase hybrid by [cachho](https://github.com/cachho)
|
||||
- [Create Instant ChatBot 🤖 using embedchain](https://databutton.com/v/h3e680h9) by Avra, ([Tweet](https://twitter.com/Avra_b/status/1674704745154641920/))
|
||||
- [JOBO 🤖 — The AI-driven sidekick to craft your resume](https://try-jobo.com/) by Enrico Willemse, ([LinkedIn Post](https://www.linkedin.com/posts/enrico-willemse_jobai-gptfun-embedchain-activity-7090340080879374336-ueLB/))
|
||||
- [Explore Your Knowledge Base: Interactive chats over various forms of documents](https://chatdocs.dkedar.com/) by Kedar Dabhadkar, ([LinkedIn Post](https://www.linkedin.com/posts/dkedar7_machinelearning-llmops-activity-7092524836639424513-2O3L/))
|
||||
- [Chatbot trained on 1000+ videos of Ester hicks the co-author behind the famous book Secret](https://ask-abraham.thoughtseed.repl.co) by Mohan Kumar
|
||||
|
||||
|
||||
## Templates
|
||||
|
||||
### Replit
|
||||
- [Embedchain Chat Bot](https://replit.com/@taranjeet1/Embedchain-Chat-Bot) by taranjeetio
|
||||
- [Embedchain Memory Chat Bot Template](https://replit.com/@taranjeetio/Embedchain-Memory-Chat-Bot-Template) by taranjeetio
|
||||
- [Chatbot app to demonstrate question-answering using retrieved information](https://replit.com/@AllisonMorrell/EmbedChainlitPublic) by Allison Morrell, ([LinkedIn Post](https://www.linkedin.com/posts/allison-morrell-2889275a_retrievalbot-screenshots-activity-7080339991754649600-wihZ/))
|
||||
|
||||
## Posts
|
||||
|
||||
### Blogs
|
||||
|
||||
- [Customer Service LINE Bot](https://www.evanlin.com/langchain-embedchain/) by Evan Lin
|
||||
- [Chatbot in Under 5 mins using Embedchain](https://medium.com/@ayush.wattal/chatbot-in-under-5-mins-using-embedchain-a4f161fcf9c5) by Ayush Wattal
|
||||
- [Understanding what the LLM framework embedchain does](https://zenn.dev/hijikix/articles/4bc8d60156a436) by Daisuke Hashimoto
|
||||
- [In bed with GPT and Node.js](https://dev.to/worldlinetech/in-bed-with-gpt-and-nodejs-4kh2) by Raphaël Semeteys, ([LinkedIn Post](https://www.linkedin.com/posts/raphaelsemeteys_in-bed-with-gpt-and-nodejs-activity-7088113552326029313-nn87/))
|
||||
- [Using Embedchain — A powerful LangChain Python wrapper to build Chat Bots even faster!⚡](https://medium.com/@avra42/using-embedchain-a-powerful-langchain-python-wrapper-to-build-chat-bots-even-faster-35c12994a360) by Avra, ([Tweet](https://twitter.com/Avra_b/status/1686767751560310784/))
|
||||
- [What is the Embedchain library?](https://jahaniwww.com/%da%a9%d8%aa%d8%a7%d8%a8%d8%ae%d8%a7%d9%86%d9%87-embedchain/) by Ali Jahani, ([LinkedIn Post](https://www.linkedin.com/posts/ajahani_aepaetaeqaexaggahyaeu-aetaexaesabraeaaeqaepaeu-activity-7097605202135904256-ppU-/))
|
||||
- [LangChain is Nice, But Have You Tried EmbedChain ?](https://medium.com/thoughts-on-machine-learning/langchain-is-nice-but-have-you-tried-embedchain-215a34421cde) by FS Ndzomga, ([Tweet](https://twitter.com/ndzfs/status/1695583640372035951/))
|
||||
- [Simplest Method to Build a Custom Chatbot with GPT-3.5 (via Embedchain)](https://www.ainewsletter.today/p/simplest-method-to-build-a-custom) by Arjun, ([Tweet](https://twitter.com/aiguy_arjun/status/1696393808467091758/))
|
||||
|
||||
### LinkedIn
|
||||
|
||||
- [What is embedchain](https://www.linkedin.com/posts/activity-7079393104423698432-wRyi/) by Rithesh Sreenivasan
|
||||
- [Building a chatbot with EmbedChain](https://www.linkedin.com/posts/activity-7078434598984060928-Zdso/) by Lior Sinclair
|
||||
- [Making chatbot without vs with embedchain](https://www.linkedin.com/posts/kalyanksnlp_llms-chatbots-langchain-activity-7077453416221863936-7N1L/) by Kalyan KS
|
||||
- [EmbedChain - very intuitive, first you index your data and then query!](https://www.linkedin.com/posts/shubhamsaboo_embedchain-a-framework-to-easily-create-activity-7079535460699557888-ad1X/) by Shubham Saboo
|
||||
- [EmbedChain - Harnessing power of LLM](https://www.linkedin.com/posts/uditsaini_chatbotrevolution-llmpoweredbots-embedchainframework-activity-7077520356827181056-FjTK/) by Udit S.
|
||||
- [AI assistant for ABBYY Vantage](https://www.linkedin.com/posts/maximevermeir_llm-github-abbyy-activity-7081658972071424000-fXfZ/) by Maxime V.
|
||||
- [About embedchain](https://www.linkedin.com/feed/update/urn:li:activity:7080984218914189312/) by Morris Lee
|
||||
- [How to use Embedchain](https://www.linkedin.com/posts/nehaabansal_github-embedchainembedchain-framework-activity-7085830340136595456-kbW5/) by Neha Bansal
|
||||
- [Youtube/Webpage summary for Energy Study](https://www.linkedin.com/posts/bar%C4%B1%C5%9F-sanl%C4%B1-34b82715_enerji-python-activity-7082735341563977730-Js0U/) by Barış Sanlı, ([Tweet](https://twitter.com/barissanli/status/1676968784979193857/))
|
||||
- [Demo: How to use Embedchain? (Contains Collab Notebook link)](https://www.linkedin.com/posts/liorsinclair_embedchain-is-getting-a-lot-of-traction-because-activity-7103044695995424768-RckT/) by Lior Sinclair
|
||||
|
||||
### Twitter
|
||||
|
||||
- [What is embedchain](https://twitter.com/AlphaSignalAI/status/1672668574450847745) by Lior
|
||||
- [Building a chatbot with Embedchain](https://twitter.com/Saboo_Shubham_/status/1673537044419686401) by Shubham Saboo
|
||||
- [Chatbot docker image behind an API with yaml configs with Embedchain](https://twitter.com/tricalt/status/1678411430192730113/) by Vasilije
|
||||
- [Build AI powered PDF chatbot with just five lines of Python code with Embedchain!](https://twitter.com/Saboo_Shubham_/status/1676627104866156544/) by Shubham Saboo
|
||||
- [Chatbot against a youtube video using embedchain](https://twitter.com/smaameri/status/1675201443043704834/) by Sami Maameri
|
||||
- [Highlights of EmbedChain](https://twitter.com/carl_AIwarts/status/1673542204328120321/) by carl_AIwarts
|
||||
- [Build Llama-2 chatbot in less than 5 minutes](https://twitter.com/Saboo_Shubham_/status/1682168956918833152/) by Shubham Saboo
|
||||
- [All cool features of embedchain](https://twitter.com/DhravyaShah/status/1683497882438217728/) by Dhravya Shah, ([LinkedIn Post](https://www.linkedin.com/posts/dhravyashah_what-if-i-tell-you-that-you-can-make-an-ai-activity-7089459599287726080-ZIYm/))
|
||||
- [Read paid Medium articles for Free using embedchain](https://twitter.com/kumarkaushal_/status/1688952961622585344) by Kaushal Kumar
|
||||
|
||||
## Videos
|
||||
|
||||
- [Embedchain in one shot](https://www.youtube.com/watch?v=vIhDh7H73Ww&t=82s) by AI with Tarun
|
||||
- [embedChain Create LLM powered bots over any dataset Python Demo Tesla Neurallink Chatbot Example](https://www.youtube.com/watch?v=bJqAn22a6Gc) by Rithesh Sreenivasan
|
||||
- [Embedchain - NEW 🔥 Langchain BABY to build LLM Bots](https://www.youtube.com/watch?v=qj_GNQ06I8o) by 1littlecoder
|
||||
- [EmbedChain -- NEW!: Build LLM-Powered Bots with Any Dataset](https://www.youtube.com/watch?v=XmaBezzGHu4) by DataInsightEdge
|
||||
- [Chat With Your PDFs in less than 10 lines of code! EMBEDCHAIN tutorial](https://www.youtube.com/watch?v=1ugkcsAcw44) by Phani Reddy
|
||||
- [How To Create A Custom Knowledge AI Powered Bot | Install + How To Use](https://www.youtube.com/watch?v=VfCrIiAst-c) by The Ai Solopreneur
|
||||
- [Build Custom Chatbot in 6 min with this Framework [Beginner Friendly]](https://www.youtube.com/watch?v=-8HxOpaFySM) by Maya Akim
|
||||
- [embedchain-streamlit-app](https://www.youtube.com/watch?v=3-9GVd-3v74) by Amjad Raza
|
||||
- [🤖CHAT with ANY ONLINE RESOURCES using EMBEDCHAIN - a LangChain wrapper, in few lines of code !](https://www.youtube.com/watch?v=Mp7zJe4TIdM) by Avra
|
||||
- [Building resource-driven LLM-powered bots with Embedchain](https://www.youtube.com/watch?v=IVfcAgxTO4I) by BugBytes
|
||||
- [embedchain-streamlit-demo](https://www.youtube.com/watch?v=yJAWB13FhYQ) by Amjad Raza
|
||||
- [Embedchain - create your own AI chatbots using open source models](https://www.youtube.com/shorts/O3rJWKwSrWE) by Dhravya Shah
|
||||
- [AI ChatBot in 5 lines Python Code](https://www.youtube.com/watch?v=zjWvLJLksv8) by Data Engineering
|
||||
- [Interview with Karl Marx](https://www.youtube.com/watch?v=5Y4Tscwj1xk) by Alexander Ray Williams
|
||||
- [Vlog where we try to build a bot based on our content on the internet](https://www.youtube.com/watch?v=I2w8CWM3bx4) by DV, ([Tweet](https://twitter.com/dvcoolster/status/1688387017544261632))
|
||||
- [CHAT with ANY ONLINE RESOURCES using EMBEDCHAIN|STREAMLIT with MEMORY |All OPENSOURCE](https://www.youtube.com/watch?v=TqQIHWoWTDQ&pp=ygUKZW1iZWRjaGFpbg%3D%3D) by DataInsightEdge
|
||||
- [Build POWERFUL LLM Bots EASILY with Your Own Data - Embedchain - Langchain 2.0? (Tutorial)](https://www.youtube.com/watch?v=jE24Y_GasE8) by WorldofAI, ([Tweet](https://twitter.com/intheworldofai/status/1696229166922780737))
|
||||
- [Embedchain: An AI knowledge base assistant for customizing enterprise private data, which can be connected to discord, whatsapp, slack, tele and other terminals (with gradio to build a request interface) in Chinese](https://www.youtube.com/watch?v=5RZzCJRk-d0) by AIGC LINK
|
||||
- [Embedchain Introduction](https://www.youtube.com/watch?v=Jet9zAqyggI) by Fahd Mirza
|
||||
|
||||
## Mentions
|
||||
|
||||
### Github repos
|
||||
|
||||
- [Awesome-LLM](https://github.com/Hannibal046/Awesome-LLM)
|
||||
- [awesome-chatgpt-api](https://github.com/reorx/awesome-chatgpt-api)
|
||||
- [awesome-langchain](https://github.com/kyrolabs/awesome-langchain)
|
||||
- [Awesome-Prompt-Engineering](https://github.com/promptslab/Awesome-Prompt-Engineering)
|
||||
- [awesome-chatgpt](https://github.com/eon01/awesome-chatgpt)
|
||||
- [Awesome-LLMOps](https://github.com/tensorchord/Awesome-LLMOps)
|
||||
- [awesome-generative-ai](https://github.com/filipecalegario/awesome-generative-ai)
|
||||
- [awesome-gpt](https://github.com/formulahendry/awesome-gpt)
|
||||
- [awesome-ChatGPT-repositories](https://github.com/taishi-i/awesome-ChatGPT-repositories)
|
||||
- [awesome-gpt-prompt-engineering](https://github.com/snwfdhmp/awesome-gpt-prompt-engineering)
|
||||
- [awesome-chatgpt](https://github.com/awesome-chatgpt/awesome-chatgpt)
|
||||
- [awesome-llm-and-aigc](https://github.com/sjinzh/awesome-llm-and-aigc)
|
||||
- [awesome-compbio-chatgpt](https://github.com/csbl-br/awesome-compbio-chatgpt)
|
||||
- [Awesome-LLM4Tool](https://github.com/OpenGVLab/Awesome-LLM4Tool)
|
||||
|
||||
## Meetups
|
||||
|
||||
- [Dash and ChatGPT: Future of AI-enabled apps 30/08/23](https://go.plotly.com/dash-chatgpt)
|
||||
- [Pie & AI: Bangalore - Build end-to-end LLM app using Embedchain 01/09/23](https://www.eventbrite.com/e/pie-ai-bangalore-build-end-to-end-llm-app-using-embedchain-tickets-698045722547)
|
||||
@@ -15,8 +15,21 @@ channels:read
|
||||
chat:write
|
||||
```
|
||||
5. Now select the option `Install to Workspace` and after it's done, copy the `Bot User OAuth Token` and set it in your secrets as `SLACK_BOT_TOKEN`.
|
||||
6. Run your bot now with `python3 -m embedchain.bots.slack`
|
||||
7. Expose your bot to the internet. Default port is `5000`, which can be changed by adding `port --8080` to the startup command. You can use your machine's public IP or DNS. Otherwise, employ a proxy server like [ngrok](https://ngrok.com/) to make your local bot accessible.
|
||||
6. Run your bot now,
|
||||
<Tabs>
|
||||
<Tab title="docker">
|
||||
```bash
|
||||
docker run --name slack-bot -e OPENAI_API_KEY=sk-xxx -e SLACK_BOT_TOKEN=xxx -p 8000:8000 embedchain/slack-bot
|
||||
```
|
||||
</Tab>
|
||||
<Tab title="python">
|
||||
```bash
|
||||
pip install --upgrade "embedchain[slack]"
|
||||
python3 -m embedchain.bots.slack --port 8000
|
||||
```
|
||||
</Tab>
|
||||
</Tabs>
|
||||
7. Expose your bot to the internet. You can use your machine's public IP or DNS. Otherwise, employ a proxy server like [ngrok](https://ngrok.com/) to make your local bot accessible.
|
||||
8. On the Slack API website go to `Event Subscriptions` on the left Sidebar and turn on `Enable Events`.
|
||||
9. In `Request URL`, enter your server or ngrok address.
|
||||
10. After it gets verified, click on `Subscribe to bot events`, add `message.channels` Bot User Event and click on `Save Changes`.
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
---
|
||||
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="Streamlit.io" href="/deployment/streamlit_io"></Card>
|
||||
<Card title="Embedchain.ai" href="/deployment/embedchain_ai"></Card>
|
||||
<Card title="Self-hosting" href="#option-2-self-hosting"></Card>
|
||||
</CardGroup>
|
||||
|
||||
## Self-hosting
|
||||
|
||||
You can also deploy Embedchain as a self-hosted service using the dockerized REST API service that we provide. Please follow the [guide here](/examples/rest-api) on how to use the REST API service. Here are some tutorials on how to deploy a containerized application to different platforms like AWS, GCP, Azure etc:
|
||||
|
||||
- [Fly.io](/deployment/fly_io)
|
||||
- [Render.com](https://render.com/docs/deploy-an-image)
|
||||
- [Huggingface Spaces](https://huggingface.co/new-space)
|
||||
- [AWS EKS](https://docs.aws.amazon.com/eks/latest/userguide/sample-deployment.html)
|
||||
- [AWS ECS](https://docs.aws.amazon.com/codecatalyst/latest/userguide/deploy-tut-ecs.html)
|
||||
- [Google GKE](https://cloud.google.com/kubernetes-engine/docs/tutorials/hello-app)
|
||||
- [Azure App Service](https://learn.microsoft.com/en-us/training/modules/deploy-run-container-app-service/)
|
||||
|
||||
|
||||
## 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" />
|
||||
+110
-19
@@ -2,13 +2,40 @@
|
||||
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 Pipeline as App
|
||||
|
||||
#### Does Embedchain support OpenAI's Assistant APIs?
|
||||
os.environ["HUGGINGFACE_ACCESS_TOKEN"] = "hf_your_token"
|
||||
|
||||
Yes, it does. Please refer to the [OpenAI Assistant docs page](/get-started/openai-assistant).
|
||||
|
||||
#### How to use `gpt-4-turbo` model released on OpenAI DevDay?
|
||||
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
|
||||
@@ -18,7 +45,7 @@ from embedchain import Pipeline as App
|
||||
os.environ['OPENAI_API_KEY'] = 'xxx'
|
||||
|
||||
# load llm configuration from gpt4_turbo.yaml file
|
||||
app = App.from_config(yaml_path="gpt4_turbo.yaml")
|
||||
app = App.from_config(config_path="gpt4_turbo.yaml")
|
||||
```
|
||||
|
||||
```yaml gpt4_turbo.yaml
|
||||
@@ -31,12 +58,9 @@ llm:
|
||||
top_p: 1
|
||||
stream: false
|
||||
```
|
||||
|
||||
</CodeGroup>
|
||||
|
||||
|
||||
#### How to use GPT-4 as the LLM model?
|
||||
|
||||
</Accordion>
|
||||
<Accordion title="How to use GPT-4 as the LLM model?">
|
||||
<CodeGroup>
|
||||
|
||||
```python main.py
|
||||
@@ -46,7 +70,7 @@ from embedchain import Pipeline as App
|
||||
os.environ['OPENAI_API_KEY'] = 'xxx'
|
||||
|
||||
# load llm configuration from gpt4.yaml file
|
||||
app = App.from_config(yaml_path="gpt4.yaml")
|
||||
app = App.from_config(config_path="gpt4.yaml")
|
||||
```
|
||||
|
||||
```yaml gpt4.yaml
|
||||
@@ -61,19 +85,15 @@ llm:
|
||||
```
|
||||
|
||||
</CodeGroup>
|
||||
|
||||
#### I don't have OpenAI credits. How can I use some open source model?
|
||||
|
||||
</Accordion>
|
||||
<Accordion title="I don't have OpenAI credits. How can I use some open source model?">
|
||||
<CodeGroup>
|
||||
|
||||
```python main.py
|
||||
import os
|
||||
from embedchain import Pipeline as App
|
||||
|
||||
os.environ['OPENAI_API_KEY'] = 'xxx'
|
||||
|
||||
# load llm configuration from opensource.yaml file
|
||||
app = App.from_config(yaml_path="opensource.yaml")
|
||||
app = App.from_config(config_path="opensource.yaml")
|
||||
```
|
||||
|
||||
```yaml opensource.yaml
|
||||
@@ -93,8 +113,79 @@ embedder:
|
||||
```
|
||||
</CodeGroup>
|
||||
|
||||
#### How to contact support?
|
||||
</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 Pipeline as 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 Pipeline as 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 Pipeline as 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" />
|
||||
|
||||
@@ -1,131 +1,66 @@
|
||||
---
|
||||
title: 📚 Introduction
|
||||
description: '📝 Embedchain is a Data Platform for LLMs - load, index, retrieve, and sync any unstructured data'
|
||||
---
|
||||
|
||||
## 🌐 What is Embedchain?
|
||||
## What is Embedchain?
|
||||
|
||||
Embedchain simplifies data handling by automatically processing unstructured data, breaking it into chunks, generating embeddings, and storing it in a vector database.
|
||||
Embedchain is an Open Source RAG Framework that makes it easy to create and deploy AI apps. At its core, Embedchain follows the design principle of being *"Conventional but Configurable"* to serve both software engineers and machine learning engineers.
|
||||
|
||||
Through various APIs, you can obtain contextual information for queries, find answers to specific questions, and engage in chat conversations using your data.
|
||||
## 🔍 Search
|
||||
Embedchain streamlines the creation of RAG 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.
|
||||
|
||||
Embedchain lets you get most relevant context by doing semantic search over your data sources for a provided query. See the example below:
|
||||
## Who is Embedchain for?
|
||||
|
||||
```python
|
||||
from embedchain import Pipeline as App
|
||||
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.
|
||||
|
||||
# Initialize app
|
||||
app = App()
|
||||
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 the RAG pipeline. This includes the choice of LLMs, vector databases, loaders and chunkers, retrieval strategies, re-ranking, and more.
|
||||
|
||||
# Add data source
|
||||
app.add("https://www.forbes.com/profile/elon-musk")
|
||||
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.
|
||||
|
||||
# Get relevant context using semantic search
|
||||
context = app.search("What is the net worth of Elon?", num_documents=2)
|
||||
print(context)
|
||||
# Context:
|
||||
# [
|
||||
# {
|
||||
# 'context': 'Elon Musk PROFILEElon MuskCEO, Tesla$221.9BReal Time Net Worthas of 10/29/23Reflects change since 5 pm ET of prior trading day. 1 in the world todayPhoto by Martin Schoeller for ForbesAbout Elon MuskElon Musk cofounded six companies, including electric car maker Tesla, rocket producer SpaceX and tunneling startup Boring Company.He owns about 21% of Tesla between stock and options, but has pledged more than half his shares as collateral for personal loans of up to $3.5 billion.SpaceX, founded in',
|
||||
# 'source': 'https://www.forbes.com/profile/elon-musk',
|
||||
# 'document_id': 'some_document_id'
|
||||
# },
|
||||
# {
|
||||
# 'context': 'company, which is now called X.Wealth HistoryHOVER TO REVEAL NET WORTH BY YEARForbes Lists 1Forbes 400 (2023)The Richest Person In Every State (2023) 2Billionaires (2023) 1Innovative Leaders (2019) 25Powerful People (2018) 12Richest In Tech (2017)Global Game Changers (2016)More ListsPersonal StatsAge52Source of WealthTesla, SpaceX, Self MadeSelf-Made Score8Philanthropy Score1ResidenceAustin, TexasCitizenshipUnited StatesMarital StatusSingleChildren11EducationBachelor of Arts/Science, University',
|
||||
# 'source': 'https://www.forbes.com/profile/elon-musk',
|
||||
# 'document_id': 'some_document_id'
|
||||
# }
|
||||
# ]
|
||||
```
|
||||
## Why Use Embedchain?
|
||||
|
||||
## ❓Query
|
||||
Developing a robust and efficient RAG (Retrieval-Augmented Generation) pipeline for production use presents numerous complexities, such as:
|
||||
|
||||
Embedchain empowers developers to ask questions and receive relevant answers through a user-friendly query API. Refer to the following example to learn how to utilize the query API:
|
||||
- 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.
|
||||
|
||||
```python
|
||||
from embedchain import Pipeline as App
|
||||
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.
|
||||
|
||||
# Initialize app
|
||||
app = App()
|
||||
## How it works?
|
||||
|
||||
# Add data source
|
||||
app.add("https://www.forbes.com/profile/elon-musk")
|
||||
Embedchain makes it easy to add data to your RAG pipeline with these straightforward steps:
|
||||
|
||||
# Get relevant answer for your query
|
||||
answer = app.query("What is the net worth of Elon?")
|
||||
print(answer)
|
||||
# Answer: The net worth of Elon Musk is $221.9 billion.
|
||||
```
|
||||
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.
|
||||
|
||||
## 💬 Chat
|
||||
When a user asks a question, whether for chatting, searching, or querying, Embedchain simplifies the response process:
|
||||
|
||||
Embedchain allows easy chatting over your data sources using a user-friendly chat API. Check out the example below to understand how to use the chat API:
|
||||
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.
|
||||
|
||||
```python
|
||||
from embedchain import Pipeline as App
|
||||
With Embedchain, you don’t have to worry about the complexities of building a RAG pipeline. It offers an easy-to-use interface for developing applications with any kind of data.
|
||||
|
||||
# Initialize app
|
||||
app = App()
|
||||
## Getting started
|
||||
|
||||
# Add data source
|
||||
app.add("https://www.forbes.com/profile/elon-musk")
|
||||
Checkout our [quickstart guide](/get-started/quickstart) to start your first RAG application.
|
||||
|
||||
# Chat on your data using `.chat()`
|
||||
answer = app.chat("How much did Elon pay for Twitter?")
|
||||
print(answer)
|
||||
# Answer: Elon Musk paid $44 billion for Twitter.
|
||||
```
|
||||
## Support
|
||||
|
||||
## 🚀 Deploy
|
||||
Feel free to reach out to us if you have ideas, feedback or questions that we can help out with.
|
||||
|
||||
Embedchain enables developers to deploy their LLM-powered apps in production using the Embedchain platform. The platform offers free access to context on your data through its REST API. Once the pipeline is deployed, you can update your data sources anytime after deployment.
|
||||
<Snippet file="get-help.mdx" />
|
||||
|
||||
See the example below on how to use the deploy API:
|
||||
## Contribute
|
||||
|
||||
```python
|
||||
from embedchain import Pipeline as App
|
||||
|
||||
# Initialize app
|
||||
app = App()
|
||||
|
||||
# Add data source
|
||||
app.add("https://www.forbes.com/profile/elon-musk")
|
||||
|
||||
# Deploy your pipeline to Embedchain Platform
|
||||
app.deploy()
|
||||
|
||||
# 🔑 Enter your Embedchain API key. You can find the API key at https://app.embedchain.ai/settings/keys/
|
||||
# ec-xxxxxx
|
||||
|
||||
# 🛠️ Creating pipeline on the platform...
|
||||
# 🎉🎉🎉 Pipeline created successfully! View your pipeline: https://app.embedchain.ai/pipelines/xxxxx
|
||||
|
||||
# 🛠️ Adding data to your pipeline...
|
||||
# ✅ Data of type: web_page, value: https://www.forbes.com/profile/elon-musk added successfully.
|
||||
```
|
||||
|
||||
## 🚀 How it works?
|
||||
|
||||
Embedchain abstracts out the following steps from you to easily create LLM powered apps:
|
||||
|
||||
1. Detect the data type and load data
|
||||
2. Create meaningful chunks
|
||||
3. Create embeddings for each chunk
|
||||
4. Store chunks in a vector database
|
||||
|
||||
When a user asks a query, the following process happens to find the answer:
|
||||
|
||||
1. Create an embedding for the query
|
||||
2. Find similar documents for the query from the vector database
|
||||
3. Pass the similar documents as context to LLM to get the final answer
|
||||
|
||||
The process of loading the dataset and querying involves multiple steps, each with its own nuances:
|
||||
|
||||
- How should I chunk the data? What is a meaningful chunk size?
|
||||
- How should I create embeddings for each chunk? Which embedding model should I use?
|
||||
- How should I store the chunks in a vector database? Which vector database should I use?
|
||||
- Should I store metadata along with the embeddings?
|
||||
- How should I find similar documents for a query? Which ranking model should I use?
|
||||
|
||||
Embedchain takes care of all these nuances and provides a simple interface to create apps on any data.
|
||||
- [GitHub](https://github.com/embedchain/embedchain)
|
||||
- [Contribution docs](/contribution/dev)
|
||||
|
||||
@@ -1,85 +1,68 @@
|
||||
---
|
||||
title: '🚀 Quickstart'
|
||||
description: '💡 Start building LLM powered apps under 30 seconds'
|
||||
title: '⚡ Quickstart'
|
||||
description: '💡 Start building ChatGPT like apps in a minute on your own data'
|
||||
---
|
||||
|
||||
Embedchain is a Data Platform for LLMs - load, index, retrieve, and sync any unstructured data. Using embedchain, you can easily create LLM powered apps over any data.
|
||||
|
||||
Install embedchain python package:
|
||||
Install python package:
|
||||
|
||||
```bash
|
||||
pip install embedchain
|
||||
```
|
||||
|
||||
<Tip>
|
||||
Embedchain now supports OpenAI's latest `gpt-4-turbo` model. Checkout the [docs here](/get-started/faq#how-to-use-gpt-4-turbo-model-released-on-openai-devday) on how to use it.
|
||||
</Tip>
|
||||
|
||||
Creating an app involves 3 steps:
|
||||
|
||||
<Steps>
|
||||
<Step title="⚙️ Import app instance">
|
||||
```python
|
||||
from embedchain import Pipeline as App
|
||||
app = App()
|
||||
```
|
||||
```python
|
||||
from embedchain import Pipeline as App
|
||||
app = App()
|
||||
```
|
||||
<Accordion title="Customize your app by a simple YAML config" icon="gear-complex">
|
||||
Embedchain provides a wide range of options to customize your app. You can customize the model, data sources, and much more.
|
||||
Explore the custom configurations [here](https://docs.embedchain.ai/advanced/configuration).
|
||||
<CodeGroup>
|
||||
```python yaml_app.py
|
||||
from embedchain import Pipeline as App
|
||||
app = App.from_config(config_path="config.yaml")
|
||||
```
|
||||
```python json_app.py
|
||||
from embedchain import Pipeline as App
|
||||
app = App.from_config(config_path="config.json")
|
||||
```
|
||||
```python app.py
|
||||
from embedchain import Pipeline as App
|
||||
config = {} # Add your config here
|
||||
app = App.from_config(config=config)
|
||||
```
|
||||
</CodeGroup>
|
||||
</Accordion>
|
||||
</Step>
|
||||
<Step title="🗃️ Add data sources">
|
||||
```python
|
||||
# Add different data sources
|
||||
app.add("https://en.wikipedia.org/wiki/Elon_Musk")
|
||||
app.add("https://www.forbes.com/profile/elon-musk")
|
||||
# You can also add local data sources such as pdf, csv files etc.
|
||||
# app.add("/path/to/file.pdf")
|
||||
```
|
||||
```python
|
||||
app.add("https://en.wikipedia.org/wiki/Elon_Musk")
|
||||
app.add("https://www.forbes.com/profile/elon-musk")
|
||||
# app.add("path/to/file/elon_musk.pdf")
|
||||
```
|
||||
<Accordion title="Embedchain supports adding data from many data sources." icon="files">
|
||||
Embedchain supports adding data from many data sources including web pages, PDFs, databases, and more.
|
||||
Explore the list of supported [data sources](https://docs.embedchain.ai/data-sources/overview).
|
||||
</Accordion>
|
||||
</Step>
|
||||
<Step title="💬 Query or chat or search context on your data">
|
||||
```python
|
||||
app.query("What is the net worth of Elon Musk today?")
|
||||
# Answer: The net worth of Elon Musk today is $258.7 billion.
|
||||
```
|
||||
</Step>
|
||||
<Step title="🚀 (Optional) Deploy your pipeline to Embedchain Platform">
|
||||
```python
|
||||
app.deploy()
|
||||
# 🔑 Enter your Embedchain API key. You can find the API key at https://app.embedchain.ai/settings/keys/
|
||||
# ec-xxxxxx
|
||||
|
||||
# 🛠️ Creating pipeline on the platform...
|
||||
# 🎉🎉🎉 Pipeline created successfully! View your pipeline: https://app.embedchain.ai/pipelines/xxxxx
|
||||
|
||||
# 🛠️ Adding data to your pipeline...
|
||||
# ✅ Data of type: web_page, value: https://www.forbes.com/profile/elon-musk added successfully.
|
||||
```
|
||||
<Step title="💬 Ask questions, chat, or search through your data with ease">
|
||||
```python
|
||||
app.query("What is the net worth of Elon Musk today?")
|
||||
# Answer: The net worth of Elon Musk today is $258.7 billion.
|
||||
```
|
||||
<hr />
|
||||
<Accordion title="Want to chat with your app?" icon="face-thinking">
|
||||
Embedchain provides a wide range of features to interact with your app. You can chat with your app, ask questions, search through your data, and much more.
|
||||
```python
|
||||
app.chat("How many companies does Elon Musk run? Name those")
|
||||
# Answer: Elon Musk runs 3 companies: Tesla, SpaceX, and Neuralink.
|
||||
app.chat("What is his net worth today?")
|
||||
# Answer: The net worth of Elon Musk today is $258.7 billion.
|
||||
```
|
||||
To learn about other features, click [here](https://docs.embedchain.ai/get-started/introduction)
|
||||
</Accordion>
|
||||
</Step>
|
||||
</Steps>
|
||||
|
||||
Putting it together, you can run your first app using the following code. Make sure to set the `OPENAI_API_KEY` 🔑 environment variable in the code.
|
||||
|
||||
```python
|
||||
import os
|
||||
from embedchain import Pipeline as App
|
||||
|
||||
os.environ["OPENAI_API_KEY"] = "xxx"
|
||||
app = App()
|
||||
|
||||
# Add different data sources
|
||||
app.add("https://en.wikipedia.org/wiki/Elon_Musk")
|
||||
app.add("https://www.forbes.com/profile/elon-musk")
|
||||
# You can also add local data sources such as pdf, csv files etc.
|
||||
# app.add("/path/to/file.pdf")
|
||||
|
||||
response = app.query("What is the net worth of Elon Musk today?")
|
||||
print(response)
|
||||
# Answer: The net worth of Elon Musk today is $258.7 billion.
|
||||
|
||||
app.deploy()
|
||||
# 🔑 Enter your Embedchain API key. You can find the API key at https://app.embedchain.ai/settings/keys/
|
||||
# ec-xxxxxx
|
||||
|
||||
# 🛠️ Creating pipeline on the platform...
|
||||
# 🎉🎉🎉 Pipeline created successfully! View your pipeline: https://app.embedchain.ai/pipelines/xxxxx
|
||||
|
||||
# 🛠️ Adding data to your pipeline...
|
||||
# ✅ Data of type: web_page, value: https://www.forbes.com/profile/elon-musk added successfully.
|
||||
```
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 214 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 354 KiB |
@@ -0,0 +1,68 @@
|
||||
---
|
||||
title: '⛓️ Chainlit'
|
||||
description: 'Integrate with Chainlit to create LLM chat apps'
|
||||
---
|
||||
|
||||
In this example, we will learn how to use Chainlit and Embedchain together.
|
||||
|
||||

|
||||
|
||||
## Setup
|
||||
|
||||
First, install the required packages:
|
||||
|
||||
```bash
|
||||
pip install embedchain chainlit
|
||||
```
|
||||
|
||||
## Create a Chainlit app
|
||||
|
||||
Create a new file called `app.py` and add the following code:
|
||||
|
||||
```python
|
||||
import chainlit as cl
|
||||
from embedchain import Pipeline as App
|
||||
|
||||
import os
|
||||
|
||||
os.environ["OPENAI_API_KEY"] = "sk-xxx"
|
||||
|
||||
@cl.on_chat_start
|
||||
async def on_chat_start():
|
||||
app = App.from_config(config={
|
||||
'app': {
|
||||
'config': {
|
||||
'name': 'chainlit-app'
|
||||
}
|
||||
},
|
||||
'llm': {
|
||||
'config': {
|
||||
'stream': True,
|
||||
}
|
||||
}
|
||||
})
|
||||
# import your data here
|
||||
app.add("https://www.forbes.com/profile/elon-musk/")
|
||||
app.collect_metrics = False
|
||||
cl.user_session.set("app", app)
|
||||
|
||||
|
||||
@cl.on_message
|
||||
async def on_message(message: cl.Message):
|
||||
app = cl.user_session.get("app")
|
||||
msg = cl.Message(content="")
|
||||
for chunk in await cl.make_async(app.chat)(message.content):
|
||||
await msg.stream_token(chunk)
|
||||
|
||||
await msg.send()
|
||||
```
|
||||
|
||||
## Run the app
|
||||
|
||||
```
|
||||
chainlit run app.py
|
||||
```
|
||||
|
||||
## Try it out
|
||||
|
||||
Open the app in your browser and start chatting with it!
|
||||
@@ -48,4 +48,4 @@ app.query("How many companies did Elon found?")
|
||||
|
||||
* Now the entire log for this will be visible in langsmith.
|
||||
|
||||
<img src="/images/langsmith.png"/>
|
||||
<img src="/images/langsmith.png"/>
|
||||
|
||||
@@ -0,0 +1,112 @@
|
||||
---
|
||||
title: '🚀 Streamlit'
|
||||
description: 'Integrate with Streamlit to plug and play with any LLM'
|
||||
---
|
||||
|
||||
In this example, we will learn how to use `mistralai/Mixtral-8x7B-Instruct-v0.1` and Embedchain together with Streamlit to build a simple RAG chatbot.
|
||||
|
||||

|
||||
|
||||
## Setup
|
||||
|
||||
Install Embedchain and Streamlit.
|
||||
```bash
|
||||
pip install embedchain streamlit
|
||||
```
|
||||
<Tabs>
|
||||
<Tab title="app.py">
|
||||
```python
|
||||
import os
|
||||
from embedchain import Pipeline as App
|
||||
import streamlit as st
|
||||
|
||||
with st.sidebar:
|
||||
huggingface_access_token = st.text_input("Hugging face Token", key="chatbot_api_key", type="password")
|
||||
"[Get Hugging Face Access Token](https://huggingface.co/settings/tokens)"
|
||||
"[View the source code](https://github.com/embedchain/examples/mistral-streamlit)"
|
||||
|
||||
|
||||
st.title("💬 Chatbot")
|
||||
st.caption("🚀 An Embedchain app powered by Mistral!")
|
||||
if "messages" not in st.session_state:
|
||||
st.session_state.messages = [
|
||||
{
|
||||
"role": "assistant",
|
||||
"content": """
|
||||
Hi! I'm a chatbot. I can answer questions and learn new things!\n
|
||||
Ask me anything and if you want me to learn something do `/add <source>`.\n
|
||||
I can learn mostly everything. :)
|
||||
""",
|
||||
}
|
||||
]
|
||||
|
||||
for message in st.session_state.messages:
|
||||
with st.chat_message(message["role"]):
|
||||
st.markdown(message["content"])
|
||||
|
||||
if prompt := st.chat_input("Ask me anything!"):
|
||||
if not st.session_state.chatbot_api_key:
|
||||
st.error("Please enter your Hugging Face Access Token")
|
||||
st.stop()
|
||||
|
||||
os.environ["HUGGINGFACE_ACCESS_TOKEN"] = st.session_state.chatbot_api_key
|
||||
app = App.from_config(config_path="config.yaml")
|
||||
|
||||
if prompt.startswith("/add"):
|
||||
with st.chat_message("user"):
|
||||
st.markdown(prompt)
|
||||
st.session_state.messages.append({"role": "user", "content": prompt})
|
||||
prompt = prompt.replace("/add", "").strip()
|
||||
with st.chat_message("assistant"):
|
||||
message_placeholder = st.empty()
|
||||
message_placeholder.markdown("Adding to knowledge base...")
|
||||
app.add(prompt)
|
||||
message_placeholder.markdown(f"Added {prompt} to knowledge base!")
|
||||
st.session_state.messages.append({"role": "assistant", "content": f"Added {prompt} to knowledge base!"})
|
||||
st.stop()
|
||||
|
||||
with st.chat_message("user"):
|
||||
st.markdown(prompt)
|
||||
st.session_state.messages.append({"role": "user", "content": prompt})
|
||||
|
||||
with st.chat_message("assistant"):
|
||||
msg_placeholder = st.empty()
|
||||
msg_placeholder.markdown("Thinking...")
|
||||
full_response = ""
|
||||
|
||||
for response in app.chat(prompt):
|
||||
msg_placeholder.empty()
|
||||
full_response += response
|
||||
|
||||
msg_placeholder.markdown(full_response)
|
||||
st.session_state.messages.append({"role": "assistant", "content": full_response})
|
||||
```
|
||||
</Tab>
|
||||
<Tab title="config.yaml">
|
||||
```yaml
|
||||
app:
|
||||
config:
|
||||
name: 'mistral-streamlit-app'
|
||||
|
||||
llm:
|
||||
provider: huggingface
|
||||
config:
|
||||
model: 'mistralai/Mixtral-8x7B-Instruct-v0.1'
|
||||
temperature: 0.1
|
||||
max_tokens: 250
|
||||
top_p: 0.1
|
||||
stream: true
|
||||
|
||||
embedder:
|
||||
provider: huggingface
|
||||
config:
|
||||
model: 'sentence-transformers/all-mpnet-base-v2'
|
||||
```
|
||||
</Tab>
|
||||
</Tabs>
|
||||
|
||||
## To run it locally,
|
||||
|
||||
```bash
|
||||
streamlit run app.py
|
||||
```
|
||||
+148
-62
@@ -4,7 +4,7 @@
|
||||
"logo": {
|
||||
"dark": "/logo/dark.svg",
|
||||
"light": "/logo/light.svg",
|
||||
"href": "https://embedchain.ai/"
|
||||
"href": "https://github.com/embedchain/embedchain"
|
||||
},
|
||||
"favicon": "/favicon.png",
|
||||
"colors": {
|
||||
@@ -19,102 +19,161 @@
|
||||
"modeToggle": {
|
||||
"default": "dark"
|
||||
},
|
||||
"openapi": ["/rest-api.json"],
|
||||
"openapi": [
|
||||
"/rest-api.json"
|
||||
],
|
||||
"metadata": {
|
||||
"og:image": "/images/og.png",
|
||||
"twitter:site": "@embedchain"
|
||||
},
|
||||
"tabs": [
|
||||
{
|
||||
"name": "Examples",
|
||||
"url": "examples"
|
||||
},
|
||||
{
|
||||
"name": "API Reference",
|
||||
"url": "api-reference"
|
||||
}
|
||||
],
|
||||
"anchors": [
|
||||
{
|
||||
"name": "Embedchain Platform",
|
||||
"icon": "tv",
|
||||
"url": "https://app.embedchain.ai/"
|
||||
"name": "Talk to founders",
|
||||
"icon": "calendar",
|
||||
"url": "https://cal.com/taranjeetio/ec"
|
||||
},
|
||||
{
|
||||
"name": "Join our slack",
|
||||
"icon": "slack",
|
||||
"url": "https://join.slack.com/t/embedchain/shared_invite/zt-22uwz3c46-Zg7cIh5rOBteT_xe1jwLDw"
|
||||
},
|
||||
{
|
||||
"name": "Join our discord",
|
||||
"icon": "discord",
|
||||
"url": "https://discord.gg/CUU9FPhRNt"
|
||||
}
|
||||
],
|
||||
"topbarLinks": [
|
||||
{
|
||||
"name": "Create account",
|
||||
"url": "https://app.embedchain.ai/login/"
|
||||
"name": "GitHub",
|
||||
"url": "https://github.com/embedchain/embedchain"
|
||||
}
|
||||
],
|
||||
"topbarCtaButton": {
|
||||
"name": "Get started",
|
||||
"url": "https://app.embedchain.ai"
|
||||
"name": "Join our slack",
|
||||
"url": "https://join.slack.com/t/embedchain/shared_invite/zt-22uwz3c46-Zg7cIh5rOBteT_xe1jwLDw"
|
||||
},
|
||||
"primaryTab": {
|
||||
"name": "Docs"
|
||||
"name": "Documentation"
|
||||
},
|
||||
"navigation": [
|
||||
{
|
||||
"group": "Get started",
|
||||
"group": "Get Started",
|
||||
"pages": [
|
||||
"get-started/quickstart",
|
||||
"get-started/introduction",
|
||||
"get-started/openai-assistant",
|
||||
"get-started/faq",
|
||||
"get-started/examples"
|
||||
"get-started/quickstart",
|
||||
{
|
||||
"group": "🔗 Integrations",
|
||||
"pages": [
|
||||
"integration/langsmith",
|
||||
"integration/chainlit",
|
||||
"integration/streamlit-mistral"
|
||||
]
|
||||
},
|
||||
"get-started/faq"
|
||||
]
|
||||
},
|
||||
{
|
||||
"group": "Deployment",
|
||||
"pages": [
|
||||
"get-started/deployment",
|
||||
"deployment/fly_io",
|
||||
"deployment/modal_com",
|
||||
"deployment/render_com",
|
||||
"deployment/streamlit_io",
|
||||
"deployment/embedchain_ai",
|
||||
"deployment/gradio_app",
|
||||
"deployment/huggingface_spaces"
|
||||
]
|
||||
},
|
||||
{
|
||||
"group": "Use cases",
|
||||
"pages": [
|
||||
"use-cases/chatbots",
|
||||
"use-cases/question-answering",
|
||||
"use-cases/semantic-search"
|
||||
]
|
||||
},
|
||||
{
|
||||
"group": "Components",
|
||||
"pages": [
|
||||
"components/llms",
|
||||
"components/embedding-models",
|
||||
"components/vector-databases"
|
||||
]
|
||||
},
|
||||
{
|
||||
"group": "Data sources",
|
||||
"pages": [
|
||||
"data-sources/overview",
|
||||
{
|
||||
"group": "Supported data sources",
|
||||
"group": "Data sources",
|
||||
"pages": [
|
||||
"data-sources/csv",
|
||||
"data-sources/json",
|
||||
"data-sources/docs-site",
|
||||
"data-sources/docx",
|
||||
"data-sources/mdx",
|
||||
"data-sources/notion",
|
||||
"data-sources/pdf-file",
|
||||
"data-sources/qna",
|
||||
"data-sources/sitemap",
|
||||
"data-sources/text",
|
||||
"data-sources/web-page",
|
||||
"data-sources/openapi",
|
||||
"data-sources/youtube-video"
|
||||
"components/data-sources/overview",
|
||||
{
|
||||
"group": "Data types",
|
||||
"pages": [
|
||||
"components/data-sources/csv",
|
||||
"components/data-sources/json",
|
||||
"components/data-sources/docs-site",
|
||||
"components/data-sources/docx",
|
||||
"components/data-sources/mdx",
|
||||
"components/data-sources/notion",
|
||||
"components/data-sources/pdf-file",
|
||||
"components/data-sources/qna",
|
||||
"components/data-sources/sitemap",
|
||||
"components/data-sources/text",
|
||||
"components/data-sources/web-page",
|
||||
"components/data-sources/openapi",
|
||||
"components/data-sources/youtube-video",
|
||||
"components/data-sources/discourse",
|
||||
"components/data-sources/substack",
|
||||
"components/data-sources/discord",
|
||||
"components/data-sources/beehiiv",
|
||||
"components/data-sources/directory"
|
||||
]
|
||||
},
|
||||
"components/data-sources/data-type-handling"
|
||||
]
|
||||
},
|
||||
"data-sources/data-type-handling"
|
||||
"components/llms",
|
||||
"components/vector-databases",
|
||||
"components/embedding-models"
|
||||
]
|
||||
},
|
||||
{
|
||||
"group": "Advanced",
|
||||
"pages": ["advanced/configuration"]
|
||||
},
|
||||
{
|
||||
"group": "REST API",
|
||||
"group": "Community",
|
||||
"pages": [
|
||||
"rest-api/getting-started",
|
||||
"rest-api/create",
|
||||
"rest-api/get-all-apps",
|
||||
"rest-api/add-data",
|
||||
"rest-api/get-data",
|
||||
"rest-api/query",
|
||||
"rest-api/deploy",
|
||||
"rest-api/delete",
|
||||
"rest-api/check-status"
|
||||
"community/connect-with-us"
|
||||
]
|
||||
},
|
||||
{
|
||||
"group": "Use Cases",
|
||||
"group": "Examples",
|
||||
"pages": [
|
||||
"examples/notebooks-and-replits",
|
||||
{
|
||||
"group": "REST API Service",
|
||||
"pages": [
|
||||
"examples/rest-api/getting-started",
|
||||
"examples/rest-api/create",
|
||||
"examples/rest-api/get-all-apps",
|
||||
"examples/rest-api/add-data",
|
||||
"examples/rest-api/get-data",
|
||||
"examples/rest-api/query",
|
||||
"examples/rest-api/deploy",
|
||||
"examples/rest-api/delete",
|
||||
"examples/rest-api/check-status"
|
||||
]
|
||||
},
|
||||
"examples/full_stack",
|
||||
"examples/openai-assistant",
|
||||
"examples/opensource-assistant"
|
||||
]
|
||||
},
|
||||
{
|
||||
"group": "Chatbots",
|
||||
"pages": [
|
||||
"examples/discord_bot",
|
||||
"examples/slack_bot",
|
||||
"examples/telegram_bot",
|
||||
@@ -123,15 +182,34 @@
|
||||
]
|
||||
},
|
||||
{
|
||||
"group": "Community",
|
||||
"pages": ["community/connect-with-us", "community/showcase"]
|
||||
"group": "Showcase",
|
||||
"pages": [
|
||||
"examples/showcase"
|
||||
]
|
||||
},
|
||||
{
|
||||
"group": "Integrations",
|
||||
"pages": ["integration/langsmith"]
|
||||
"group": "API Reference",
|
||||
"pages": [
|
||||
"api-reference/pipeline/overview",
|
||||
{
|
||||
"group": "Pipeline methods",
|
||||
"pages": [
|
||||
"api-reference/pipeline/add",
|
||||
"api-reference/pipeline/query",
|
||||
"api-reference/pipeline/chat",
|
||||
"api-reference/pipeline/search",
|
||||
"api-reference/pipeline/deploy",
|
||||
"api-reference/pipeline/reset",
|
||||
"api-reference/pipeline/delete"
|
||||
]
|
||||
},
|
||||
"api-reference/store/openai-assistant",
|
||||
"api-reference/store/ai-assistants",
|
||||
"api-reference/advanced/configuration"
|
||||
]
|
||||
},
|
||||
{
|
||||
"group": "Contribute",
|
||||
"group": "Contributing",
|
||||
"pages": [
|
||||
"contribution/guidelines",
|
||||
"contribution/dev",
|
||||
@@ -142,7 +220,9 @@
|
||||
},
|
||||
{
|
||||
"group": "Product",
|
||||
"pages": ["product/release-notes"]
|
||||
"pages": [
|
||||
"product/release-notes"
|
||||
]
|
||||
}
|
||||
],
|
||||
"footerSocials": {
|
||||
@@ -170,5 +250,11 @@
|
||||
},
|
||||
"api": {
|
||||
"baseUrl": "http://localhost:8080"
|
||||
}
|
||||
}
|
||||
},
|
||||
"redirects": [
|
||||
{
|
||||
"source": "/changelog/command-line",
|
||||
"destination": "/get-started/introduction"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
---
|
||||
title: 'FAQs'
|
||||
---
|
||||
@@ -0,0 +1,3 @@
|
||||
---
|
||||
title: 'Overview'
|
||||
---
|
||||
@@ -0,0 +1,3 @@
|
||||
---
|
||||
title: 'Quickstart'
|
||||
---
|
||||
@@ -0,0 +1,3 @@
|
||||
---
|
||||
title: 'Roadmap'
|
||||
---
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user