Skip to content

Commit 22845d1

Browse files
committed
Release v0.6.5
1 parent 7464922 commit 22845d1

File tree

6 files changed

+7183
-2755
lines changed

6 files changed

+7183
-2755
lines changed

assistants.go

Lines changed: 86 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -115,73 +115,6 @@ func (u UpdateAssistantDtoBackgroundSoundZero) Ptr() *UpdateAssistantDtoBackgrou
115115
return &u
116116
}
117117

118-
type UpdateAssistantDtoClientMessagesItem string
119-
120-
const (
121-
UpdateAssistantDtoClientMessagesItemConversationUpdate UpdateAssistantDtoClientMessagesItem = "conversation-update"
122-
UpdateAssistantDtoClientMessagesItemFunctionCall UpdateAssistantDtoClientMessagesItem = "function-call"
123-
UpdateAssistantDtoClientMessagesItemFunctionCallResult UpdateAssistantDtoClientMessagesItem = "function-call-result"
124-
UpdateAssistantDtoClientMessagesItemHang UpdateAssistantDtoClientMessagesItem = "hang"
125-
UpdateAssistantDtoClientMessagesItemLanguageChanged UpdateAssistantDtoClientMessagesItem = "language-changed"
126-
UpdateAssistantDtoClientMessagesItemMetadata UpdateAssistantDtoClientMessagesItem = "metadata"
127-
UpdateAssistantDtoClientMessagesItemModelOutput UpdateAssistantDtoClientMessagesItem = "model-output"
128-
UpdateAssistantDtoClientMessagesItemSpeechUpdate UpdateAssistantDtoClientMessagesItem = "speech-update"
129-
UpdateAssistantDtoClientMessagesItemStatusUpdate UpdateAssistantDtoClientMessagesItem = "status-update"
130-
UpdateAssistantDtoClientMessagesItemTranscript UpdateAssistantDtoClientMessagesItem = "transcript"
131-
UpdateAssistantDtoClientMessagesItemToolCalls UpdateAssistantDtoClientMessagesItem = "tool-calls"
132-
UpdateAssistantDtoClientMessagesItemToolCallsResult UpdateAssistantDtoClientMessagesItem = "tool-calls-result"
133-
UpdateAssistantDtoClientMessagesItemToolCompleted UpdateAssistantDtoClientMessagesItem = "tool.completed"
134-
UpdateAssistantDtoClientMessagesItemTransferUpdate UpdateAssistantDtoClientMessagesItem = "transfer-update"
135-
UpdateAssistantDtoClientMessagesItemUserInterrupted UpdateAssistantDtoClientMessagesItem = "user-interrupted"
136-
UpdateAssistantDtoClientMessagesItemVoiceInput UpdateAssistantDtoClientMessagesItem = "voice-input"
137-
UpdateAssistantDtoClientMessagesItemWorkflowNodeStarted UpdateAssistantDtoClientMessagesItem = "workflow.node.started"
138-
)
139-
140-
func NewUpdateAssistantDtoClientMessagesItemFromString(s string) (UpdateAssistantDtoClientMessagesItem, error) {
141-
switch s {
142-
case "conversation-update":
143-
return UpdateAssistantDtoClientMessagesItemConversationUpdate, nil
144-
case "function-call":
145-
return UpdateAssistantDtoClientMessagesItemFunctionCall, nil
146-
case "function-call-result":
147-
return UpdateAssistantDtoClientMessagesItemFunctionCallResult, nil
148-
case "hang":
149-
return UpdateAssistantDtoClientMessagesItemHang, nil
150-
case "language-changed":
151-
return UpdateAssistantDtoClientMessagesItemLanguageChanged, nil
152-
case "metadata":
153-
return UpdateAssistantDtoClientMessagesItemMetadata, nil
154-
case "model-output":
155-
return UpdateAssistantDtoClientMessagesItemModelOutput, nil
156-
case "speech-update":
157-
return UpdateAssistantDtoClientMessagesItemSpeechUpdate, nil
158-
case "status-update":
159-
return UpdateAssistantDtoClientMessagesItemStatusUpdate, nil
160-
case "transcript":
161-
return UpdateAssistantDtoClientMessagesItemTranscript, nil
162-
case "tool-calls":
163-
return UpdateAssistantDtoClientMessagesItemToolCalls, nil
164-
case "tool-calls-result":
165-
return UpdateAssistantDtoClientMessagesItemToolCallsResult, nil
166-
case "tool.completed":
167-
return UpdateAssistantDtoClientMessagesItemToolCompleted, nil
168-
case "transfer-update":
169-
return UpdateAssistantDtoClientMessagesItemTransferUpdate, nil
170-
case "user-interrupted":
171-
return UpdateAssistantDtoClientMessagesItemUserInterrupted, nil
172-
case "voice-input":
173-
return UpdateAssistantDtoClientMessagesItemVoiceInput, nil
174-
case "workflow.node.started":
175-
return UpdateAssistantDtoClientMessagesItemWorkflowNodeStarted, nil
176-
}
177-
var t UpdateAssistantDtoClientMessagesItem
178-
return "", fmt.Errorf("%s is not a valid %T", s, t)
179-
}
180-
181-
func (u UpdateAssistantDtoClientMessagesItem) Ptr() *UpdateAssistantDtoClientMessagesItem {
182-
return &u
183-
}
184-
185118
type UpdateAssistantDtoCredentialsItem struct {
186119
CreateElevenLabsCredentialDto *CreateElevenLabsCredentialDto
187120
CreateAnthropicCredentialDto *CreateAnthropicCredentialDto
@@ -1222,6 +1155,89 @@ func (u UpdateAssistantDtoFirstMessageMode) Ptr() *UpdateAssistantDtoFirstMessag
12221155
return &u
12231156
}
12241157

