Overview
Package conversation is Home Assistant's conversation domain: its types.
Entity controls one conversation entity over HTTP.
No method for conversation.process and conversation.reload, which target no entity: call api.Client.CallService.
Home Assistant documents the domain here:
Integration: https://www.home-assistant.io/integrations/conversation/
Entity model (developers): https://contributors.home-assistant.io/core/entities/conversation/
Control
// client is an *api.Client
target := conversation.Get(client, "my_conversation")
state, err := target.State(ctx)
Commands
Services without a method
Call these with the REST or WebSocket client.
| Service | Why |
|---|---|
conversation.process | it targets no entity |
conversation.reload | it targets no entity |
Control
type Entity struct
Entity controls one conversation entity over HTTP (api.Client). State and Subscribe come from the embedded Handle.
Embeds entity.Handle[Attributes], whose methods it has too.
func Get(transport entity.Transport, id string) *Entity
Get returns the conversation entity with the given id: an entity id over HTTP (the "conversation." prefix may be omitted). It does no I/O.
func List(ctx context.Context, transport entity.Transport) ([]*Entity, error)
List returns every conversation entity the transport can see.
type State = entity.State[Attributes]
State is a snapshot of one conversation entity.
State and values
type Attributes struct
Attributes are the state attributes of a conversation entity, under the names Home Assistant publishes them with.
See: https://www.home-assistant.io/integrations/conversation/
| Field | Type | Wire key | Description |
|---|---|---|---|
SupportedFeatures | Feature | supported_features | A set of Feature flags. |
ChatLogEventType
type ChatLogEventType string
ChatLogEventType is core's ChatLogEventType.
| Constant | Value |
|---|---|
ChatLogEventTypeUnknown | "Unknown" |
ChatLogEventTypeInitialState | "initial_state" |
ChatLogEventTypeCreated | "created" |
ChatLogEventTypeUpdated | "updated" |
ChatLogEventTypeDeleted | "deleted" |
ChatLogEventTypeContentAdded | "content_added" |
func ChatLogEventTypeFromString(s string) ChatLogEventType
ChatLogEventTypeFromString returns the ChatLogEventType spelled s, by its value or by the name of core's member, and ChatLogEventTypeUnknown for anything else.
func (v *ChatLogEventType) UnmarshalJSON(data []byte) error
UnmarshalJSON reads any spelling ChatLogEventTypeFromString accepts.
Feature
type Feature uint64
Feature is a set of conversation supported features, with the values of core's ConversationEntityFeature: the supported_features attribute decodes into it.
| Constant | Value |
|---|---|
FeatureUnknown | 0 |
FeatureControl | 1 << 0 |
func FeatureFromString(s string) Feature
FeatureFromString returns the Feature spelled s, by its value or by the name of core's member, and FeatureUnknown for anything else.
IntentSource
type IntentSource string
IntentSource is core's IntentSource.
| Constant | Value |
|---|---|
IntentSourceUnknown | "Unknown" |
IntentSourceConfig | "config" |
IntentSourceTrigger | "trigger" |
func IntentSourceFromString(s string) IntentSource
IntentSourceFromString returns the IntentSource spelled s, by its value or by the name of core's member, and IntentSourceUnknown for anything else.
func (v *IntentSource) UnmarshalJSON(data []byte) error
UnmarshalJSON reads any spelling IntentSourceFromString accepts.
TraceEventType
type TraceEventType string
TraceEventType is core's ConversationTraceEventType.
| Constant | Value |
|---|---|
TraceEventTypeUnknown | "Unknown" |
TraceEventTypeAsyncProcess | "async_process" |
TraceEventTypeAgentDetail | "agent_detail" |
TraceEventTypeToolCall | "tool_call" |
TraceEventTypeTurnContent | "turn_content" |
func TraceEventTypeFromString(s string) TraceEventType
TraceEventTypeFromString returns the TraceEventType spelled s, by its value or by the name of core's member, and TraceEventTypeUnknown for anything else.
func (v *TraceEventType) UnmarshalJSON(data []byte) error
UnmarshalJSON reads any spelling TraceEventTypeFromString accepts.