Add Readme

Signed-off-by: Sid Sun <sid@sidsun.com>
This commit is contained in:
Sid Sun 2024-05-13 22:11:49 +05:30
parent c1fbad53e0
commit 011c91f31b
2 changed files with 53 additions and 1 deletions

52
README.md Normal file
View File

@ -0,0 +1,52 @@
# OpenWebUI-Telegram
🤖 A Telegram bot that integrates with OpenWeb UI's OpenAI compatible APIs to provide chat functionality.
## Configuration
The configuration is loaded from environment variables, here are the environment variables you can set:
### OpenAI Endpoint Options
- `OPENAI_ENDPOINT`: The base OpenAI API compatible endpoint. example: `http://localhost:3000/ollama/v1/`. http & https both work.
- `OPENAI_API_KEY`: The `Bearer` token API Key, example: `sk-12345667890abcdefghijkl`
### Model Options
- `MODEL`: The model to use. Default is `llama3:instruct`.
- `MODEL_TWEAK_LEVEL`: The level of tweaking to apply to the model. Set to `advanced` to make Penalty tweaks take effect, else - none are provided to API. Default is `minimal`, i.e. no Penalty parameters.
### Model Tweaks
- `MAX_TOKENS`: The maximum number of tokens that the model can generate. Default is `1024`.
- `TEMPERATURE`: Controls the randomness of the model's output. Higher values make the output more random. Default is `0.8`.
- `REPEAT_PENALTY`: Penalty for repeating the same token. Default is `1.2`.
- `CONTEXT_LENGTH`: The maximum number of tokens in the context. Default is `8192`.
- `PRESENCE_PENALTY`: Penalty for using tokens that are not in the context. Default is `1.5`.
- `FREQUENCY_PENALTY`: Penalty for using tokens that are used frequently. Default is `1.0`.
### Bot Configuration
- `API_TOKEN`: The Telegram Bot API token.
## Usage
Only private chat is tested as of now.
### Chatting
If you send messages without a reply, bot treats that as starting a new chat / thread. To continue a chat / thread, reply to the last (or previous) message you want to pick up the conversation from.
### Commands
The bot supports two commands:
1. To set system prompt, use `/reset <system prompt>`.
- The default system prompt is `You are a friendly assistant`.
- Once you set a custom system prompt, it will remain set until you either change it or bot is restarted.
2. To regenerate a response, reply to the message you want to regenerate from and send `/resend`
- Once the bot is restarted, the conversation history is lost and thread can't be continued.
## Contributing
Contributions are welcome. Please submit a pull request or create an issue if you have any improvements or suggestions.

View File

@ -26,9 +26,9 @@ type ModelOptions struct {
type ModelTweaks struct {
ContextLength int `json:"context_length"`
MaxTokens int `json:"max_tokens"`
Temperature float64 `json:"temperature"`
FrequencyPenalty float64 `json:"frequency_penalty"`
PresencePenalty float64 `json:"presence_penalty"`
Temperature float64 `json:"temperature"`
RepeatPenalty float64 `json:"repeat_penalty"`
}