1158+
type UpdateAssistantDtoHooksItem struct {
1159+
AssistantHookCallEnding *AssistantHookCallEnding
1160+
AssistantHookAssistantSpeechInterrupted *AssistantHookAssistantSpeechInterrupted
1161+
AssistantHookCustomerSpeechInterrupted *AssistantHookCustomerSpeechInterrupted
1162+
1163+
typ string
1164+
}
1165+
1166+
func (u *UpdateAssistantDtoHooksItem) GetAssistantHookCallEnding() *AssistantHookCallEnding {
1167+
if u == nil {
1168+
return nil
1169+
}
1170+
return u.AssistantHookCallEnding
1171+
}
1172+
1173+
func (u *UpdateAssistantDtoHooksItem) GetAssistantHookAssistantSpeechInterrupted() *AssistantHookAssistantSpeechInterrupted {
1174+
if u == nil {
1175+
return nil
1176+
}
1177+
return u.AssistantHookAssistantSpeechInterrupted
1178+
}
1179+
1180+
func (u *UpdateAssistantDtoHooksItem) GetAssistantHookCustomerSpeechInterrupted() *AssistantHookCustomerSpeechInterrupted {
1181+
if u == nil {
1182+
return nil
1183+
}
1184+
return u.AssistantHookCustomerSpeechInterrupted
1185+
}
1186+
1187+
func (u *UpdateAssistantDtoHooksItem) UnmarshalJSON(data []byte) error {
1188+
valueAssistantHookCallEnding := new(AssistantHookCallEnding)
1189+
if err := json.Unmarshal(data, &valueAssistantHookCallEnding); err == nil {
1190+
u.typ = "AssistantHookCallEnding"
1191+
u.AssistantHookCallEnding = valueAssistantHookCallEnding
1192+
return nil
1193+
}
1194+
valueAssistantHookAssistantSpeechInterrupted := new(AssistantHookAssistantSpeechInterrupted)
1195+
if err := json.Unmarshal(data, &valueAssistantHookAssistantSpeechInterrupted); err == nil {
1196+
u.typ = "AssistantHookAssistantSpeechInterrupted"
1197+
u.AssistantHookAssistantSpeechInterrupted = valueAssistantHookAssistantSpeechInterrupted
1198+
return nil
1199+
}
1200+
valueAssistantHookCustomerSpeechInterrupted := new(AssistantHookCustomerSpeechInterrupted)
1201+
if err := json.Unmarshal(data, &valueAssistantHookCustomerSpeechInterrupted); err == nil {
1202+
u.typ = "AssistantHookCustomerSpeechInterrupted"
1203+
u.AssistantHookCustomerSpeechInterrupted = valueAssistantHookCustomerSpeechInterrupted
1204+
return nil
1205+
}
1206+
return fmt.Errorf("%s cannot be deserialized as a %T", data, u)
1207+
}
1208+
1209+
func (u UpdateAssistantDtoHooksItem) MarshalJSON() ([]byte, error) {
1210+
if u.typ == "AssistantHookCallEnding" || u.AssistantHookCallEnding != nil {
1211+
return json.Marshal(u.AssistantHookCallEnding)
1212+
}
1213+
if u.typ == "AssistantHookAssistantSpeechInterrupted" || u.AssistantHookAssistantSpeechInterrupted != nil {
1214+
return json.Marshal(u.AssistantHookAssistantSpeechInterrupted)
1215+
}
1216+
if u.typ == "AssistantHookCustomerSpeechInterrupted" || u.AssistantHookCustomerSpeechInterrupted != nil {
1217+
return json.Marshal(u.AssistantHookCustomerSpeechInterrupted)
1218+
}
1219+
return nil, fmt.Errorf("type %T does not include a non-empty union type", u)
1220+
}
1221+
1222+
type UpdateAssistantDtoHooksItemVisitor interface {
1223+
VisitAssistantHookCallEnding(*AssistantHookCallEnding) error
1224+
VisitAssistantHookAssistantSpeechInterrupted(*AssistantHookAssistantSpeechInterrupted) error
1225+
VisitAssistantHookCustomerSpeechInterrupted(*AssistantHookCustomerSpeechInterrupted) error
1226+
}
1227+
1228+
func (u *UpdateAssistantDtoHooksItem) Accept(visitor UpdateAssistantDtoHooksItemVisitor) error {
1229+
if u.typ == "AssistantHookCallEnding" || u.AssistantHookCallEnding != nil {
1230+
return visitor.VisitAssistantHookCallEnding(u.AssistantHookCallEnding)
1231+
}
1232+
if u.typ == "AssistantHookAssistantSpeechInterrupted" || u.AssistantHookAssistantSpeechInterrupted != nil {
1233+
return visitor.VisitAssistantHookAssistantSpeechInterrupted(u.AssistantHookAssistantSpeechInterrupted)
1234+
}
1235+
if u.typ == "AssistantHookCustomerSpeechInterrupted" || u.AssistantHookCustomerSpeechInterrupted != nil {
1236+
return visitor.VisitAssistantHookCustomerSpeechInterrupted(u.AssistantHookCustomerSpeechInterrupted)
1237+
}
1238+
return fmt.Errorf("type %T does not include a non-empty union type", u)
1239+
}
1240+
12251241
// These are the options for the assistant's LLM.
12261242
type UpdateAssistantDtoModel struct {
12271243
AnyscaleModel *AnyscaleModel
@@ -2236,9 +2252,8 @@ type UpdateAssistantDto struct {
22362252
// This uses Twilio's built-in detection while the VoicemailTool relies on the model to detect if a voicemail was reached.
22372253
// You can use neither of them, one of them, or both of them. By default, Twilio built-in detection is enabled while VoicemailTool is not.
22382254
VoicemailDetection *UpdateAssistantDtoVoicemailDetection `json:"voicemailDetection,omitempty" url:"-"`
2239-
// These are the messages that will be sent to your Client SDKs. Default is conversation-update,function-call,hang,model-output,speech-update,status-update,transfer-update,transcript,tool-calls,user-interrupted,voice-input,workflow.node.started. You can check the shape of the messages in ClientMessage schema.
2240-
ClientMessages []UpdateAssistantDtoClientMessagesItem `json:"clientMessages,omitempty" url:"-"`
2241-
ServerMessages [][]map[string]interface{} `json:"serverMessages,omitempty" url:"-"`
2255+
ClientMessages [][]map[string]interface{} `json:"clientMessages,omitempty" url:"-"`
2256+
ServerMessages [][]map[string]interface{} `json:"serverMessages,omitempty" url:"-"`
22422257
// How many seconds of silence to wait before ending the call. Defaults to 30.
22432258
//
22442259
// @default 30
@@ -2270,7 +2285,7 @@ type UpdateAssistantDto struct {
22702285
// These are dynamic credentials that will be used for the assistant calls. By default, all the credentials are available for use in the call but you can supplement an additional credentials using this. Dynamic credentials override existing credentials.
22712286
Credentials []*UpdateAssistantDtoCredentialsItem `json:"credentials,omitempty" url:"-"`
22722287
// This is a set of actions that will be performed on certain events.
2273-
Hooks []*AssistantHookCallEnding `json:"hooks,omitempty" url:"-"`
2288+
Hooks []*UpdateAssistantDtoHooksItem `json:"hooks,omitempty" url:"-"`
22742289
// This is the name of the assistant.
22752290
//
22762291
// This is required when you want to transfer between assistants in a call.

calls.go

Lines changed: 95 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,49 @@ type CreateCallDto struct {
2121
// This is the transport of the call.
2222
Transport map[string]interface{} `json:"transport,omitempty" url:"-"`
2323
// This is the assistant that will be used for the call. To use a transient assistant, use `assistant` instead.
24+
// Usage:
25+
//
26+
// To start the call with Assistant as entrypoint, use assistant or assistantId
27+
// To start the call with Squad as entrypoint, use squad or squadId
28+
// To start the call with Workflow as entrypoint, use workflow or workflowId
2429
AssistantId *string `json:"assistantId,omitempty" url:"-"`
2530
// This is the assistant that will be used for the call. To use an existing assistant, use `assistantId` instead.
31+
// Usage:
32+
//
33+
// To start the call with Assistant as entrypoint, use assistant or assistantId
34+
// To start the call with Squad as entrypoint, use squad or squadId
35+
// To start the call with Workflow as entrypoint, use workflow or workflowId
2636
Assistant *CreateAssistantDto `json:"assistant,omitempty" url:"-"`
2737
// These are the overrides for the `assistant` or `assistantId`'s settings and template variables.
2838
AssistantOverrides *AssistantOverrides `json:"assistantOverrides,omitempty" url:"-"`
2939
// This is the squad that will be used for the call. To use a transient squad, use `squad` instead.
40+
// Usage:
41+
//
42+
// To start the call with Assistant as entrypoint, use assistant or assistantId
43+
// To start the call with Squad as entrypoint, use squad or squadId
44+
// To start the call with Workflow as entrypoint, use workflow or workflowId
3045
SquadId *string `json:"squadId,omitempty" url:"-"`
3146
// This is a squad that will be used for the call. To use an existing squad, use `squadId` instead.
47+
// Usage:
48+
//
49+
// To start the call with Assistant as entrypoint, use assistant or assistantId
50+
// To start the call with Squad as entrypoint, use squad or squadId
51+
// To start the call with Workflow as entrypoint, use workflow or workflowId
3252
Squad *CreateSquadDto `json:"squad,omitempty" url:"-"`
53+
// This is the workflow that will be used for the call. To use a transient workflow, use `workflow` instead.
54+
// Usage:
55+
//
56+
// To start the call with Assistant as entrypoint, use assistant or assistantId
57+
// To start the call with Squad as entrypoint, use squad or squadId
58+
// To start the call with Workflow as entrypoint, use workflow or workflowId
59+
WorkflowId *string `json:"workflowId,omitempty" url:"-"`
60+
// This is a workflow that will be used for the call. To use an existing workflow, use `workflowId` instead.
61+
// Usage:
62+
//
63+
// To start the call with Assistant as entrypoint, use assistant or assistantId
64+
// To start the call with Squad as entrypoint, use squad or squadId
65+
// To start the call with Workflow as entrypoint, use workflow or workflowId
66+
Workflow *CreateWorkflowDto `json:"workflow,omitempty" url:"-"`
3367
// This is the phone number that will be used for the call. To use a transient number, use `phoneNumber` instead.
3468
//
3569
// Only relevant for `outboundPhoneCall` and `inboundPhoneCall` type.
@@ -455,15 +489,49 @@ type Call struct {
455489
// Only relevant for `outboundPhoneCall` and `inboundPhoneCall` type.
456490
PhoneCallProviderId *string `json:"phoneCallProviderId,omitempty" url:"phoneCallProviderId,omitempty"`
457491
// This is the assistant that will be used for the call. To use a transient assistant, use `assistant` instead.
492+
// Usage:
493+
//
494+
// To start the call with Assistant as entrypoint, use assistant or assistantId
495+
// To start the call with Squad as entrypoint, use squad or squadId
496+
// To start the call with Workflow as entrypoint, use workflow or workflowId
458497
AssistantId *string `json:"assistantId,omitempty" url:"assistantId,omitempty"`
459498
// This is the assistant that will be used for the call. To use an existing assistant, use `assistantId` instead.
499+
// Usage:
500+
//
501+
// To start the call with Assistant as entrypoint, use assistant or assistantId
502+
// To start the call with Squad as entrypoint, use squad or squadId
503+
// To start the call with Workflow as entrypoint, use workflow or workflowId
460504
Assistant *CreateAssistantDto `json:"assistant,omitempty" url:"assistant,omitempty"`
461505
// These are the overrides for the `assistant` or `assistantId`'s settings and template variables.
462506
AssistantOverrides *AssistantOverrides `json:"assistantOverrides,omitempty" url:"assistantOverrides,omitempty"`
463507
// This is the squad that will be used for the call. To use a transient squad, use `squad` instead.
508+
// Usage:
509+
//
510+
// To start the call with Assistant as entrypoint, use assistant or assistantId
511+
// To start the call with Squad as entrypoint, use squad or squadId
512+
// To start the call with Workflow as entrypoint, use workflow or workflowId
464513
SquadId *string `json:"squadId,omitempty" url:"squadId,omitempty"`
465514
// This is a squad that will be used for the call. To use an existing squad, use `squadId` instead.
515+
// Usage:
516+
//
517+
// To start the call with Assistant as entrypoint, use assistant or assistantId
518+
// To start the call with Squad as entrypoint, use squad or squadId
519+
// To start the call with Workflow as entrypoint, use workflow or workflowId
466520
Squad *CreateSquadDto `json:"squad,omitempty" url:"squad,omitempty"`
521+
// This is the workflow that will be used for the call. To use a transient workflow, use `workflow` instead.
522+
// Usage:
523+
//
524+
// To start the call with Assistant as entrypoint, use assistant or assistantId
525+
// To start the call with Squad as entrypoint, use squad or squadId
526+
// To start the call with Workflow as entrypoint, use workflow or workflowId
527+
WorkflowId *string `json:"workflowId,omitempty" url:"workflowId,omitempty"`
528+
// This is a workflow that will be used for the call. To use an existing workflow, use `workflowId` instead.
529+
// Usage:
530+
//
531+
// To start the call with Assistant as entrypoint, use assistant or assistantId
532+
// To start the call with Squad as entrypoint, use squad or squadId
533+
// To start the call with Workflow as entrypoint, use workflow or workflowId
534+
Workflow *CreateWorkflowDto `json:"workflow,omitempty" url:"workflow,omitempty"`
467535
// This is the phone number that will be used for the call. To use a transient number, use `phoneNumber` instead.
468536
//
469537
// Only relevant for `outboundPhoneCall` and `inboundPhoneCall` type.
@@ -673,6 +741,20 @@ func (c *Call) GetSquad() *CreateSquadDto {
673741
return c.Squad
674742
}
675743

744+
func (c *Call) GetWorkflowId() *string {
745+
if c == nil {
746+
return nil
747+
}
748+
return c.WorkflowId
749+
}
750+
751+
func (c *Call) GetWorkflow() *CreateWorkflowDto {
752+
if c == nil {
753+
return nil
754+
}
755+
return c.Workflow
756+
}
757+
676758
func (c *Call) GetPhoneNumberId() *string {
677759
if c == nil {
678760
return nil
@@ -3130,11 +3212,15 @@ type ImportTwilioPhoneNumberDto struct {
31303212
Name *string `json:"name,omitempty" url:"name,omitempty"`
31313213
// This is the assistant that will be used for incoming calls to this phone number.
31323214
//
3133-
// If neither `assistantId` nor `squadId` is set, `assistant-request` will be sent to your Server URL. Check `ServerMessage` and `ServerMessageResponse` for the shape of the message and response that is expected.
3215+
// If neither `assistantId`, `squadId` nor `workflowId` is set, `assistant-request` will be sent to your Server URL. Check `ServerMessage` and `ServerMessageResponse` for the shape of the message and response that is expected.
31343216
AssistantId *string `json:"assistantId,omitempty" url:"assistantId,omitempty"`
3217+
// This is the workflow that will be used for incoming calls to this phone number.
3218+
//
3219+
// If neither `assistantId`, `squadId`, nor `workflowId` is set, `assistant-request` will be sent to your Server URL. Check `ServerMessage` and `ServerMessageResponse` for the shape of the message and response that is expected.
3220+
WorkflowId *string `json:"workflowId,omitempty" url:"workflowId,omitempty"`
31353221
// This is the squad that will be used for incoming calls to this phone number.
31363222
//
3137-
// If neither `assistantId` nor `squadId` is set, `assistant-request` will be sent to your Server URL. Check `ServerMessage` and `ServerMessageResponse` for the shape of the message and response that is expected.
3223+
// If neither `assistantId`, `squadId`, nor `workflowId` is set, `assistant-request` will be sent to your Server URL. Check `ServerMessage` and `ServerMessageResponse` for the shape of the message and response that is expected.
31383224
SquadId *string `json:"squadId,omitempty" url:"squadId,omitempty"`
31393225
// This is where Vapi will send webhooks. You can find all webhooks available along with their shape in ServerMessage schema.
31403226
//
@@ -3219,6 +3305,13 @@ func (i *ImportTwilioPhoneNumberDto) GetAssistantId() *string {
32193305
return i.AssistantId
32203306
}
32213307

3308+
func (i *ImportTwilioPhoneNumberDto) GetWorkflowId() *string {
3309+
if i == nil {
3310+
return nil
3311+
}
3312+
return i.WorkflowId
3313+
}
3314+
32223315
func (i *ImportTwilioPhoneNumberDto) GetSquadId() *string {
32233316
if i == nil {
32243317
return nil

core/request_option.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ func (r *RequestOptions) cloneHeader() http.Header {
5656
headers := r.HTTPHeader.Clone()
5757
headers.Set("X-Fern-Language", "Go")
5858
headers.Set("X-Fern-SDK-Name", "github.com/VapiAI/server-sdk-go")
59-
headers.Set("X-Fern-SDK-Version", "v0.6.4")
60-
headers.Set("User-Agent", "github.com/VapiAI/server-sdk-go/0.6.4")
59+
headers.Set("X-Fern-SDK-Version", "v0.6.5")
60+
headers.Set("User-Agent", "github.com/VapiAI/server-sdk-go/0.6.5")
6161
return headers
6262
}
6363

0 commit comments

Comments
 (0)