Skip to content

Commit 8c99227

Browse files
🌿 Fern Regeneration -- January 15, 2025 (#222)
Co-authored-by: fern-api <115122769+fern-api[bot]@users.noreply.github.com> Co-authored-by: twitchard <[email protected]>
1 parent 5acfaf4 commit 8c99227

File tree

11 files changed

+337
-73
lines changed

11 files changed

+337
-73
lines changed

.mock/definition/empathic-voice/__package__.yml

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3190,3 +3190,87 @@ types:
31903190
type: string
31913191
source:
31923192
openapi: assistant-openapi.json
3193+
WebhookEventChatEnded:
3194+
properties:
3195+
event_name:
3196+
type: optional<literal<"chat_ended">>
3197+
docs: Always `chat_ended`.
3198+
end_time: integer
3199+
duration_seconds: integer
3200+
end_reason:
3201+
type: WebhookEventChatStatus
3202+
caller_number: optional<string>
3203+
custom_session_id: optional<string>
3204+
extends:
3205+
- WebhookEventBase
3206+
source:
3207+
openapi: assistant-openapi.json
3208+
WebhookEventChatStartType:
3209+
enum:
3210+
- new_chat_group
3211+
- resumed_chat_group
3212+
source:
3213+
openapi: assistant-openapi.json
3214+
WebhookEventChatStarted:
3215+
properties:
3216+
event_name:
3217+
type: optional<literal<"chat_started">>
3218+
docs: Always `chat_started`.
3219+
start_time:
3220+
type: integer
3221+
docs: Unix timestamp (in milliseconds) indicating when the session started.
3222+
chat_start_type:
3223+
type: WebhookEventChatStartType
3224+
docs: >-
3225+
Indicates whether the chat is the first in a new Chat Group
3226+
(`new_chat_group`) or the continuation of an existing chat group
3227+
(`resumed_chat_group`).
3228+
caller_number:
3229+
type: optional<string>
3230+
docs: >-
3231+
Phone number of the caller in E.164 format (e.g., `+12223333333`).
3232+
This field is included only if the Chat was created via the [Twilio
3233+
phone calling](/docs/empathic-voice-interface-evi/phone-calling)
3234+
integration.
3235+
custom_session_id:
3236+
type: optional<string>
3237+
docs: >-
3238+
User-defined session ID. Relevant only when employing a [custom
3239+
language
3240+
model](/docs/empathic-voice-interface-evi/custom-language-model) in
3241+
the EVI Config.
3242+
extends:
3243+
- WebhookEventBase
3244+
source:
3245+
openapi: assistant-openapi.json
3246+
WebhookEventChatStatus:
3247+
enum:
3248+
- ACTIVE
3249+
- USER_ENDED
3250+
- USER_TIMEOUT
3251+
- INACTIVITY_TIMEOUT
3252+
- MAX_DURATION_TIMEOUT
3253+
- ERROR
3254+
source:
3255+
openapi: assistant-openapi.json
3256+
WebhookEvent:
3257+
discriminated: false
3258+
union:
3259+
- WebhookEventChatStarted
3260+
- WebhookEventChatEnded
3261+
source:
3262+
openapi: assistant-openapi.json
3263+
WebhookEventBase:
3264+
docs: Represents the fields common to all webhook events.
3265+
properties:
3266+
chat_group_id:
3267+
type: string
3268+
docs: Unique ID of the **Chat Group** associated with the **Chat** session.
3269+
chat_id:
3270+
type: string
3271+
docs: Unique ID of the **Chat** session.
3272+
config_id:
3273+
type: optional<string>
3274+
docs: Unique ID of the EVI **Config** used for the session.
3275+
source:
3276+
openapi: assistant-openapi.json
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
imports:
2+
root: __package__.yml
3+
webhooks:
4+
chatWebhook:
5+
method: POST
6+
display-name: Chat Webhook
7+
headers: {}
8+
payload: root.WebhookEvent
9+
examples:
10+
- payload:
11+
chat_group_id: chat_group_id
12+
chat_id: chat_id
13+
start_time: 1
14+
chat_start_type: new_chat_group
15+
docs: >-
16+
Webhook events are JSON payloads to your server during an EVI chat. You
17+
can subscribe to specific events, and set which URLs should be notified in
18+
the
19+
[Config](/reference/empathic-voice-interface-evi/configs/create-config#request.body.webhooks)
20+
resource. Read the [Webhook
21+
Guide](/docs/empathic-voice-interface-evi/webhooks) for more information.

poetry.lock

Lines changed: 80 additions & 73 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/hume/empathic_voice/__init__.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,12 @@
113113
ValidationError,
114114
ValidationErrorLocItem,
115115
WebSocketError,
116+
WebhookEvent,
117+
WebhookEventBase,
118+
WebhookEventChatEnded,
119+
WebhookEventChatStartType,
120+
WebhookEventChatStarted,
121+
WebhookEventChatStatus,
116122
)
117123
from .errors import BadRequestError
118124
from . import chat, chat_groups, chats, configs, custom_voices, prompts, tools
@@ -234,6 +240,12 @@
234240
"ValidationError",
235241
"ValidationErrorLocItem",
236242
"WebSocketError",
243+
"WebhookEvent",
244+
"WebhookEventBase",
245+
"WebhookEventChatEnded",
246+
"WebhookEventChatStartType",
247+
"WebhookEventChatStarted",
248+
"WebhookEventChatStatus",
237249
"chat",
238250
"chat_groups",
239251
"chats",

src/hume/empathic_voice/types/__init__.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,12 @@
114114
from .validation_error import ValidationError
115115
from .validation_error_loc_item import ValidationErrorLocItem
116116
from .web_socket_error import WebSocketError
117+
from .webhook_event import WebhookEvent
118+
from .webhook_event_base import WebhookEventBase
119+
from .webhook_event_chat_ended import WebhookEventChatEnded
120+
from .webhook_event_chat_start_type import WebhookEventChatStartType
121+
from .webhook_event_chat_started import WebhookEventChatStarted
122+
from .webhook_event_chat_status import WebhookEventChatStatus
117123

118124
__all__ = [
119125
"AssistantEnd",
@@ -228,4 +234,10 @@
228234
"ValidationError",
229235
"ValidationErrorLocItem",
230236
"WebSocketError",
237+
"WebhookEvent",
238+
"WebhookEventBase",
239+
"WebhookEventChatEnded",
240+
"WebhookEventChatStartType",
241+
"WebhookEventChatStarted",
242+
"WebhookEventChatStatus",
231243
]
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# This file was auto-generated by Fern from our API Definition.
2+
3+
import typing
4+
from .webhook_event_chat_started import WebhookEventChatStarted
5+
from .webhook_event_chat_ended import WebhookEventChatEnded
6+
7+
WebhookEvent = typing.Union[WebhookEventChatStarted, WebhookEventChatEnded]
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# This file was auto-generated by Fern from our API Definition.
2+
3+
from ...core.pydantic_utilities import UniversalBaseModel
4+
import pydantic
5+
import typing
6+
from ...core.pydantic_utilities import IS_PYDANTIC_V2
7+
8+
9+
class WebhookEventBase(UniversalBaseModel):
10+
"""
11+
Represents the fields common to all webhook events.
12+
"""
13+
14+
chat_group_id: str = pydantic.Field()
15+
"""
16+
Unique ID of the **Chat Group** associated with the **Chat** session.
17+
"""
18+
19+
chat_id: str = pydantic.Field()
20+
"""
21+
Unique ID of the **Chat** session.
22+
"""
23+
24+
config_id: typing.Optional[str] = pydantic.Field(default=None)
25+
"""
26+
Unique ID of the EVI **Config** used for the session.
27+
"""
28+
29+
if IS_PYDANTIC_V2:
30+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
31+
else:
32+
33+
class Config:
34+
frozen = True
35+
smart_union = True
36+
extra = pydantic.Extra.allow
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# This file was auto-generated by Fern from our API Definition.
2+
3+
from .webhook_event_base import WebhookEventBase
4+
import typing
5+
import pydantic
6+
from .webhook_event_chat_status import WebhookEventChatStatus
7+
from ...core.pydantic_utilities import IS_PYDANTIC_V2
8+
9+
10+
class WebhookEventChatEnded(WebhookEventBase):
11+
event_name: typing.Optional[typing.Literal["chat_ended"]] = pydantic.Field(default=None)
12+
"""
13+
Always `chat_ended`.
14+
"""
15+
16+
end_time: int
17+
duration_seconds: int
18+
end_reason: WebhookEventChatStatus
19+
caller_number: typing.Optional[str] = None
20+
custom_session_id: typing.Optional[str] = None
21+
22+
if IS_PYDANTIC_V2:
23+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
24+
else:
25+
26+
class Config:
27+
frozen = True
28+
smart_union = True
29+
extra = pydantic.Extra.allow
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# This file was auto-generated by Fern from our API Definition.
2+
3+
import typing
4+
5+
WebhookEventChatStartType = typing.Union[typing.Literal["new_chat_group", "resumed_chat_group"], typing.Any]
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# This file was auto-generated by Fern from our API Definition.
2+
3+
from .webhook_event_base import WebhookEventBase
4+
import typing
5+
import pydantic
6+
from .webhook_event_chat_start_type import WebhookEventChatStartType
7+
from ...core.pydantic_utilities import IS_PYDANTIC_V2
8+
9+
10+
class WebhookEventChatStarted(WebhookEventBase):
11+
event_name: typing.Optional[typing.Literal["chat_started"]] = pydantic.Field(default=None)
12+
"""
13+
Always `chat_started`.
14+
"""
15+
16+
start_time: int = pydantic.Field()
17+
"""
18+
Unix timestamp (in milliseconds) indicating when the session started.
19+
"""
20+
21+
chat_start_type: WebhookEventChatStartType = pydantic.Field()
22+
"""
23+
Indicates whether the chat is the first in a new Chat Group (`new_chat_group`) or the continuation of an existing chat group (`resumed_chat_group`).
24+
"""
25+
26+
caller_number: typing.Optional[str] = pydantic.Field(default=None)
27+
"""
28+
Phone number of the caller in E.164 format (e.g., `+12223333333`). This field is included only if the Chat was created via the [Twilio phone calling](/docs/empathic-voice-interface-evi/phone-calling) integration.
29+
"""
30+
31+
custom_session_id: typing.Optional[str] = pydantic.Field(default=None)
32+
"""
33+
User-defined session ID. Relevant only when employing a [custom language model](/docs/empathic-voice-interface-evi/custom-language-model) in the EVI Config.
34+
"""
35+
36+
if IS_PYDANTIC_V2:
37+
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
38+
else:
39+
40+
class Config:
41+
frozen = True
42+
smart_union = True
43+
extra = pydantic.Extra.allow
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# This file was auto-generated by Fern from our API Definition.
2+
3+
import typing
4+
5+
WebhookEventChatStatus = typing.Union[
6+
typing.Literal["ACTIVE", "USER_ENDED", "USER_TIMEOUT", "INACTIVITY_TIMEOUT", "MAX_DURATION_TIMEOUT", "ERROR"],
7+
typing.Any,
8+
]

0 commit comments

Comments
 (0)