48 lines
1.5 KiB
Markdown
48 lines
1.5 KiB
Markdown
To use this bot:
|
|
|
|
1. Set your Venice API key as an environment variable:
|
|
```bash
|
|
export VENICE_API_KEY="your-api-key-here"
|
|
```
|
|
|
|
2. Install the required dependencies:
|
|
```bash
|
|
pip install aiohttp simplexmq
|
|
```
|
|
|
|
3. Run the bot:
|
|
```bash
|
|
python venice_bot.py
|
|
```
|
|
|
|
Key features of this implementation:
|
|
|
|
1. Uses ```/ask``` as the command prefix to trigger the bot
|
|
2. Implements async/await for better performance
|
|
3. Includes error handling for API calls
|
|
4. Shows typing indicators while processing
|
|
5. Uses environment variables for secure API key storage
|
|
6. Maintains a persistent SimpleX connection
|
|
|
|
To use the bot in a SimpleX chat:
|
|
1. Start the bot
|
|
2. Use the displayed bot address to add it to your SimpleX chat
|
|
3. Send messages with the format: ```/ask your question here```
|
|
|
|
For example:
|
|
```
|
|
/ask What is the weather like today?
|
|
```
|
|
|
|
The bot will then process your question through the Venice API and respond with the generated answer.
|
|
|
|
Note: You'll need to handle the actual SimpleX integration details based on your specific SimpleX setup and requirements. The ```simplexmq``` package used in this example is a placeholder - you'll need to use the actual SimpleX client library or API that matches your setup. [^1]
|
|
|
|
Remember to:
|
|
- Keep your API keys secure
|
|
- Implement rate limiting if needed
|
|
- Add logging for debugging
|
|
- Consider adding more error handling and retry logic for robustness
|
|
- Add moderation features if needed for your use case
|
|
|
|
[^1]: [Venice API Docs](https://docs.venice.ai/api-reference/api-spec#:~:text=Full%20document,more%20information.) |