mirror of
https://github.com/smkrv/ha-text-ai.git
synced 2026-07-21 22:54:00 +08:00
1.6 KiB
1.6 KiB
HA Text AI Integration
A Home Assistant integration that provides a bridge to OpenAI-compatible API services with automatic Text Helper management.
Features
- Easy integration with OpenAI-compatible APIs
- Automatic Text Helper creation for responses
- Support for custom API endpoints
- Built-in rate limiting and queue management
- Blueprint for easy automation setup
- Supports responses up to 65,536 characters
Installation
HACS (Recommended)
- Open HACS in your Home Assistant instance
- Click on "Integrations"
- Click the three dots in the top right corner
- Select "Custom repositories"
- Add this repository URL and select "Integration" as the category
- Click "Install"
- Restart Home Assistant
Manual Installation
- Copy the
custom_components/ha_text_aidirectory to your Home Assistant'scustom_componentsdirectory - Restart Home Assistant
Configuration
- Go to Settings -> Devices & Services
- Click "Add Integration"
- Search for "HA Text AI"
- Enter your configuration:
- API Key: Your OpenAI API key
- API Base URL (optional): Custom endpoint for OpenAI-compatible APIs
- Request Interval: Minimum time between requests (in seconds)
Usage
Service Call
You can call the integration using the service ha_text_ai.text_ai_call:
service: ha_text_ai.text_ai_call
data:
prompt: "Tell me a joke about home automation"
response_id: "automation_joke" # Optional, defaults to "default"
model: "gpt-3.5-turbo" # Optional
temperature: 0.7 # Optional
max_tokens: 150 # Optional
top_p: 1.0 # Optional
frequency_penalty: 0.0 # Optional
presence_penalty: 0.0 # Optional