feat: Make poe bot run as an app instead of server. (#550)

This commit is contained in:
Taranjeet Singh
2023-09-04 20:29:41 -07:00
committed by GitHub
parent 60d5daaaf5
commit d4e6462e4d
4 changed files with 59 additions and 52 deletions

View File

@@ -7,42 +7,43 @@ title: '🔮 Poe Bot'
1. Install embedchain python package:
```bash
pip install embedchain[poe]
pip install "embedchain[poe]"
```
2. Create a free account on [Poe](https://www.poe.com?utm_source=embedchain).
3. Click "Create Bot" button on top left
3. Click "Create Bot" button on top left.
4. Give it a handle and an optional description.
5. Select `Use API`.
6. Under `API URL` enter your server or ngrok address. 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.
7. Copy your api key and paste it in `.env` as `POE_API_KEY`.
8. Start the bot.
8. Now create your bot using the following code snippet
```bash
python -m embedchain.bots.poe
from embedchain import PoeBot
poe_bot = PoeBot()
# add as many data sources as you want
poe_bot.add("https://en.wikipedia.org/wiki/Adam_D%27Angelo")
poe_bot.add("https://www.youtube.com/watch?v=pJQVAqmKua8")
# start the bot
# this start the poe bot server on port 8080 by default
poe_bot.start()
```
If you want to run the bot on another port, you can pass `--port option` like
9. You can refer the [Supported Data formats](https://docs.embedchain.ai/advanced/data_types) section to refer the supported data types in embedchain.
```bash
python -m embedchain.bots.poe --port 5000
```
9. Click `Run check` to make sure your machine can be reached.
10. Make sure your bot is private if that's what you want.
11. Click `Create bot` at the bottom to finally create the bot
12. Now you bot is created.
10. Click `Run check` to make sure your machine can be reached.
11. Make sure your bot is private if that's what you want.
12. Click `Create bot` at the bottom to finally create the bot
13. Now you bot is created.
### 💬 How to use
- To include data sources, use this command:
```text
/add <url_or_text>
```
- You can refer the [Supported Data formats](https://docs.embedchain.ai/advanced/data_types) section to refer the supported data types in embedchain.
- To ask the bot questions, just type your query:
- To ask the bot questions, just type your query in the Poe interface:
```text
<your-question-here>
```
- If you wish to add more data source to the bot, simply update your script and add as many `.add` as you like. You need to restart the server.