Files
ha-text-ai/README.md
T

79 lines
2.0 KiB
Markdown
Raw Normal View History

2024-11-18 00:43:28 +03:00
# HA text AI
2024-11-14 18:39:06 +03:00
2024-11-18 00:43:28 +03:00
This is a Home Assistant custom integration that allows you to interact with OpenAI's API and compatible endpoints to generate AI responses.
2024-11-14 18:39:06 +03:00
## Features
2024-11-18 00:43:28 +03:00
- Configure all settings through the Home Assistant UI
- Support for OpenAI API and compatible endpoints
- Configurable parameters (temperature, max tokens, etc.)
- Request queue system to prevent API rate limiting
- Long response storage
- Multiple parallel questions support
- Real-time updates
2024-11-14 18:39:06 +03:00
## Installation
2024-11-18 00:43:28 +03:00
### HACS Installation
1. Go to HACS in your Home Assistant installation
2024-11-14 18:39:06 +03:00
2. Click on "Integrations"
2024-11-18 00:43:28 +03:00
3. Click the "+" button
4. Search for "HA text AI"
5. Click "Install"
6. Restart Home Assistant
2024-11-14 18:39:06 +03:00
### Manual Installation
1. Copy the `custom_components/ha_text_ai` directory to your Home Assistant's `custom_components` directory
2. Restart Home Assistant
## Configuration
2024-11-18 00:43:28 +03:00
1. Go to Configuration -> Integrations
2. Click "+" to add a new integration
3. Search for "HA text AI"
4. Enter your OpenAI API key and configure other settings
2024-11-14 18:39:06 +03:00
## Usage
2024-11-18 00:43:28 +03:00
### Service Calls
You can use the `ha_text_ai.ask_question` service to ask questions:
2024-11-14 18:39:06 +03:00
```yaml
2024-11-18 00:43:28 +03:00
service: ha_text_ai.ask_question
2024-11-14 18:39:06 +03:00
data:
2024-11-18 00:43:28 +03:00
question: "What is the weather like today?"
2024-11-14 18:43:19 +03:00
```
2024-11-18 00:43:28 +03:00
### Automation Example
2024-11-14 18:43:19 +03:00
```yaml
2024-11-18 00:43:28 +03:00
automation:
- alias: "Daily Weather Question"
trigger:
platform: time
at: "07:00:00"
action:
- service: ha_text_ai.ask_question
data:
question: "What's the weather forecast for today?"
2024-11-14 18:43:19 +03:00
```
2024-11-18 00:43:28 +03:00
## Configuration Options
2024-11-14 18:43:19 +03:00
2024-11-18 00:43:28 +03:00
| Option | Description | Default |
|--------|-------------|---------|
| `api_key` | Your OpenAI API key | Required |
| `model` | The AI model to use | gpt-3.5-turbo |
| `temperature` | Response randomness (0-1) | 0.7 |
| `max_tokens` | Maximum response length | 1000 |
| `api_endpoint` | Custom API endpoint | https://api.openai.com/v1 |
| `request_interval` | Minimum time between requests | 1.0 |
2024-11-14 18:43:19 +03:00
## Support
2024-11-18 00:43:28 +03:00
For bugs and feature requests, please create an issue on GitHub.
2024-11-14 18:53:02 +03:00
2024-11-18 00:43:28 +03:00
## License
This project is licensed under the MIT License.
```