-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
33 additions
and
21 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,41 @@ | ||
# PlugBear Python SDK Example (FastAPI) | ||
# PlugBear Python SDK Example (FastAPI + OpenAI Assistant) | ||
|
||
This project introduces an example of integrating a Python LLM application with | ||
communication channels, such as Slack, using PlugBear. | ||
|
||
## Prerequisites | ||
|
||
- Docker | ||
- [Poetry](https://python-poetry.org) | ||
|
||
## Development | ||
|
||
## Usage | ||
### Installing Dependencies | ||
|
||
This will create a math tutor AI. | ||
You can make a query on any integrated channel, like this: ``@PlugBear I need to solve the equation `3x + 11 = 14`. Can you help me?``. | ||
Use [Poetry](https://python-poetry.org/) to install dependencies. | ||
|
||
```shell | ||
docker build . -t plugbear-python-sdk-example | ||
docker run --rm -ti \ | ||
-p 8000:8000 \ | ||
-e PLUGBEAR_API_KEY="YOUR.PLUGBEAR.API.KEY" \ | ||
-e OPENAI_API_KEY="YOUR.OPENAI.API.KEY" \ | ||
plugbear-python-sdk-example | ||
```bash | ||
poetry install | ||
``` | ||
|
||
You can also existing assistant by passing `OPENAI_ASSISTANT_ID` environment to `docker run`. | ||
### Running Server | ||
|
||
Run the command below to run the server: | ||
|
||
```bash | ||
OPENAI_API_KEY="YOUR_OPENAI_API_KEY" \ | ||
PLUGBEAR_API_KEY="YOUR_PLUGBEAR_API_KEY" \ | ||
poetry run python main.py | ||
``` | ||
|
||
You can obtain your `OPENAI_API_KEY` from the | ||
[OpenAI API Keys](https://platform.openai.com/api-keys) page, and your | ||
`PLUGBEAR_API_KEY` from the | ||
[PlugBear API Keys](https://auth.plugbear.io/org/api_keys) page. | ||
|
||
### Testing Integration | ||
|
||
Follow [PlugBear Documentation](https://docs.plugbear.io) to connect your app | ||
into communication channels and test it. | ||
|
||
Ask any math question to `@PlugBear` after connecting it. e.g., | ||
`` @PlugBear I need to solve the equation `3x + 11 = 14`. Can you help me? ``. |