From 69e1137d72d13252f174feca53d204aecdcdde58 Mon Sep 17 00:00:00 2001 From: fern-api <115122769+fern-api[bot]@users.noreply.github.com> Date: Wed, 22 Jan 2025 14:58:42 +0000 Subject: [PATCH] Release v0.4.0 --- core/request_option.go | 4 +- knowledge_bases.go | 507 +++++++-- logs.go | 79 +- types.go | 2244 +++++++++++++++++++++++++++++++++++++--- 4 files changed, 2567 insertions(+), 267 deletions(-) diff --git a/core/request_option.go b/core/request_option.go index d16ab66..a48a992 100644 --- a/core/request_option.go +++ b/core/request_option.go @@ -56,8 +56,8 @@ func (r *RequestOptions) cloneHeader() http.Header { headers := r.HTTPHeader.Clone() headers.Set("X-Fern-Language", "Go") headers.Set("X-Fern-SDK-Name", "github.com/VapiAI/server-sdk-go") - headers.Set("X-Fern-SDK-Version", "v0.3.0") - headers.Set("User-Agent", "github.com/VapiAI/server-sdk-go/0.3.0") + headers.Set("X-Fern-SDK-Version", "v0.4.0") + headers.Set("User-Agent", "github.com/VapiAI/server-sdk-go/0.4.0") return headers } diff --git a/knowledge_bases.go b/knowledge_bases.go index db39508..3e8065a 100644 --- a/knowledge_bases.go +++ b/knowledge_bases.go @@ -33,17 +33,15 @@ type KnowledgeBasesListRequest struct { type CreateTrieveKnowledgeBaseDto struct { // This is the name of the knowledge base. Name *string `json:"name,omitempty" url:"name,omitempty"` - // This is the plan on how to search the vector store while a call is going on. - VectorStoreSearchPlan *TrieveKnowledgeBaseVectorStoreSearchPlan `json:"vectorStoreSearchPlan,omitempty" url:"vectorStoreSearchPlan,omitempty"` - // This is the plan if you want us to create a new vector store on your behalf. To use an existing vector store from your account, use `vectoreStoreProviderId` - VectorStoreCreatePlan *TrieveKnowledgeBaseVectorStoreCreatePlan `json:"vectorStoreCreatePlan,omitempty" url:"vectorStoreCreatePlan,omitempty"` - // This is an vector store that you already have on your account with the provider. To create a new vector store, use vectorStoreCreatePlan. + // This is the searching plan used when searching for relevant chunks from the vector store. // - // Usage: - // - To bring your own vector store from Trieve, go to https://trieve.ai - // - Create a dataset, and use the datasetId here. - VectorStoreProviderId *string `json:"vectorStoreProviderId,omitempty" url:"vectorStoreProviderId,omitempty"` - provider string + // You should configure this if you're running into these issues: + // - Too much unnecessary context is being fed as knowledge base context. + // - Not enough relevant context is being fed as knowledge base context. + SearchPlan *TrieveKnowledgeBaseSearchPlan `json:"searchPlan,omitempty" url:"searchPlan,omitempty"` + // This is the plan if you want us to create/import a new vector store using Trieve. + CreatePlan *CreateTrieveKnowledgeBaseDtoCreatePlan `json:"createPlan,omitempty" url:"createPlan,omitempty"` + provider string extraProperties map[string]interface{} rawJSON json.RawMessage @@ -56,25 +54,18 @@ func (c *CreateTrieveKnowledgeBaseDto) GetName() *string { return c.Name } -func (c *CreateTrieveKnowledgeBaseDto) GetVectorStoreSearchPlan() *TrieveKnowledgeBaseVectorStoreSearchPlan { +func (c *CreateTrieveKnowledgeBaseDto) GetSearchPlan() *TrieveKnowledgeBaseSearchPlan { if c == nil { return nil } - return c.VectorStoreSearchPlan + return c.SearchPlan } -func (c *CreateTrieveKnowledgeBaseDto) GetVectorStoreCreatePlan() *TrieveKnowledgeBaseVectorStoreCreatePlan { +func (c *CreateTrieveKnowledgeBaseDto) GetCreatePlan() *CreateTrieveKnowledgeBaseDtoCreatePlan { if c == nil { return nil } - return c.VectorStoreCreatePlan -} - -func (c *CreateTrieveKnowledgeBaseDto) GetVectorStoreProviderId() *string { - if c == nil { - return nil - } - return c.VectorStoreProviderId + return c.CreatePlan } func (c *CreateTrieveKnowledgeBaseDto) Provider() string { @@ -134,8 +125,70 @@ func (c *CreateTrieveKnowledgeBaseDto) String() string { return fmt.Sprintf("%#v", c) } +// This is the plan if you want us to create/import a new vector store using Trieve. +type CreateTrieveKnowledgeBaseDtoCreatePlan struct { + TrieveKnowledgeBaseCreate *TrieveKnowledgeBaseCreate + TrieveKnowledgeBaseImport *TrieveKnowledgeBaseImport + + typ string +} + +func (c *CreateTrieveKnowledgeBaseDtoCreatePlan) GetTrieveKnowledgeBaseCreate() *TrieveKnowledgeBaseCreate { + if c == nil { + return nil + } + return c.TrieveKnowledgeBaseCreate +} + +func (c *CreateTrieveKnowledgeBaseDtoCreatePlan) GetTrieveKnowledgeBaseImport() *TrieveKnowledgeBaseImport { + if c == nil { + return nil + } + return c.TrieveKnowledgeBaseImport +} + +func (c *CreateTrieveKnowledgeBaseDtoCreatePlan) UnmarshalJSON(data []byte) error { + valueTrieveKnowledgeBaseCreate := new(TrieveKnowledgeBaseCreate) + if err := json.Unmarshal(data, &valueTrieveKnowledgeBaseCreate); err == nil { + c.typ = "TrieveKnowledgeBaseCreate" + c.TrieveKnowledgeBaseCreate = valueTrieveKnowledgeBaseCreate + return nil + } + valueTrieveKnowledgeBaseImport := new(TrieveKnowledgeBaseImport) + if err := json.Unmarshal(data, &valueTrieveKnowledgeBaseImport); err == nil { + c.typ = "TrieveKnowledgeBaseImport" + c.TrieveKnowledgeBaseImport = valueTrieveKnowledgeBaseImport + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, c) +} + +func (c CreateTrieveKnowledgeBaseDtoCreatePlan) MarshalJSON() ([]byte, error) { + if c.typ == "TrieveKnowledgeBaseCreate" || c.TrieveKnowledgeBaseCreate != nil { + return json.Marshal(c.TrieveKnowledgeBaseCreate) + } + if c.typ == "TrieveKnowledgeBaseImport" || c.TrieveKnowledgeBaseImport != nil { + return json.Marshal(c.TrieveKnowledgeBaseImport) + } + return nil, fmt.Errorf("type %T does not include a non-empty union type", c) +} + +type CreateTrieveKnowledgeBaseDtoCreatePlanVisitor interface { + VisitTrieveKnowledgeBaseCreate(*TrieveKnowledgeBaseCreate) error + VisitTrieveKnowledgeBaseImport(*TrieveKnowledgeBaseImport) error +} + +func (c *CreateTrieveKnowledgeBaseDtoCreatePlan) Accept(visitor CreateTrieveKnowledgeBaseDtoCreatePlanVisitor) error { + if c.typ == "TrieveKnowledgeBaseCreate" || c.TrieveKnowledgeBaseCreate != nil { + return visitor.VisitTrieveKnowledgeBaseCreate(c.TrieveKnowledgeBaseCreate) + } + if c.typ == "TrieveKnowledgeBaseImport" || c.TrieveKnowledgeBaseImport != nil { + return visitor.VisitTrieveKnowledgeBaseImport(c.TrieveKnowledgeBaseImport) + } + return fmt.Errorf("type %T does not include a non-empty union type", c) +} + type CustomKnowledgeBase struct { - // /** // This is where the knowledge base request will be sent. // // Request Example: @@ -269,16 +322,14 @@ func (c *CustomKnowledgeBase) String() string { type TrieveKnowledgeBase struct { // This is the name of the knowledge base. Name *string `json:"name,omitempty" url:"name,omitempty"` - // This is the plan on how to search the vector store while a call is going on. - VectorStoreSearchPlan *TrieveKnowledgeBaseVectorStoreSearchPlan `json:"vectorStoreSearchPlan,omitempty" url:"vectorStoreSearchPlan,omitempty"` - // This is the plan if you want us to create a new vector store on your behalf. To use an existing vector store from your account, use `vectoreStoreProviderId` - VectorStoreCreatePlan *TrieveKnowledgeBaseVectorStoreCreatePlan `json:"vectorStoreCreatePlan,omitempty" url:"vectorStoreCreatePlan,omitempty"` - // This is an vector store that you already have on your account with the provider. To create a new vector store, use vectorStoreCreatePlan. + // This is the searching plan used when searching for relevant chunks from the vector store. // - // Usage: - // - To bring your own vector store from Trieve, go to https://trieve.ai - // - Create a dataset, and use the datasetId here. - VectorStoreProviderId *string `json:"vectorStoreProviderId,omitempty" url:"vectorStoreProviderId,omitempty"` + // You should configure this if you're running into these issues: + // - Too much unnecessary context is being fed as knowledge base context. + // - Not enough relevant context is being fed as knowledge base context. + SearchPlan *TrieveKnowledgeBaseSearchPlan `json:"searchPlan,omitempty" url:"searchPlan,omitempty"` + // This is the plan if you want us to create/import a new vector store using Trieve. + CreatePlan *TrieveKnowledgeBaseCreatePlan `json:"createPlan,omitempty" url:"createPlan,omitempty"` // This is the id of the knowledge base. Id string `json:"id" url:"id"` // This is the org id of the knowledge base. @@ -296,25 +347,18 @@ func (t *TrieveKnowledgeBase) GetName() *string { return t.Name } -func (t *TrieveKnowledgeBase) GetVectorStoreSearchPlan() *TrieveKnowledgeBaseVectorStoreSearchPlan { - if t == nil { - return nil - } - return t.VectorStoreSearchPlan -} - -func (t *TrieveKnowledgeBase) GetVectorStoreCreatePlan() *TrieveKnowledgeBaseVectorStoreCreatePlan { +func (t *TrieveKnowledgeBase) GetSearchPlan() *TrieveKnowledgeBaseSearchPlan { if t == nil { return nil } - return t.VectorStoreCreatePlan + return t.SearchPlan } -func (t *TrieveKnowledgeBase) GetVectorStoreProviderId() *string { +func (t *TrieveKnowledgeBase) GetCreatePlan() *TrieveKnowledgeBaseCreatePlan { if t == nil { return nil } - return t.VectorStoreProviderId + return t.CreatePlan } func (t *TrieveKnowledgeBase) GetId() string { @@ -388,9 +432,11 @@ func (t *TrieveKnowledgeBase) String() string { return fmt.Sprintf("%#v", t) } -type TrieveKnowledgeBaseVectorStoreCreatePlan struct { +type TrieveKnowledgeBaseChunkPlan struct { // These are the file ids that will be used to create the vector store. To upload files, use the `POST /files` endpoint. FileIds []string `json:"fileIds,omitempty" url:"fileIds,omitempty"` + // These are the websites that will be used to create the vector store. + Websites []string `json:"websites,omitempty" url:"websites,omitempty"` // This is an optional field which allows you to specify the number of splits you want per chunk. If not specified, the default 20 is used. However, you may want to use a different number. TargetSplitsPerChunk *float64 `json:"targetSplitsPerChunk,omitempty" url:"targetSplitsPerChunk,omitempty"` // This is an optional field which allows you to specify the delimiters to use when splitting the file before chunking the text. If not specified, the default [.!?\n] are used to split into sentences. However, you may want to use spaces or other delimiters. @@ -402,45 +448,52 @@ type TrieveKnowledgeBaseVectorStoreCreatePlan struct { rawJSON json.RawMessage } -func (t *TrieveKnowledgeBaseVectorStoreCreatePlan) GetFileIds() []string { +func (t *TrieveKnowledgeBaseChunkPlan) GetFileIds() []string { if t == nil { return nil } return t.FileIds } -func (t *TrieveKnowledgeBaseVectorStoreCreatePlan) GetTargetSplitsPerChunk() *float64 { +func (t *TrieveKnowledgeBaseChunkPlan) GetWebsites() []string { + if t == nil { + return nil + } + return t.Websites +} + +func (t *TrieveKnowledgeBaseChunkPlan) GetTargetSplitsPerChunk() *float64 { if t == nil { return nil } return t.TargetSplitsPerChunk } -func (t *TrieveKnowledgeBaseVectorStoreCreatePlan) GetSplitDelimiters() []string { +func (t *TrieveKnowledgeBaseChunkPlan) GetSplitDelimiters() []string { if t == nil { return nil } return t.SplitDelimiters } -func (t *TrieveKnowledgeBaseVectorStoreCreatePlan) GetRebalanceChunks() *bool { +func (t *TrieveKnowledgeBaseChunkPlan) GetRebalanceChunks() *bool { if t == nil { return nil } return t.RebalanceChunks } -func (t *TrieveKnowledgeBaseVectorStoreCreatePlan) GetExtraProperties() map[string]interface{} { +func (t *TrieveKnowledgeBaseChunkPlan) GetExtraProperties() map[string]interface{} { return t.extraProperties } -func (t *TrieveKnowledgeBaseVectorStoreCreatePlan) UnmarshalJSON(data []byte) error { - type unmarshaler TrieveKnowledgeBaseVectorStoreCreatePlan +func (t *TrieveKnowledgeBaseChunkPlan) UnmarshalJSON(data []byte) error { + type unmarshaler TrieveKnowledgeBaseChunkPlan var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *t = TrieveKnowledgeBaseVectorStoreCreatePlan(value) + *t = TrieveKnowledgeBaseChunkPlan(value) extraProperties, err := internal.ExtractExtraProperties(data, *t) if err != nil { return err @@ -450,7 +503,218 @@ func (t *TrieveKnowledgeBaseVectorStoreCreatePlan) UnmarshalJSON(data []byte) er return nil } -func (t *TrieveKnowledgeBaseVectorStoreCreatePlan) String() string { +func (t *TrieveKnowledgeBaseChunkPlan) String() string { + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(t); err == nil { + return value + } + return fmt.Sprintf("%#v", t) +} + +type TrieveKnowledgeBaseCreate struct { + // This is to create a new dataset on Trieve. + // These are the chunk plans used to create the dataset. + ChunkPlans []*TrieveKnowledgeBaseChunkPlan `json:"chunkPlans,omitempty" url:"chunkPlans,omitempty"` + type_ string + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (t *TrieveKnowledgeBaseCreate) GetChunkPlans() []*TrieveKnowledgeBaseChunkPlan { + if t == nil { + return nil + } + return t.ChunkPlans +} + +func (t *TrieveKnowledgeBaseCreate) Type() string { + return t.type_ +} + +func (t *TrieveKnowledgeBaseCreate) GetExtraProperties() map[string]interface{} { + return t.extraProperties +} + +func (t *TrieveKnowledgeBaseCreate) UnmarshalJSON(data []byte) error { + type embed TrieveKnowledgeBaseCreate + var unmarshaler = struct { + embed + Type string `json:"type"` + }{ + embed: embed(*t), + } + if err := json.Unmarshal(data, &unmarshaler); err != nil { + return err + } + *t = TrieveKnowledgeBaseCreate(unmarshaler.embed) + if unmarshaler.Type != "create" { + return fmt.Errorf("unexpected value for literal on type %T; expected %v got %v", t, "create", unmarshaler.Type) + } + t.type_ = unmarshaler.Type + extraProperties, err := internal.ExtractExtraProperties(data, *t, "type") + if err != nil { + return err + } + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t *TrieveKnowledgeBaseCreate) MarshalJSON() ([]byte, error) { + type embed TrieveKnowledgeBaseCreate + var marshaler = struct { + embed + Type string `json:"type"` + }{ + embed: embed(*t), + Type: "create", + } + return json.Marshal(marshaler) +} + +func (t *TrieveKnowledgeBaseCreate) String() string { + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(t); err == nil { + return value + } + return fmt.Sprintf("%#v", t) +} + +// This is the plan if you want us to create/import a new vector store using Trieve. +type TrieveKnowledgeBaseCreatePlan struct { + TrieveKnowledgeBaseCreate *TrieveKnowledgeBaseCreate + TrieveKnowledgeBaseImport *TrieveKnowledgeBaseImport + + typ string +} + +func (t *TrieveKnowledgeBaseCreatePlan) GetTrieveKnowledgeBaseCreate() *TrieveKnowledgeBaseCreate { + if t == nil { + return nil + } + return t.TrieveKnowledgeBaseCreate +} + +func (t *TrieveKnowledgeBaseCreatePlan) GetTrieveKnowledgeBaseImport() *TrieveKnowledgeBaseImport { + if t == nil { + return nil + } + return t.TrieveKnowledgeBaseImport +} + +func (t *TrieveKnowledgeBaseCreatePlan) UnmarshalJSON(data []byte) error { + valueTrieveKnowledgeBaseCreate := new(TrieveKnowledgeBaseCreate) + if err := json.Unmarshal(data, &valueTrieveKnowledgeBaseCreate); err == nil { + t.typ = "TrieveKnowledgeBaseCreate" + t.TrieveKnowledgeBaseCreate = valueTrieveKnowledgeBaseCreate + return nil + } + valueTrieveKnowledgeBaseImport := new(TrieveKnowledgeBaseImport) + if err := json.Unmarshal(data, &valueTrieveKnowledgeBaseImport); err == nil { + t.typ = "TrieveKnowledgeBaseImport" + t.TrieveKnowledgeBaseImport = valueTrieveKnowledgeBaseImport + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, t) +} + +func (t TrieveKnowledgeBaseCreatePlan) MarshalJSON() ([]byte, error) { + if t.typ == "TrieveKnowledgeBaseCreate" || t.TrieveKnowledgeBaseCreate != nil { + return json.Marshal(t.TrieveKnowledgeBaseCreate) + } + if t.typ == "TrieveKnowledgeBaseImport" || t.TrieveKnowledgeBaseImport != nil { + return json.Marshal(t.TrieveKnowledgeBaseImport) + } + return nil, fmt.Errorf("type %T does not include a non-empty union type", t) +} + +type TrieveKnowledgeBaseCreatePlanVisitor interface { + VisitTrieveKnowledgeBaseCreate(*TrieveKnowledgeBaseCreate) error + VisitTrieveKnowledgeBaseImport(*TrieveKnowledgeBaseImport) error +} + +func (t *TrieveKnowledgeBaseCreatePlan) Accept(visitor TrieveKnowledgeBaseCreatePlanVisitor) error { + if t.typ == "TrieveKnowledgeBaseCreate" || t.TrieveKnowledgeBaseCreate != nil { + return visitor.VisitTrieveKnowledgeBaseCreate(t.TrieveKnowledgeBaseCreate) + } + if t.typ == "TrieveKnowledgeBaseImport" || t.TrieveKnowledgeBaseImport != nil { + return visitor.VisitTrieveKnowledgeBaseImport(t.TrieveKnowledgeBaseImport) + } + return fmt.Errorf("type %T does not include a non-empty union type", t) +} + +type TrieveKnowledgeBaseImport struct { + // This is to import an existing dataset from Trieve. + // This is the `datasetId` of the dataset on your Trieve account. + ProviderId string `json:"providerId" url:"providerId"` + type_ string + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (t *TrieveKnowledgeBaseImport) GetProviderId() string { + if t == nil { + return "" + } + return t.ProviderId +} + +func (t *TrieveKnowledgeBaseImport) Type() string { + return t.type_ +} + +func (t *TrieveKnowledgeBaseImport) GetExtraProperties() map[string]interface{} { + return t.extraProperties +} + +func (t *TrieveKnowledgeBaseImport) UnmarshalJSON(data []byte) error { + type embed TrieveKnowledgeBaseImport + var unmarshaler = struct { + embed + Type string `json:"type"` + }{ + embed: embed(*t), + } + if err := json.Unmarshal(data, &unmarshaler); err != nil { + return err + } + *t = TrieveKnowledgeBaseImport(unmarshaler.embed) + if unmarshaler.Type != "import" { + return fmt.Errorf("unexpected value for literal on type %T; expected %v got %v", t, "import", unmarshaler.Type) + } + t.type_ = unmarshaler.Type + extraProperties, err := internal.ExtractExtraProperties(data, *t, "type") + if err != nil { + return err + } + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t *TrieveKnowledgeBaseImport) MarshalJSON() ([]byte, error) { + type embed TrieveKnowledgeBaseImport + var marshaler = struct { + embed + Type string `json:"type"` + }{ + embed: embed(*t), + Type: "import", + } + return json.Marshal(marshaler) +} + +func (t *TrieveKnowledgeBaseImport) String() string { if len(t.rawJSON) > 0 { if value, err := internal.StringifyJSON(t.rawJSON); err == nil { return value @@ -462,50 +726,50 @@ func (t *TrieveKnowledgeBaseVectorStoreCreatePlan) String() string { return fmt.Sprintf("%#v", t) } -type TrieveKnowledgeBaseVectorStoreSearchPlan struct { +type TrieveKnowledgeBaseSearchPlan struct { // If true, stop words (specified in server/src/stop-words.txt in the git repo) will be removed. This will preserve queries that are entirely stop words. RemoveStopWords *bool `json:"removeStopWords,omitempty" url:"removeStopWords,omitempty"` // This is the score threshold to filter out chunks with a score below the threshold for cosine distance metric. For Manhattan Distance, Euclidean Distance, and Dot Product, it will filter out scores above the threshold distance. This threshold applies before weight and bias modifications. If not specified, this defaults to no threshold. A threshold of 0 will default to no threshold. ScoreThreshold *float64 `json:"scoreThreshold,omitempty" url:"scoreThreshold,omitempty"` // This is the search method used when searching for relevant chunks from the vector store. - SearchType TrieveKnowledgeBaseVectorStoreSearchPlanSearchType `json:"searchType" url:"searchType"` + SearchType TrieveKnowledgeBaseSearchPlanSearchType `json:"searchType" url:"searchType"` extraProperties map[string]interface{} rawJSON json.RawMessage } -func (t *TrieveKnowledgeBaseVectorStoreSearchPlan) GetRemoveStopWords() *bool { +func (t *TrieveKnowledgeBaseSearchPlan) GetRemoveStopWords() *bool { if t == nil { return nil } return t.RemoveStopWords } -func (t *TrieveKnowledgeBaseVectorStoreSearchPlan) GetScoreThreshold() *float64 { +func (t *TrieveKnowledgeBaseSearchPlan) GetScoreThreshold() *float64 { if t == nil { return nil } return t.ScoreThreshold } -func (t *TrieveKnowledgeBaseVectorStoreSearchPlan) GetSearchType() TrieveKnowledgeBaseVectorStoreSearchPlanSearchType { +func (t *TrieveKnowledgeBaseSearchPlan) GetSearchType() TrieveKnowledgeBaseSearchPlanSearchType { if t == nil { return "" } return t.SearchType } -func (t *TrieveKnowledgeBaseVectorStoreSearchPlan) GetExtraProperties() map[string]interface{} { +func (t *TrieveKnowledgeBaseSearchPlan) GetExtraProperties() map[string]interface{} { return t.extraProperties } -func (t *TrieveKnowledgeBaseVectorStoreSearchPlan) UnmarshalJSON(data []byte) error { - type unmarshaler TrieveKnowledgeBaseVectorStoreSearchPlan +func (t *TrieveKnowledgeBaseSearchPlan) UnmarshalJSON(data []byte) error { + type unmarshaler TrieveKnowledgeBaseSearchPlan var value unmarshaler if err := json.Unmarshal(data, &value); err != nil { return err } - *t = TrieveKnowledgeBaseVectorStoreSearchPlan(value) + *t = TrieveKnowledgeBaseSearchPlan(value) extraProperties, err := internal.ExtractExtraProperties(data, *t) if err != nil { return err @@ -515,7 +779,7 @@ func (t *TrieveKnowledgeBaseVectorStoreSearchPlan) UnmarshalJSON(data []byte) er return nil } -func (t *TrieveKnowledgeBaseVectorStoreSearchPlan) String() string { +func (t *TrieveKnowledgeBaseSearchPlan) String() string { if len(t.rawJSON) > 0 { if value, err := internal.StringifyJSON(t.rawJSON); err == nil { return value @@ -528,36 +792,35 @@ func (t *TrieveKnowledgeBaseVectorStoreSearchPlan) String() string { } // This is the search method used when searching for relevant chunks from the vector store. -type TrieveKnowledgeBaseVectorStoreSearchPlanSearchType string +type TrieveKnowledgeBaseSearchPlanSearchType string const ( - TrieveKnowledgeBaseVectorStoreSearchPlanSearchTypeFulltext TrieveKnowledgeBaseVectorStoreSearchPlanSearchType = "fulltext" - TrieveKnowledgeBaseVectorStoreSearchPlanSearchTypeSemantic TrieveKnowledgeBaseVectorStoreSearchPlanSearchType = "semantic" - TrieveKnowledgeBaseVectorStoreSearchPlanSearchTypeHybrid TrieveKnowledgeBaseVectorStoreSearchPlanSearchType = "hybrid" - TrieveKnowledgeBaseVectorStoreSearchPlanSearchTypeBm25 TrieveKnowledgeBaseVectorStoreSearchPlanSearchType = "bm25" + TrieveKnowledgeBaseSearchPlanSearchTypeFulltext TrieveKnowledgeBaseSearchPlanSearchType = "fulltext" + TrieveKnowledgeBaseSearchPlanSearchTypeSemantic TrieveKnowledgeBaseSearchPlanSearchType = "semantic" + TrieveKnowledgeBaseSearchPlanSearchTypeHybrid TrieveKnowledgeBaseSearchPlanSearchType = "hybrid" + TrieveKnowledgeBaseSearchPlanSearchTypeBm25 TrieveKnowledgeBaseSearchPlanSearchType = "bm25" ) -func NewTrieveKnowledgeBaseVectorStoreSearchPlanSearchTypeFromString(s string) (TrieveKnowledgeBaseVectorStoreSearchPlanSearchType, error) { +func NewTrieveKnowledgeBaseSearchPlanSearchTypeFromString(s string) (TrieveKnowledgeBaseSearchPlanSearchType, error) { switch s { case "fulltext": - return TrieveKnowledgeBaseVectorStoreSearchPlanSearchTypeFulltext, nil + return TrieveKnowledgeBaseSearchPlanSearchTypeFulltext, nil case "semantic": - return TrieveKnowledgeBaseVectorStoreSearchPlanSearchTypeSemantic, nil + return TrieveKnowledgeBaseSearchPlanSearchTypeSemantic, nil case "hybrid": - return TrieveKnowledgeBaseVectorStoreSearchPlanSearchTypeHybrid, nil + return TrieveKnowledgeBaseSearchPlanSearchTypeHybrid, nil case "bm25": - return TrieveKnowledgeBaseVectorStoreSearchPlanSearchTypeBm25, nil + return TrieveKnowledgeBaseSearchPlanSearchTypeBm25, nil } - var t TrieveKnowledgeBaseVectorStoreSearchPlanSearchType + var t TrieveKnowledgeBaseSearchPlanSearchType return "", fmt.Errorf("%s is not a valid %T", s, t) } -func (t TrieveKnowledgeBaseVectorStoreSearchPlanSearchType) Ptr() *TrieveKnowledgeBaseVectorStoreSearchPlanSearchType { +func (t TrieveKnowledgeBaseSearchPlanSearchType) Ptr() *TrieveKnowledgeBaseSearchPlanSearchType { return &t } type UpdateCustomKnowledgeBaseDto struct { - // /** // This is where the knowledge base request will be sent. // // Request Example: @@ -647,16 +910,14 @@ func (u *UpdateCustomKnowledgeBaseDto) String() string { type UpdateTrieveKnowledgeBaseDto struct { // This is the name of the knowledge base. Name *string `json:"name,omitempty" url:"name,omitempty"` - // This is the plan on how to search the vector store while a call is going on. - VectorStoreSearchPlan *TrieveKnowledgeBaseVectorStoreSearchPlan `json:"vectorStoreSearchPlan,omitempty" url:"vectorStoreSearchPlan,omitempty"` - // This is the plan if you want us to create a new vector store on your behalf. To use an existing vector store from your account, use `vectoreStoreProviderId` - VectorStoreCreatePlan *TrieveKnowledgeBaseVectorStoreCreatePlan `json:"vectorStoreCreatePlan,omitempty" url:"vectorStoreCreatePlan,omitempty"` - // This is an vector store that you already have on your account with the provider. To create a new vector store, use vectorStoreCreatePlan. + // This is the searching plan used when searching for relevant chunks from the vector store. // - // Usage: - // - To bring your own vector store from Trieve, go to https://trieve.ai - // - Create a dataset, and use the datasetId here. - VectorStoreProviderId *string `json:"vectorStoreProviderId,omitempty" url:"vectorStoreProviderId,omitempty"` + // You should configure this if you're running into these issues: + // - Too much unnecessary context is being fed as knowledge base context. + // - Not enough relevant context is being fed as knowledge base context. + SearchPlan *TrieveKnowledgeBaseSearchPlan `json:"searchPlan,omitempty" url:"searchPlan,omitempty"` + // This is the plan if you want us to create/import a new vector store using Trieve. + CreatePlan *UpdateTrieveKnowledgeBaseDtoCreatePlan `json:"createPlan,omitempty" url:"createPlan,omitempty"` extraProperties map[string]interface{} rawJSON json.RawMessage @@ -669,25 +930,18 @@ func (u *UpdateTrieveKnowledgeBaseDto) GetName() *string { return u.Name } -func (u *UpdateTrieveKnowledgeBaseDto) GetVectorStoreSearchPlan() *TrieveKnowledgeBaseVectorStoreSearchPlan { +func (u *UpdateTrieveKnowledgeBaseDto) GetSearchPlan() *TrieveKnowledgeBaseSearchPlan { if u == nil { return nil } - return u.VectorStoreSearchPlan + return u.SearchPlan } -func (u *UpdateTrieveKnowledgeBaseDto) GetVectorStoreCreatePlan() *TrieveKnowledgeBaseVectorStoreCreatePlan { +func (u *UpdateTrieveKnowledgeBaseDto) GetCreatePlan() *UpdateTrieveKnowledgeBaseDtoCreatePlan { if u == nil { return nil } - return u.VectorStoreCreatePlan -} - -func (u *UpdateTrieveKnowledgeBaseDto) GetVectorStoreProviderId() *string { - if u == nil { - return nil - } - return u.VectorStoreProviderId + return u.CreatePlan } func (u *UpdateTrieveKnowledgeBaseDto) GetExtraProperties() map[string]interface{} { @@ -722,6 +976,69 @@ func (u *UpdateTrieveKnowledgeBaseDto) String() string { return fmt.Sprintf("%#v", u) } +// This is the plan if you want us to create/import a new vector store using Trieve. +type UpdateTrieveKnowledgeBaseDtoCreatePlan struct { + TrieveKnowledgeBaseCreate *TrieveKnowledgeBaseCreate + TrieveKnowledgeBaseImport *TrieveKnowledgeBaseImport + + typ string +} + +func (u *UpdateTrieveKnowledgeBaseDtoCreatePlan) GetTrieveKnowledgeBaseCreate() *TrieveKnowledgeBaseCreate { + if u == nil { + return nil + } + return u.TrieveKnowledgeBaseCreate +} + +func (u *UpdateTrieveKnowledgeBaseDtoCreatePlan) GetTrieveKnowledgeBaseImport() *TrieveKnowledgeBaseImport { + if u == nil { + return nil + } + return u.TrieveKnowledgeBaseImport +} + +func (u *UpdateTrieveKnowledgeBaseDtoCreatePlan) UnmarshalJSON(data []byte) error { + valueTrieveKnowledgeBaseCreate := new(TrieveKnowledgeBaseCreate) + if err := json.Unmarshal(data, &valueTrieveKnowledgeBaseCreate); err == nil { + u.typ = "TrieveKnowledgeBaseCreate" + u.TrieveKnowledgeBaseCreate = valueTrieveKnowledgeBaseCreate + return nil + } + valueTrieveKnowledgeBaseImport := new(TrieveKnowledgeBaseImport) + if err := json.Unmarshal(data, &valueTrieveKnowledgeBaseImport); err == nil { + u.typ = "TrieveKnowledgeBaseImport" + u.TrieveKnowledgeBaseImport = valueTrieveKnowledgeBaseImport + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, u) +} + +func (u UpdateTrieveKnowledgeBaseDtoCreatePlan) MarshalJSON() ([]byte, error) { + if u.typ == "TrieveKnowledgeBaseCreate" || u.TrieveKnowledgeBaseCreate != nil { + return json.Marshal(u.TrieveKnowledgeBaseCreate) + } + if u.typ == "TrieveKnowledgeBaseImport" || u.TrieveKnowledgeBaseImport != nil { + return json.Marshal(u.TrieveKnowledgeBaseImport) + } + return nil, fmt.Errorf("type %T does not include a non-empty union type", u) +} + +type UpdateTrieveKnowledgeBaseDtoCreatePlanVisitor interface { + VisitTrieveKnowledgeBaseCreate(*TrieveKnowledgeBaseCreate) error + VisitTrieveKnowledgeBaseImport(*TrieveKnowledgeBaseImport) error +} + +func (u *UpdateTrieveKnowledgeBaseDtoCreatePlan) Accept(visitor UpdateTrieveKnowledgeBaseDtoCreatePlanVisitor) error { + if u.typ == "TrieveKnowledgeBaseCreate" || u.TrieveKnowledgeBaseCreate != nil { + return visitor.VisitTrieveKnowledgeBaseCreate(u.TrieveKnowledgeBaseCreate) + } + if u.typ == "TrieveKnowledgeBaseImport" || u.TrieveKnowledgeBaseImport != nil { + return visitor.VisitTrieveKnowledgeBaseImport(u.TrieveKnowledgeBaseImport) + } + return fmt.Errorf("type %T does not include a non-empty union type", u) +} + type KnowledgeBasesCreateRequest struct { CreateTrieveKnowledgeBaseDto *CreateTrieveKnowledgeBaseDto CreateCustomKnowledgeBaseDto *CreateCustomKnowledgeBaseDto diff --git a/logs.go b/logs.go index a912fb9..e71ab07 100644 --- a/logs.go +++ b/logs.go @@ -10,10 +10,9 @@ import ( ) type LoggingControllerLogsDeleteQueryRequest struct { - // This is the unique identifier for the org that this log belongs to. - OrgId *string `json:"-" url:"orgId,omitempty"` - // This is the ID of the assistant. - AssistantId *string `json:"-" url:"assistantId,omitempty"` + // This is the type of the log. + Type *LoggingControllerLogsDeleteQueryRequestType `json:"-" url:"type,omitempty"` + AssistantId *string `json:"-" url:"assistantId,omitempty"` // This is the ID of the phone number. PhoneNumberId *string `json:"-" url:"phoneNumberId,omitempty"` // This is the ID of the customer. @@ -25,8 +24,6 @@ type LoggingControllerLogsDeleteQueryRequest struct { } type LogsGetRequest struct { - // This is the unique identifier for the org that this log belongs to. - OrgId *string `json:"-" url:"orgId,omitempty"` // This is the type of the log. Type *LogsGetRequestType `json:"-" url:"type,omitempty"` // This is the type of the webhook, given the log is from a webhook. @@ -123,23 +120,23 @@ type Log struct { // This is the specific resource, relevant only to API logs. Resource *LogResource `json:"resource,omitempty" url:"resource,omitempty"` // 'This is how long the request took. - RequestDurationSeconds float64 `json:"requestDurationSeconds" url:"requestDurationSeconds"` + RequestDurationSeconds *float64 `json:"requestDurationSeconds,omitempty" url:"requestDurationSeconds,omitempty"` // This is the timestamp at which the request began. - RequestStartedAt string `json:"requestStartedAt" url:"requestStartedAt"` + RequestStartedAt *string `json:"requestStartedAt,omitempty" url:"requestStartedAt,omitempty"` // This is the timestamp at which the request finished. - RequestFinishedAt string `json:"requestFinishedAt" url:"requestFinishedAt"` + RequestFinishedAt *string `json:"requestFinishedAt,omitempty" url:"requestFinishedAt,omitempty"` // This is the body of the request. RequestBody map[string]interface{} `json:"requestBody,omitempty" url:"requestBody,omitempty"` // This is the request method. - RequestHttpMethod LogRequestHttpMethod `json:"requestHttpMethod" url:"requestHttpMethod"` + RequestHttpMethod *LogRequestHttpMethod `json:"requestHttpMethod,omitempty" url:"requestHttpMethod,omitempty"` // This is the request URL. - RequestUrl string `json:"requestUrl" url:"requestUrl"` + RequestUrl *string `json:"requestUrl,omitempty" url:"requestUrl,omitempty"` // This is the request path. - RequestPath string `json:"requestPath" url:"requestPath"` + RequestPath *string `json:"requestPath,omitempty" url:"requestPath,omitempty"` // This is the request query. RequestQuery *string `json:"requestQuery,omitempty" url:"requestQuery,omitempty"` // This the HTTP status code of the response. - ResponseHttpCode float64 `json:"responseHttpCode" url:"responseHttpCode"` + ResponseHttpCode *float64 `json:"responseHttpCode,omitempty" url:"responseHttpCode,omitempty"` // This is the request IP address. RequestIpAddress *string `json:"requestIpAddress,omitempty" url:"requestIpAddress,omitempty"` // This is the origin of the request @@ -200,23 +197,23 @@ func (l *Log) GetResource() *LogResource { return l.Resource } -func (l *Log) GetRequestDurationSeconds() float64 { +func (l *Log) GetRequestDurationSeconds() *float64 { if l == nil { - return 0 + return nil } return l.RequestDurationSeconds } -func (l *Log) GetRequestStartedAt() string { +func (l *Log) GetRequestStartedAt() *string { if l == nil { - return "" + return nil } return l.RequestStartedAt } -func (l *Log) GetRequestFinishedAt() string { +func (l *Log) GetRequestFinishedAt() *string { if l == nil { - return "" + return nil } return l.RequestFinishedAt } @@ -228,23 +225,23 @@ func (l *Log) GetRequestBody() map[string]interface{} { return l.RequestBody } -func (l *Log) GetRequestHttpMethod() LogRequestHttpMethod { +func (l *Log) GetRequestHttpMethod() *LogRequestHttpMethod { if l == nil { - return "" + return nil } return l.RequestHttpMethod } -func (l *Log) GetRequestUrl() string { +func (l *Log) GetRequestUrl() *string { if l == nil { - return "" + return nil } return l.RequestUrl } -func (l *Log) GetRequestPath() string { +func (l *Log) GetRequestPath() *string { if l == nil { - return "" + return nil } return l.RequestPath } @@ -256,9 +253,9 @@ func (l *Log) GetRequestQuery() *string { return l.RequestQuery } -func (l *Log) GetResponseHttpCode() float64 { +func (l *Log) GetResponseHttpCode() *float64 { if l == nil { - return 0 + return nil } return l.ResponseHttpCode } @@ -607,6 +604,34 @@ func (p *PaginationMeta) String() string { return fmt.Sprintf("%#v", p) } +type LoggingControllerLogsDeleteQueryRequestType string + +const ( + LoggingControllerLogsDeleteQueryRequestTypeApi LoggingControllerLogsDeleteQueryRequestType = "API" + LoggingControllerLogsDeleteQueryRequestTypeWebhook LoggingControllerLogsDeleteQueryRequestType = "Webhook" + LoggingControllerLogsDeleteQueryRequestTypeCall LoggingControllerLogsDeleteQueryRequestType = "Call" + LoggingControllerLogsDeleteQueryRequestTypeProvider LoggingControllerLogsDeleteQueryRequestType = "Provider" +) + +func NewLoggingControllerLogsDeleteQueryRequestTypeFromString(s string) (LoggingControllerLogsDeleteQueryRequestType, error) { + switch s { + case "API": + return LoggingControllerLogsDeleteQueryRequestTypeApi, nil + case "Webhook": + return LoggingControllerLogsDeleteQueryRequestTypeWebhook, nil + case "Call": + return LoggingControllerLogsDeleteQueryRequestTypeCall, nil + case "Provider": + return LoggingControllerLogsDeleteQueryRequestTypeProvider, nil + } + var t LoggingControllerLogsDeleteQueryRequestType + return "", fmt.Errorf("%s is not a valid %T", s, t) +} + +func (l LoggingControllerLogsDeleteQueryRequestType) Ptr() *LoggingControllerLogsDeleteQueryRequestType { + return &l +} + type LogsGetRequestSortOrder string const ( diff --git a/types.go b/types.go index 5c8ea91..37c34c4 100644 --- a/types.go +++ b/types.go @@ -4424,12 +4424,14 @@ type AzureCredentialRegion string const ( AzureCredentialRegionAustralia AzureCredentialRegion = "australia" - AzureCredentialRegionCanada AzureCredentialRegion = "canada" + AzureCredentialRegionCanadaeast AzureCredentialRegion = "canadaeast" + AzureCredentialRegionCanadacentral AzureCredentialRegion = "canadacentral" AzureCredentialRegionEastus2 AzureCredentialRegion = "eastus2" AzureCredentialRegionEastus AzureCredentialRegion = "eastus" AzureCredentialRegionFrance AzureCredentialRegion = "france" AzureCredentialRegionIndia AzureCredentialRegion = "india" - AzureCredentialRegionJapan AzureCredentialRegion = "japan" + AzureCredentialRegionJapaneast AzureCredentialRegion = "japaneast" + AzureCredentialRegionJapanwest AzureCredentialRegion = "japanwest" AzureCredentialRegionUaenorth AzureCredentialRegion = "uaenorth" AzureCredentialRegionNorthcentralus AzureCredentialRegion = "northcentralus" AzureCredentialRegionNorway AzureCredentialRegion = "norway" @@ -4445,8 +4447,10 @@ func NewAzureCredentialRegionFromString(s string) (AzureCredentialRegion, error) switch s { case "australia": return AzureCredentialRegionAustralia, nil - case "canada": - return AzureCredentialRegionCanada, nil + case "canadaeast": + return AzureCredentialRegionCanadaeast, nil + case "canadacentral": + return AzureCredentialRegionCanadacentral, nil case "eastus2": return AzureCredentialRegionEastus2, nil case "eastus": @@ -4455,8 +4459,10 @@ func NewAzureCredentialRegionFromString(s string) (AzureCredentialRegion, error) return AzureCredentialRegionFrance, nil case "india": return AzureCredentialRegionIndia, nil - case "japan": - return AzureCredentialRegionJapan, nil + case "japaneast": + return AzureCredentialRegionJapaneast, nil + case "japanwest": + return AzureCredentialRegionJapanwest, nil case "uaenorth": return AzureCredentialRegionUaenorth, nil case "northcentralus": @@ -4713,12 +4719,14 @@ type AzureOpenAiCredentialRegion string const ( AzureOpenAiCredentialRegionAustralia AzureOpenAiCredentialRegion = "australia" - AzureOpenAiCredentialRegionCanada AzureOpenAiCredentialRegion = "canada" + AzureOpenAiCredentialRegionCanadaeast AzureOpenAiCredentialRegion = "canadaeast" + AzureOpenAiCredentialRegionCanadacentral AzureOpenAiCredentialRegion = "canadacentral" AzureOpenAiCredentialRegionEastus2 AzureOpenAiCredentialRegion = "eastus2" AzureOpenAiCredentialRegionEastus AzureOpenAiCredentialRegion = "eastus" AzureOpenAiCredentialRegionFrance AzureOpenAiCredentialRegion = "france" AzureOpenAiCredentialRegionIndia AzureOpenAiCredentialRegion = "india" - AzureOpenAiCredentialRegionJapan AzureOpenAiCredentialRegion = "japan" + AzureOpenAiCredentialRegionJapaneast AzureOpenAiCredentialRegion = "japaneast" + AzureOpenAiCredentialRegionJapanwest AzureOpenAiCredentialRegion = "japanwest" AzureOpenAiCredentialRegionUaenorth AzureOpenAiCredentialRegion = "uaenorth" AzureOpenAiCredentialRegionNorthcentralus AzureOpenAiCredentialRegion = "northcentralus" AzureOpenAiCredentialRegionNorway AzureOpenAiCredentialRegion = "norway" @@ -4734,8 +4742,10 @@ func NewAzureOpenAiCredentialRegionFromString(s string) (AzureOpenAiCredentialRe switch s { case "australia": return AzureOpenAiCredentialRegionAustralia, nil - case "canada": - return AzureOpenAiCredentialRegionCanada, nil + case "canadaeast": + return AzureOpenAiCredentialRegionCanadaeast, nil + case "canadacentral": + return AzureOpenAiCredentialRegionCanadacentral, nil case "eastus2": return AzureOpenAiCredentialRegionEastus2, nil case "eastus": @@ -4744,8 +4754,10 @@ func NewAzureOpenAiCredentialRegionFromString(s string) (AzureOpenAiCredentialRe return AzureOpenAiCredentialRegionFrance, nil case "india": return AzureOpenAiCredentialRegionIndia, nil - case "japan": - return AzureOpenAiCredentialRegionJapan, nil + case "japaneast": + return AzureOpenAiCredentialRegionJapaneast, nil + case "japanwest": + return AzureOpenAiCredentialRegionJapanwest, nil case "uaenorth": return AzureOpenAiCredentialRegionUaenorth, nil case "northcentralus": @@ -5482,6 +5494,261 @@ func (a AzureVoiceIdEnum) Ptr() *AzureVoiceIdEnum { return &a } +type BashToolWithToolCall struct { + // This determines if the tool is async. + // + // If async, the assistant will move forward without waiting for your server to respond. This is useful if you just want to trigger something on your server. + // + // If sync, the assistant will wait for your server to respond. This is useful if want assistant to respond with the result from your server. + // + // Defaults to synchronous (`false`). + Async *bool `json:"async,omitempty" url:"async,omitempty"` + // These are the messages that will be spoken to the user as the tool is running. + // + // For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured. + Messages []*BashToolWithToolCallMessagesItem `json:"messages,omitempty" url:"messages,omitempty"` + // The type of tool. "bash" for Bash tool. + // The sub type of tool. + ToolCall *ToolCall `json:"toolCall,omitempty" url:"toolCall,omitempty"` + // The name of the tool, fixed to 'bash' + // This is the function definition of the tool. + // + // For `endCall`, `transferCall`, and `dtmf` tools, this is auto-filled based on tool-specific fields like `tool.destinations`. But, even in those cases, you can provide a custom function definition for advanced use cases. + // + // An example of an advanced use case is if you want to customize the message that's spoken for `endCall` tool. You can specify a function where it returns an argument "reason". Then, in `messages` array, you can have many "request-complete" messages. One of these messages will be triggered if the `messages[].conditions` matches the "reason" argument. + Function *OpenAiFunction `json:"function,omitempty" url:"function,omitempty"` + // This is the server that will be hit when this tool is requested by the model. + // + // All requests will be sent with the call object among other things. You can find more details in the Server URL documentation. + // + // This overrides the serverUrl set on the org and the phoneNumber. Order of precedence: highest tool.server.url, then assistant.serverUrl, then phoneNumber.serverUrl, then org.serverUrl. + Server *Server `json:"server,omitempty" url:"server,omitempty"` + type_ string + subType string + name string + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (b *BashToolWithToolCall) GetAsync() *bool { + if b == nil { + return nil + } + return b.Async +} + +func (b *BashToolWithToolCall) GetMessages() []*BashToolWithToolCallMessagesItem { + if b == nil { + return nil + } + return b.Messages +} + +func (b *BashToolWithToolCall) GetToolCall() *ToolCall { + if b == nil { + return nil + } + return b.ToolCall +} + +func (b *BashToolWithToolCall) GetFunction() *OpenAiFunction { + if b == nil { + return nil + } + return b.Function +} + +func (b *BashToolWithToolCall) GetServer() *Server { + if b == nil { + return nil + } + return b.Server +} + +func (b *BashToolWithToolCall) Type() string { + return b.type_ +} + +func (b *BashToolWithToolCall) SubType() string { + return b.subType +} + +func (b *BashToolWithToolCall) Name() string { + return b.name +} + +func (b *BashToolWithToolCall) GetExtraProperties() map[string]interface{} { + return b.extraProperties +} + +func (b *BashToolWithToolCall) UnmarshalJSON(data []byte) error { + type embed BashToolWithToolCall + var unmarshaler = struct { + embed + Type string `json:"type"` + SubType string `json:"subType"` + Name string `json:"name"` + }{ + embed: embed(*b), + } + if err := json.Unmarshal(data, &unmarshaler); err != nil { + return err + } + *b = BashToolWithToolCall(unmarshaler.embed) + if unmarshaler.Type != "bash" { + return fmt.Errorf("unexpected value for literal on type %T; expected %v got %v", b, "bash", unmarshaler.Type) + } + b.type_ = unmarshaler.Type + if unmarshaler.SubType != "bash_20241022" { + return fmt.Errorf("unexpected value for literal on type %T; expected %v got %v", b, "bash_20241022", unmarshaler.SubType) + } + b.subType = unmarshaler.SubType + if unmarshaler.Name != "bash" { + return fmt.Errorf("unexpected value for literal on type %T; expected %v got %v", b, "bash", unmarshaler.Name) + } + b.name = unmarshaler.Name + extraProperties, err := internal.ExtractExtraProperties(data, *b, "type", "subType", "name") + if err != nil { + return err + } + b.extraProperties = extraProperties + b.rawJSON = json.RawMessage(data) + return nil +} + +func (b *BashToolWithToolCall) MarshalJSON() ([]byte, error) { + type embed BashToolWithToolCall + var marshaler = struct { + embed + Type string `json:"type"` + SubType string `json:"subType"` + Name string `json:"name"` + }{ + embed: embed(*b), + Type: "bash", + SubType: "bash_20241022", + Name: "bash", + } + return json.Marshal(marshaler) +} + +func (b *BashToolWithToolCall) String() string { + if len(b.rawJSON) > 0 { + if value, err := internal.StringifyJSON(b.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(b); err == nil { + return value + } + return fmt.Sprintf("%#v", b) +} + +type BashToolWithToolCallMessagesItem struct { + ToolMessageStart *ToolMessageStart + ToolMessageComplete *ToolMessageComplete + ToolMessageFailed *ToolMessageFailed + ToolMessageDelayed *ToolMessageDelayed + + typ string +} + +func (b *BashToolWithToolCallMessagesItem) GetToolMessageStart() *ToolMessageStart { + if b == nil { + return nil + } + return b.ToolMessageStart +} + +func (b *BashToolWithToolCallMessagesItem) GetToolMessageComplete() *ToolMessageComplete { + if b == nil { + return nil + } + return b.ToolMessageComplete +} + +func (b *BashToolWithToolCallMessagesItem) GetToolMessageFailed() *ToolMessageFailed { + if b == nil { + return nil + } + return b.ToolMessageFailed +} + +func (b *BashToolWithToolCallMessagesItem) GetToolMessageDelayed() *ToolMessageDelayed { + if b == nil { + return nil + } + return b.ToolMessageDelayed +} + +func (b *BashToolWithToolCallMessagesItem) UnmarshalJSON(data []byte) error { + valueToolMessageStart := new(ToolMessageStart) + if err := json.Unmarshal(data, &valueToolMessageStart); err == nil { + b.typ = "ToolMessageStart" + b.ToolMessageStart = valueToolMessageStart + return nil + } + valueToolMessageComplete := new(ToolMessageComplete) + if err := json.Unmarshal(data, &valueToolMessageComplete); err == nil { + b.typ = "ToolMessageComplete" + b.ToolMessageComplete = valueToolMessageComplete + return nil + } + valueToolMessageFailed := new(ToolMessageFailed) + if err := json.Unmarshal(data, &valueToolMessageFailed); err == nil { + b.typ = "ToolMessageFailed" + b.ToolMessageFailed = valueToolMessageFailed + return nil + } + valueToolMessageDelayed := new(ToolMessageDelayed) + if err := json.Unmarshal(data, &valueToolMessageDelayed); err == nil { + b.typ = "ToolMessageDelayed" + b.ToolMessageDelayed = valueToolMessageDelayed + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, b) +} + +func (b BashToolWithToolCallMessagesItem) MarshalJSON() ([]byte, error) { + if b.typ == "ToolMessageStart" || b.ToolMessageStart != nil { + return json.Marshal(b.ToolMessageStart) + } + if b.typ == "ToolMessageComplete" || b.ToolMessageComplete != nil { + return json.Marshal(b.ToolMessageComplete) + } + if b.typ == "ToolMessageFailed" || b.ToolMessageFailed != nil { + return json.Marshal(b.ToolMessageFailed) + } + if b.typ == "ToolMessageDelayed" || b.ToolMessageDelayed != nil { + return json.Marshal(b.ToolMessageDelayed) + } + return nil, fmt.Errorf("type %T does not include a non-empty union type", b) +} + +type BashToolWithToolCallMessagesItemVisitor interface { + VisitToolMessageStart(*ToolMessageStart) error + VisitToolMessageComplete(*ToolMessageComplete) error + VisitToolMessageFailed(*ToolMessageFailed) error + VisitToolMessageDelayed(*ToolMessageDelayed) error +} + +func (b *BashToolWithToolCallMessagesItem) Accept(visitor BashToolWithToolCallMessagesItemVisitor) error { + if b.typ == "ToolMessageStart" || b.ToolMessageStart != nil { + return visitor.VisitToolMessageStart(b.ToolMessageStart) + } + if b.typ == "ToolMessageComplete" || b.ToolMessageComplete != nil { + return visitor.VisitToolMessageComplete(b.ToolMessageComplete) + } + if b.typ == "ToolMessageFailed" || b.ToolMessageFailed != nil { + return visitor.VisitToolMessageFailed(b.ToolMessageFailed) + } + if b.typ == "ToolMessageDelayed" || b.ToolMessageDelayed != nil { + return visitor.VisitToolMessageDelayed(b.ToolMessageDelayed) + } + return fmt.Errorf("type %T does not include a non-empty union type", b) +} + type BlockCompleteMessage struct { // This is an alternative to the `content` property. It allows to specify variants of the same content, one per language. // @@ -7759,11 +8026,77 @@ func (c ClientInboundMessageControlControl) Ptr() *ClientInboundMessageControlCo return &c } +type ClientInboundMessageEndCall struct { + // This is the type of the message. Send "end-call" message to end the call. + type_ string + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (c *ClientInboundMessageEndCall) Type() string { + return c.type_ +} + +func (c *ClientInboundMessageEndCall) GetExtraProperties() map[string]interface{} { + return c.extraProperties +} + +func (c *ClientInboundMessageEndCall) UnmarshalJSON(data []byte) error { + type embed ClientInboundMessageEndCall + var unmarshaler = struct { + embed + Type string `json:"type"` + }{ + embed: embed(*c), + } + if err := json.Unmarshal(data, &unmarshaler); err != nil { + return err + } + *c = ClientInboundMessageEndCall(unmarshaler.embed) + if unmarshaler.Type != "end-call" { + return fmt.Errorf("unexpected value for literal on type %T; expected %v got %v", c, "end-call", unmarshaler.Type) + } + c.type_ = unmarshaler.Type + extraProperties, err := internal.ExtractExtraProperties(data, *c, "type") + if err != nil { + return err + } + c.extraProperties = extraProperties + c.rawJSON = json.RawMessage(data) + return nil +} + +func (c *ClientInboundMessageEndCall) MarshalJSON() ([]byte, error) { + type embed ClientInboundMessageEndCall + var marshaler = struct { + embed + Type string `json:"type"` + }{ + embed: embed(*c), + Type: "end-call", + } + return json.Marshal(marshaler) +} + +func (c *ClientInboundMessageEndCall) String() string { + if len(c.rawJSON) > 0 { + if value, err := internal.StringifyJSON(c.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(c); err == nil { + return value + } + return fmt.Sprintf("%#v", c) +} + // These are the messages that can be sent from client-side SDKs to control the call. type ClientInboundMessageMessage struct { ClientInboundMessageAddMessage *ClientInboundMessageAddMessage ClientInboundMessageControl *ClientInboundMessageControl ClientInboundMessageSay *ClientInboundMessageSay + ClientInboundMessageEndCall *ClientInboundMessageEndCall ClientInboundMessageTransfer *ClientInboundMessageTransfer typ string @@ -7790,6 +8123,13 @@ func (c *ClientInboundMessageMessage) GetClientInboundMessageSay() *ClientInboun return c.ClientInboundMessageSay } +func (c *ClientInboundMessageMessage) GetClientInboundMessageEndCall() *ClientInboundMessageEndCall { + if c == nil { + return nil + } + return c.ClientInboundMessageEndCall +} + func (c *ClientInboundMessageMessage) GetClientInboundMessageTransfer() *ClientInboundMessageTransfer { if c == nil { return nil @@ -7816,6 +8156,12 @@ func (c *ClientInboundMessageMessage) UnmarshalJSON(data []byte) error { c.ClientInboundMessageSay = valueClientInboundMessageSay return nil } + valueClientInboundMessageEndCall := new(ClientInboundMessageEndCall) + if err := json.Unmarshal(data, &valueClientInboundMessageEndCall); err == nil { + c.typ = "ClientInboundMessageEndCall" + c.ClientInboundMessageEndCall = valueClientInboundMessageEndCall + return nil + } valueClientInboundMessageTransfer := new(ClientInboundMessageTransfer) if err := json.Unmarshal(data, &valueClientInboundMessageTransfer); err == nil { c.typ = "ClientInboundMessageTransfer" @@ -7835,6 +8181,9 @@ func (c ClientInboundMessageMessage) MarshalJSON() ([]byte, error) { if c.typ == "ClientInboundMessageSay" || c.ClientInboundMessageSay != nil { return json.Marshal(c.ClientInboundMessageSay) } + if c.typ == "ClientInboundMessageEndCall" || c.ClientInboundMessageEndCall != nil { + return json.Marshal(c.ClientInboundMessageEndCall) + } if c.typ == "ClientInboundMessageTransfer" || c.ClientInboundMessageTransfer != nil { return json.Marshal(c.ClientInboundMessageTransfer) } @@ -7845,6 +8194,7 @@ type ClientInboundMessageMessageVisitor interface { VisitClientInboundMessageAddMessage(*ClientInboundMessageAddMessage) error VisitClientInboundMessageControl(*ClientInboundMessageControl) error VisitClientInboundMessageSay(*ClientInboundMessageSay) error + VisitClientInboundMessageEndCall(*ClientInboundMessageEndCall) error VisitClientInboundMessageTransfer(*ClientInboundMessageTransfer) error } @@ -7858,6 +8208,9 @@ func (c *ClientInboundMessageMessage) Accept(visitor ClientInboundMessageMessage if c.typ == "ClientInboundMessageSay" || c.ClientInboundMessageSay != nil { return visitor.VisitClientInboundMessageSay(c.ClientInboundMessageSay) } + if c.typ == "ClientInboundMessageEndCall" || c.ClientInboundMessageEndCall != nil { + return visitor.VisitClientInboundMessageEndCall(c.ClientInboundMessageEndCall) + } if c.typ == "ClientInboundMessageTransfer" || c.ClientInboundMessageTransfer != nil { return visitor.VisitClientInboundMessageTransfer(c.ClientInboundMessageTransfer) } @@ -9140,12 +9493,12 @@ func (c *ClientMessageToolCallsResult) String() string { } type ClientMessageToolCallsToolWithToolCallListItem struct { - FunctionToolWithToolCall *FunctionToolWithToolCall - GhlToolWithToolCall *GhlToolWithToolCall - MakeToolWithToolCall *MakeToolWithToolCall - Unknown interface{} - Unknown interface{} - Unknown interface{} + FunctionToolWithToolCall *FunctionToolWithToolCall + GhlToolWithToolCall *GhlToolWithToolCall + MakeToolWithToolCall *MakeToolWithToolCall + BashToolWithToolCall *BashToolWithToolCall + ComputerToolWithToolCall *ComputerToolWithToolCall + TextEditorToolWithToolCall *TextEditorToolWithToolCall typ string } @@ -9171,25 +9524,25 @@ func (c *ClientMessageToolCallsToolWithToolCallListItem) GetMakeToolWithToolCall return c.MakeToolWithToolCall } -func (c *ClientMessageToolCallsToolWithToolCallListItem) GetUnknown() interface{} { +func (c *ClientMessageToolCallsToolWithToolCallListItem) GetBashToolWithToolCall() *BashToolWithToolCall { if c == nil { return nil } - return c.Unknown + return c.BashToolWithToolCall } -func (c *ClientMessageToolCallsToolWithToolCallListItem) GetUnknown() interface{} { +func (c *ClientMessageToolCallsToolWithToolCallListItem) GetComputerToolWithToolCall() *ComputerToolWithToolCall { if c == nil { return nil } - return c.Unknown + return c.ComputerToolWithToolCall } -func (c *ClientMessageToolCallsToolWithToolCallListItem) GetUnknown() interface{} { +func (c *ClientMessageToolCallsToolWithToolCallListItem) GetTextEditorToolWithToolCall() *TextEditorToolWithToolCall { if c == nil { return nil } - return c.Unknown + return c.TextEditorToolWithToolCall } func (c *ClientMessageToolCallsToolWithToolCallListItem) UnmarshalJSON(data []byte) error { @@ -9211,22 +9564,22 @@ func (c *ClientMessageToolCallsToolWithToolCallListItem) UnmarshalJSON(data []by c.MakeToolWithToolCall = valueMakeToolWithToolCall return nil } - var valueUnknown interface{} - if err := json.Unmarshal(data, &valueUnknown); err == nil { - c.typ = "Unknown" - c.Unknown = valueUnknown + valueBashToolWithToolCall := new(BashToolWithToolCall) + if err := json.Unmarshal(data, &valueBashToolWithToolCall); err == nil { + c.typ = "BashToolWithToolCall" + c.BashToolWithToolCall = valueBashToolWithToolCall return nil } - var valueUnknown interface{} - if err := json.Unmarshal(data, &valueUnknown); err == nil { - c.typ = "Unknown" - c.Unknown = valueUnknown + valueComputerToolWithToolCall := new(ComputerToolWithToolCall) + if err := json.Unmarshal(data, &valueComputerToolWithToolCall); err == nil { + c.typ = "ComputerToolWithToolCall" + c.ComputerToolWithToolCall = valueComputerToolWithToolCall return nil } - var valueUnknown interface{} - if err := json.Unmarshal(data, &valueUnknown); err == nil { - c.typ = "Unknown" - c.Unknown = valueUnknown + valueTextEditorToolWithToolCall := new(TextEditorToolWithToolCall) + if err := json.Unmarshal(data, &valueTextEditorToolWithToolCall); err == nil { + c.typ = "TextEditorToolWithToolCall" + c.TextEditorToolWithToolCall = valueTextEditorToolWithToolCall return nil } return fmt.Errorf("%s cannot be deserialized as a %T", data, c) @@ -9242,14 +9595,14 @@ func (c ClientMessageToolCallsToolWithToolCallListItem) MarshalJSON() ([]byte, e if c.typ == "MakeToolWithToolCall" || c.MakeToolWithToolCall != nil { return json.Marshal(c.MakeToolWithToolCall) } - if c.typ == "Unknown" || c.Unknown != nil { - return json.Marshal(c.Unknown) + if c.typ == "BashToolWithToolCall" || c.BashToolWithToolCall != nil { + return json.Marshal(c.BashToolWithToolCall) } - if c.typ == "Unknown" || c.Unknown != nil { - return json.Marshal(c.Unknown) + if c.typ == "ComputerToolWithToolCall" || c.ComputerToolWithToolCall != nil { + return json.Marshal(c.ComputerToolWithToolCall) } - if c.typ == "Unknown" || c.Unknown != nil { - return json.Marshal(c.Unknown) + if c.typ == "TextEditorToolWithToolCall" || c.TextEditorToolWithToolCall != nil { + return json.Marshal(c.TextEditorToolWithToolCall) } return nil, fmt.Errorf("type %T does not include a non-empty union type", c) } @@ -9258,9 +9611,9 @@ type ClientMessageToolCallsToolWithToolCallListItemVisitor interface { VisitFunctionToolWithToolCall(*FunctionToolWithToolCall) error VisitGhlToolWithToolCall(*GhlToolWithToolCall) error VisitMakeToolWithToolCall(*MakeToolWithToolCall) error - VisitUnknown(interface{}) error - VisitUnknown(interface{}) error - VisitUnknown(interface{}) error + VisitBashToolWithToolCall(*BashToolWithToolCall) error + VisitComputerToolWithToolCall(*ComputerToolWithToolCall) error + VisitTextEditorToolWithToolCall(*TextEditorToolWithToolCall) error } func (c *ClientMessageToolCallsToolWithToolCallListItem) Accept(visitor ClientMessageToolCallsToolWithToolCallListItemVisitor) error { @@ -9273,14 +9626,14 @@ func (c *ClientMessageToolCallsToolWithToolCallListItem) Accept(visitor ClientMe if c.typ == "MakeToolWithToolCall" || c.MakeToolWithToolCall != nil { return visitor.VisitMakeToolWithToolCall(c.MakeToolWithToolCall) } - if c.typ == "Unknown" || c.Unknown != nil { - return visitor.VisitUnknown(c.Unknown) + if c.typ == "BashToolWithToolCall" || c.BashToolWithToolCall != nil { + return visitor.VisitBashToolWithToolCall(c.BashToolWithToolCall) } - if c.typ == "Unknown" || c.Unknown != nil { - return visitor.VisitUnknown(c.Unknown) + if c.typ == "ComputerToolWithToolCall" || c.ComputerToolWithToolCall != nil { + return visitor.VisitComputerToolWithToolCall(c.ComputerToolWithToolCall) } - if c.typ == "Unknown" || c.Unknown != nil { - return visitor.VisitUnknown(c.Unknown) + if c.typ == "TextEditorToolWithToolCall" || c.TextEditorToolWithToolCall != nil { + return visitor.VisitTextEditorToolWithToolCall(c.TextEditorToolWithToolCall) } return fmt.Errorf("type %T does not include a non-empty union type", c) } @@ -10094,6 +10447,288 @@ func (c *CloudflareR2BucketPlan) String() string { return fmt.Sprintf("%#v", c) } +type ComputerToolWithToolCall struct { + // This determines if the tool is async. + // + // If async, the assistant will move forward without waiting for your server to respond. This is useful if you just want to trigger something on your server. + // + // If sync, the assistant will wait for your server to respond. This is useful if want assistant to respond with the result from your server. + // + // Defaults to synchronous (`false`). + Async *bool `json:"async,omitempty" url:"async,omitempty"` + // These are the messages that will be spoken to the user as the tool is running. + // + // For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured. + Messages []*ComputerToolWithToolCallMessagesItem `json:"messages,omitempty" url:"messages,omitempty"` + // The type of tool. "computer" for Computer tool. + // The sub type of tool. + ToolCall *ToolCall `json:"toolCall,omitempty" url:"toolCall,omitempty"` + // The name of the tool, fixed to 'computer' + // The display width in pixels + DisplayWidthPx float64 `json:"displayWidthPx" url:"displayWidthPx"` + // The display height in pixels + DisplayHeightPx float64 `json:"displayHeightPx" url:"displayHeightPx"` + // Optional display number + DisplayNumber *float64 `json:"displayNumber,omitempty" url:"displayNumber,omitempty"` + // This is the function definition of the tool. + // + // For `endCall`, `transferCall`, and `dtmf` tools, this is auto-filled based on tool-specific fields like `tool.destinations`. But, even in those cases, you can provide a custom function definition for advanced use cases. + // + // An example of an advanced use case is if you want to customize the message that's spoken for `endCall` tool. You can specify a function where it returns an argument "reason". Then, in `messages` array, you can have many "request-complete" messages. One of these messages will be triggered if the `messages[].conditions` matches the "reason" argument. + Function *OpenAiFunction `json:"function,omitempty" url:"function,omitempty"` + // This is the server that will be hit when this tool is requested by the model. + // + // All requests will be sent with the call object among other things. You can find more details in the Server URL documentation. + // + // This overrides the serverUrl set on the org and the phoneNumber. Order of precedence: highest tool.server.url, then assistant.serverUrl, then phoneNumber.serverUrl, then org.serverUrl. + Server *Server `json:"server,omitempty" url:"server,omitempty"` + type_ string + subType string + name string + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (c *ComputerToolWithToolCall) GetAsync() *bool { + if c == nil { + return nil + } + return c.Async +} + +func (c *ComputerToolWithToolCall) GetMessages() []*ComputerToolWithToolCallMessagesItem { + if c == nil { + return nil + } + return c.Messages +} + +func (c *ComputerToolWithToolCall) GetToolCall() *ToolCall { + if c == nil { + return nil + } + return c.ToolCall +} + +func (c *ComputerToolWithToolCall) GetDisplayWidthPx() float64 { + if c == nil { + return 0 + } + return c.DisplayWidthPx +} + +func (c *ComputerToolWithToolCall) GetDisplayHeightPx() float64 { + if c == nil { + return 0 + } + return c.DisplayHeightPx +} + +func (c *ComputerToolWithToolCall) GetDisplayNumber() *float64 { + if c == nil { + return nil + } + return c.DisplayNumber +} + +func (c *ComputerToolWithToolCall) GetFunction() *OpenAiFunction { + if c == nil { + return nil + } + return c.Function +} + +func (c *ComputerToolWithToolCall) GetServer() *Server { + if c == nil { + return nil + } + return c.Server +} + +func (c *ComputerToolWithToolCall) Type() string { + return c.type_ +} + +func (c *ComputerToolWithToolCall) SubType() string { + return c.subType +} + +func (c *ComputerToolWithToolCall) Name() string { + return c.name +} + +func (c *ComputerToolWithToolCall) GetExtraProperties() map[string]interface{} { + return c.extraProperties +} + +func (c *ComputerToolWithToolCall) UnmarshalJSON(data []byte) error { + type embed ComputerToolWithToolCall + var unmarshaler = struct { + embed + Type string `json:"type"` + SubType string `json:"subType"` + Name string `json:"name"` + }{ + embed: embed(*c), + } + if err := json.Unmarshal(data, &unmarshaler); err != nil { + return err + } + *c = ComputerToolWithToolCall(unmarshaler.embed) + if unmarshaler.Type != "computer" { + return fmt.Errorf("unexpected value for literal on type %T; expected %v got %v", c, "computer", unmarshaler.Type) + } + c.type_ = unmarshaler.Type + if unmarshaler.SubType != "computer_20241022" { + return fmt.Errorf("unexpected value for literal on type %T; expected %v got %v", c, "computer_20241022", unmarshaler.SubType) + } + c.subType = unmarshaler.SubType + if unmarshaler.Name != "computer" { + return fmt.Errorf("unexpected value for literal on type %T; expected %v got %v", c, "computer", unmarshaler.Name) + } + c.name = unmarshaler.Name + extraProperties, err := internal.ExtractExtraProperties(data, *c, "type", "subType", "name") + if err != nil { + return err + } + c.extraProperties = extraProperties + c.rawJSON = json.RawMessage(data) + return nil +} + +func (c *ComputerToolWithToolCall) MarshalJSON() ([]byte, error) { + type embed ComputerToolWithToolCall + var marshaler = struct { + embed + Type string `json:"type"` + SubType string `json:"subType"` + Name string `json:"name"` + }{ + embed: embed(*c), + Type: "computer", + SubType: "computer_20241022", + Name: "computer", + } + return json.Marshal(marshaler) +} + +func (c *ComputerToolWithToolCall) String() string { + if len(c.rawJSON) > 0 { + if value, err := internal.StringifyJSON(c.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(c); err == nil { + return value + } + return fmt.Sprintf("%#v", c) +} + +type ComputerToolWithToolCallMessagesItem struct { + ToolMessageStart *ToolMessageStart + ToolMessageComplete *ToolMessageComplete + ToolMessageFailed *ToolMessageFailed + ToolMessageDelayed *ToolMessageDelayed + + typ string +} + +func (c *ComputerToolWithToolCallMessagesItem) GetToolMessageStart() *ToolMessageStart { + if c == nil { + return nil + } + return c.ToolMessageStart +} + +func (c *ComputerToolWithToolCallMessagesItem) GetToolMessageComplete() *ToolMessageComplete { + if c == nil { + return nil + } + return c.ToolMessageComplete +} + +func (c *ComputerToolWithToolCallMessagesItem) GetToolMessageFailed() *ToolMessageFailed { + if c == nil { + return nil + } + return c.ToolMessageFailed +} + +func (c *ComputerToolWithToolCallMessagesItem) GetToolMessageDelayed() *ToolMessageDelayed { + if c == nil { + return nil + } + return c.ToolMessageDelayed +} + +func (c *ComputerToolWithToolCallMessagesItem) UnmarshalJSON(data []byte) error { + valueToolMessageStart := new(ToolMessageStart) + if err := json.Unmarshal(data, &valueToolMessageStart); err == nil { + c.typ = "ToolMessageStart" + c.ToolMessageStart = valueToolMessageStart + return nil + } + valueToolMessageComplete := new(ToolMessageComplete) + if err := json.Unmarshal(data, &valueToolMessageComplete); err == nil { + c.typ = "ToolMessageComplete" + c.ToolMessageComplete = valueToolMessageComplete + return nil + } + valueToolMessageFailed := new(ToolMessageFailed) + if err := json.Unmarshal(data, &valueToolMessageFailed); err == nil { + c.typ = "ToolMessageFailed" + c.ToolMessageFailed = valueToolMessageFailed + return nil + } + valueToolMessageDelayed := new(ToolMessageDelayed) + if err := json.Unmarshal(data, &valueToolMessageDelayed); err == nil { + c.typ = "ToolMessageDelayed" + c.ToolMessageDelayed = valueToolMessageDelayed + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, c) +} + +func (c ComputerToolWithToolCallMessagesItem) MarshalJSON() ([]byte, error) { + if c.typ == "ToolMessageStart" || c.ToolMessageStart != nil { + return json.Marshal(c.ToolMessageStart) + } + if c.typ == "ToolMessageComplete" || c.ToolMessageComplete != nil { + return json.Marshal(c.ToolMessageComplete) + } + if c.typ == "ToolMessageFailed" || c.ToolMessageFailed != nil { + return json.Marshal(c.ToolMessageFailed) + } + if c.typ == "ToolMessageDelayed" || c.ToolMessageDelayed != nil { + return json.Marshal(c.ToolMessageDelayed) + } + return nil, fmt.Errorf("type %T does not include a non-empty union type", c) +} + +type ComputerToolWithToolCallMessagesItemVisitor interface { + VisitToolMessageStart(*ToolMessageStart) error + VisitToolMessageComplete(*ToolMessageComplete) error + VisitToolMessageFailed(*ToolMessageFailed) error + VisitToolMessageDelayed(*ToolMessageDelayed) error +} + +func (c *ComputerToolWithToolCallMessagesItem) Accept(visitor ComputerToolWithToolCallMessagesItemVisitor) error { + if c.typ == "ToolMessageStart" || c.ToolMessageStart != nil { + return visitor.VisitToolMessageStart(c.ToolMessageStart) + } + if c.typ == "ToolMessageComplete" || c.ToolMessageComplete != nil { + return visitor.VisitToolMessageComplete(c.ToolMessageComplete) + } + if c.typ == "ToolMessageFailed" || c.ToolMessageFailed != nil { + return visitor.VisitToolMessageFailed(c.ToolMessageFailed) + } + if c.typ == "ToolMessageDelayed" || c.ToolMessageDelayed != nil { + return visitor.VisitToolMessageDelayed(c.ToolMessageDelayed) + } + return fmt.Errorf("type %T does not include a non-empty union type", c) +} + type Condition struct { // This is the operator you want to use to compare the parameter and value. Operator ConditionOperator `json:"operator" url:"operator"` @@ -12560,12 +13195,14 @@ type CreateAzureCredentialDtoRegion string const ( CreateAzureCredentialDtoRegionAustralia CreateAzureCredentialDtoRegion = "australia" - CreateAzureCredentialDtoRegionCanada CreateAzureCredentialDtoRegion = "canada" + CreateAzureCredentialDtoRegionCanadaeast CreateAzureCredentialDtoRegion = "canadaeast" + CreateAzureCredentialDtoRegionCanadacentral CreateAzureCredentialDtoRegion = "canadacentral" CreateAzureCredentialDtoRegionEastus2 CreateAzureCredentialDtoRegion = "eastus2" CreateAzureCredentialDtoRegionEastus CreateAzureCredentialDtoRegion = "eastus" CreateAzureCredentialDtoRegionFrance CreateAzureCredentialDtoRegion = "france" CreateAzureCredentialDtoRegionIndia CreateAzureCredentialDtoRegion = "india" - CreateAzureCredentialDtoRegionJapan CreateAzureCredentialDtoRegion = "japan" + CreateAzureCredentialDtoRegionJapaneast CreateAzureCredentialDtoRegion = "japaneast" + CreateAzureCredentialDtoRegionJapanwest CreateAzureCredentialDtoRegion = "japanwest" CreateAzureCredentialDtoRegionUaenorth CreateAzureCredentialDtoRegion = "uaenorth" CreateAzureCredentialDtoRegionNorthcentralus CreateAzureCredentialDtoRegion = "northcentralus" CreateAzureCredentialDtoRegionNorway CreateAzureCredentialDtoRegion = "norway" @@ -12581,8 +13218,10 @@ func NewCreateAzureCredentialDtoRegionFromString(s string) (CreateAzureCredentia switch s { case "australia": return CreateAzureCredentialDtoRegionAustralia, nil - case "canada": - return CreateAzureCredentialDtoRegionCanada, nil + case "canadaeast": + return CreateAzureCredentialDtoRegionCanadaeast, nil + case "canadacentral": + return CreateAzureCredentialDtoRegionCanadacentral, nil case "eastus2": return CreateAzureCredentialDtoRegionEastus2, nil case "eastus": @@ -12591,8 +13230,10 @@ func NewCreateAzureCredentialDtoRegionFromString(s string) (CreateAzureCredentia return CreateAzureCredentialDtoRegionFrance, nil case "india": return CreateAzureCredentialDtoRegionIndia, nil - case "japan": - return CreateAzureCredentialDtoRegionJapan, nil + case "japaneast": + return CreateAzureCredentialDtoRegionJapaneast, nil + case "japanwest": + return CreateAzureCredentialDtoRegionJapanwest, nil case "uaenorth": return CreateAzureCredentialDtoRegionUaenorth, nil case "northcentralus": @@ -12805,12 +13446,14 @@ type CreateAzureOpenAiCredentialDtoRegion string const ( CreateAzureOpenAiCredentialDtoRegionAustralia CreateAzureOpenAiCredentialDtoRegion = "australia" - CreateAzureOpenAiCredentialDtoRegionCanada CreateAzureOpenAiCredentialDtoRegion = "canada" + CreateAzureOpenAiCredentialDtoRegionCanadaeast CreateAzureOpenAiCredentialDtoRegion = "canadaeast" + CreateAzureOpenAiCredentialDtoRegionCanadacentral CreateAzureOpenAiCredentialDtoRegion = "canadacentral" CreateAzureOpenAiCredentialDtoRegionEastus2 CreateAzureOpenAiCredentialDtoRegion = "eastus2" CreateAzureOpenAiCredentialDtoRegionEastus CreateAzureOpenAiCredentialDtoRegion = "eastus" CreateAzureOpenAiCredentialDtoRegionFrance CreateAzureOpenAiCredentialDtoRegion = "france" CreateAzureOpenAiCredentialDtoRegionIndia CreateAzureOpenAiCredentialDtoRegion = "india" - CreateAzureOpenAiCredentialDtoRegionJapan CreateAzureOpenAiCredentialDtoRegion = "japan" + CreateAzureOpenAiCredentialDtoRegionJapaneast CreateAzureOpenAiCredentialDtoRegion = "japaneast" + CreateAzureOpenAiCredentialDtoRegionJapanwest CreateAzureOpenAiCredentialDtoRegion = "japanwest" CreateAzureOpenAiCredentialDtoRegionUaenorth CreateAzureOpenAiCredentialDtoRegion = "uaenorth" CreateAzureOpenAiCredentialDtoRegionNorthcentralus CreateAzureOpenAiCredentialDtoRegion = "northcentralus" CreateAzureOpenAiCredentialDtoRegionNorway CreateAzureOpenAiCredentialDtoRegion = "norway" @@ -12826,8 +13469,10 @@ func NewCreateAzureOpenAiCredentialDtoRegionFromString(s string) (CreateAzureOpe switch s { case "australia": return CreateAzureOpenAiCredentialDtoRegionAustralia, nil - case "canada": - return CreateAzureOpenAiCredentialDtoRegionCanada, nil + case "canadaeast": + return CreateAzureOpenAiCredentialDtoRegionCanadaeast, nil + case "canadacentral": + return CreateAzureOpenAiCredentialDtoRegionCanadacentral, nil case "eastus2": return CreateAzureOpenAiCredentialDtoRegionEastus2, nil case "eastus": @@ -12836,8 +13481,10 @@ func NewCreateAzureOpenAiCredentialDtoRegionFromString(s string) (CreateAzureOpe return CreateAzureOpenAiCredentialDtoRegionFrance, nil case "india": return CreateAzureOpenAiCredentialDtoRegionIndia, nil - case "japan": - return CreateAzureOpenAiCredentialDtoRegionJapan, nil + case "japaneast": + return CreateAzureOpenAiCredentialDtoRegionJapaneast, nil + case "japanwest": + return CreateAzureOpenAiCredentialDtoRegionJapanwest, nil case "uaenorth": return CreateAzureOpenAiCredentialDtoRegionUaenorth, nil case "northcentralus": @@ -13450,7 +14097,6 @@ func (c *CreateConversationBlockDtoMessagesItem) Accept(visitor CreateConversati } type CreateCustomKnowledgeBaseDto struct { - // /** // This is where the knowledge base request will be sent. // // Request Example: @@ -19100,6 +19746,198 @@ func (c *CreateWorkflowBlockDtoStepsItem) Accept(visitor CreateWorkflowBlockDtoS return fmt.Errorf("type %T does not include a non-empty union type", c) } +type CreateWorkflowDto struct { + Nodes []*CreateWorkflowDtoNodesItem `json:"nodes,omitempty" url:"nodes,omitempty"` + Name string `json:"name" url:"name"` + Edges []*Edge `json:"edges,omitempty" url:"edges,omitempty"` + type_ string + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (c *CreateWorkflowDto) GetNodes() []*CreateWorkflowDtoNodesItem { + if c == nil { + return nil + } + return c.Nodes +} + +func (c *CreateWorkflowDto) GetName() string { + if c == nil { + return "" + } + return c.Name +} + +func (c *CreateWorkflowDto) GetEdges() []*Edge { + if c == nil { + return nil + } + return c.Edges +} + +func (c *CreateWorkflowDto) Type() string { + return c.type_ +} + +func (c *CreateWorkflowDto) GetExtraProperties() map[string]interface{} { + return c.extraProperties +} + +func (c *CreateWorkflowDto) UnmarshalJSON(data []byte) error { + type embed CreateWorkflowDto + var unmarshaler = struct { + embed + Type string `json:"type"` + }{ + embed: embed(*c), + } + if err := json.Unmarshal(data, &unmarshaler); err != nil { + return err + } + *c = CreateWorkflowDto(unmarshaler.embed) + if unmarshaler.Type != "workflow" { + return fmt.Errorf("unexpected value for literal on type %T; expected %v got %v", c, "workflow", unmarshaler.Type) + } + c.type_ = unmarshaler.Type + extraProperties, err := internal.ExtractExtraProperties(data, *c, "type") + if err != nil { + return err + } + c.extraProperties = extraProperties + c.rawJSON = json.RawMessage(data) + return nil +} + +func (c *CreateWorkflowDto) MarshalJSON() ([]byte, error) { + type embed CreateWorkflowDto + var marshaler = struct { + embed + Type string `json:"type"` + }{ + embed: embed(*c), + Type: "workflow", + } + return json.Marshal(marshaler) +} + +func (c *CreateWorkflowDto) String() string { + if len(c.rawJSON) > 0 { + if value, err := internal.StringifyJSON(c.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(c); err == nil { + return value + } + return fmt.Sprintf("%#v", c) +} + +type CreateWorkflowDtoNodesItem struct { + Say *Say + Gather *Gather + Unknown interface{} + CreateWorkflowDto *CreateWorkflowDto + + typ string +} + +func (c *CreateWorkflowDtoNodesItem) GetSay() *Say { + if c == nil { + return nil + } + return c.Say +} + +func (c *CreateWorkflowDtoNodesItem) GetGather() *Gather { + if c == nil { + return nil + } + return c.Gather +} + +func (c *CreateWorkflowDtoNodesItem) GetUnknown() interface{} { + if c == nil { + return nil + } + return c.Unknown +} + +func (c *CreateWorkflowDtoNodesItem) GetCreateWorkflowDto() *CreateWorkflowDto { + if c == nil { + return nil + } + return c.CreateWorkflowDto +} + +func (c *CreateWorkflowDtoNodesItem) UnmarshalJSON(data []byte) error { + valueSay := new(Say) + if err := json.Unmarshal(data, &valueSay); err == nil { + c.typ = "Say" + c.Say = valueSay + return nil + } + valueGather := new(Gather) + if err := json.Unmarshal(data, &valueGather); err == nil { + c.typ = "Gather" + c.Gather = valueGather + return nil + } + var valueUnknown interface{} + if err := json.Unmarshal(data, &valueUnknown); err == nil { + c.typ = "Unknown" + c.Unknown = valueUnknown + return nil + } + valueCreateWorkflowDto := new(CreateWorkflowDto) + if err := json.Unmarshal(data, &valueCreateWorkflowDto); err == nil { + c.typ = "CreateWorkflowDto" + c.CreateWorkflowDto = valueCreateWorkflowDto + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, c) +} + +func (c CreateWorkflowDtoNodesItem) MarshalJSON() ([]byte, error) { + if c.typ == "Say" || c.Say != nil { + return json.Marshal(c.Say) + } + if c.typ == "Gather" || c.Gather != nil { + return json.Marshal(c.Gather) + } + if c.typ == "Unknown" || c.Unknown != nil { + return json.Marshal(c.Unknown) + } + if c.typ == "CreateWorkflowDto" || c.CreateWorkflowDto != nil { + return json.Marshal(c.CreateWorkflowDto) + } + return nil, fmt.Errorf("type %T does not include a non-empty union type", c) +} + +type CreateWorkflowDtoNodesItemVisitor interface { + VisitSay(*Say) error + VisitGather(*Gather) error + VisitUnknown(interface{}) error + VisitCreateWorkflowDto(*CreateWorkflowDto) error +} + +func (c *CreateWorkflowDtoNodesItem) Accept(visitor CreateWorkflowDtoNodesItemVisitor) error { + if c.typ == "Say" || c.Say != nil { + return visitor.VisitSay(c.Say) + } + if c.typ == "Gather" || c.Gather != nil { + return visitor.VisitGather(c.Gather) + } + if c.typ == "Unknown" || c.Unknown != nil { + return visitor.VisitUnknown(c.Unknown) + } + if c.typ == "CreateWorkflowDto" || c.CreateWorkflowDto != nil { + return visitor.VisitCreateWorkflowDto(c.CreateWorkflowDto) + } + return fmt.Errorf("type %T does not include a non-empty union type", c) +} + type CreateXAiCredentialDto struct { // This is the api key for Grok in XAi's console. Get it from here: https://console.x.ai // This is not returned in the API. @@ -21858,6 +22696,130 @@ func (d DeepgramVoiceIdEnum) Ptr() *DeepgramVoiceIdEnum { return &d } +type Edge struct { + Condition *EdgeCondition `json:"condition,omitempty" url:"condition,omitempty"` + From string `json:"from" url:"from"` + To string `json:"to" url:"to"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (e *Edge) GetCondition() *EdgeCondition { + if e == nil { + return nil + } + return e.Condition +} + +func (e *Edge) GetFrom() string { + if e == nil { + return "" + } + return e.From +} + +func (e *Edge) GetTo() string { + if e == nil { + return "" + } + return e.To +} + +func (e *Edge) GetExtraProperties() map[string]interface{} { + return e.extraProperties +} + +func (e *Edge) UnmarshalJSON(data []byte) error { + type unmarshaler Edge + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *e = Edge(value) + extraProperties, err := internal.ExtractExtraProperties(data, *e) + if err != nil { + return err + } + e.extraProperties = extraProperties + e.rawJSON = json.RawMessage(data) + return nil +} + +func (e *Edge) String() string { + if len(e.rawJSON) > 0 { + if value, err := internal.StringifyJSON(e.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(e); err == nil { + return value + } + return fmt.Sprintf("%#v", e) +} + +type EdgeCondition struct { + SemanticEdgeCondition *SemanticEdgeCondition + ProgrammaticEdgeCondition *ProgrammaticEdgeCondition + + typ string +} + +func (e *EdgeCondition) GetSemanticEdgeCondition() *SemanticEdgeCondition { + if e == nil { + return nil + } + return e.SemanticEdgeCondition +} + +func (e *EdgeCondition) GetProgrammaticEdgeCondition() *ProgrammaticEdgeCondition { + if e == nil { + return nil + } + return e.ProgrammaticEdgeCondition +} + +func (e *EdgeCondition) UnmarshalJSON(data []byte) error { + valueSemanticEdgeCondition := new(SemanticEdgeCondition) + if err := json.Unmarshal(data, &valueSemanticEdgeCondition); err == nil { + e.typ = "SemanticEdgeCondition" + e.SemanticEdgeCondition = valueSemanticEdgeCondition + return nil + } + valueProgrammaticEdgeCondition := new(ProgrammaticEdgeCondition) + if err := json.Unmarshal(data, &valueProgrammaticEdgeCondition); err == nil { + e.typ = "ProgrammaticEdgeCondition" + e.ProgrammaticEdgeCondition = valueProgrammaticEdgeCondition + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, e) +} + +func (e EdgeCondition) MarshalJSON() ([]byte, error) { + if e.typ == "SemanticEdgeCondition" || e.SemanticEdgeCondition != nil { + return json.Marshal(e.SemanticEdgeCondition) + } + if e.typ == "ProgrammaticEdgeCondition" || e.ProgrammaticEdgeCondition != nil { + return json.Marshal(e.ProgrammaticEdgeCondition) + } + return nil, fmt.Errorf("type %T does not include a non-empty union type", e) +} + +type EdgeConditionVisitor interface { + VisitSemanticEdgeCondition(*SemanticEdgeCondition) error + VisitProgrammaticEdgeCondition(*ProgrammaticEdgeCondition) error +} + +func (e *EdgeCondition) Accept(visitor EdgeConditionVisitor) error { + if e.typ == "SemanticEdgeCondition" || e.SemanticEdgeCondition != nil { + return visitor.VisitSemanticEdgeCondition(e.SemanticEdgeCondition) + } + if e.typ == "ProgrammaticEdgeCondition" || e.ProgrammaticEdgeCondition != nil { + return visitor.VisitProgrammaticEdgeCondition(e.ProgrammaticEdgeCondition) + } + return fmt.Errorf("type %T does not include a non-empty union type", e) +} + type ElevenLabsCredential struct { // This is not returned in the API. ApiKey string `json:"apiKey" url:"apiKey"` @@ -25508,14 +26470,14 @@ func (f *FallbackTavusVoice) String() string { // This is the provider-specific ID that will be used. type FallbackTavusVoiceVoiceId struct { - r52da2535aStringLiteral string + R52da2535aStringLiteral string String string typ string } func NewFallbackTavusVoiceVoiceIdWithR52da2535aStringLiteral() *FallbackTavusVoiceVoiceId { - return &FallbackTavusVoiceVoiceId{typ: "r52da2535aStringLiteral", r52da2535aStringLiteral: "r52da2535a"} + return &FallbackTavusVoiceVoiceId{typ: "R52da2535aStringLiteral", R52da2535aStringLiteral: "r52da2535a"} } func (f *FallbackTavusVoiceVoiceId) GetString() string { @@ -25525,16 +26487,12 @@ func (f *FallbackTavusVoiceVoiceId) GetString() string { return f.String } -func (f *FallbackTavusVoiceVoiceId) R52da2535aStringLiteral() string { - return f.r52da2535aStringLiteral -} - func (f *FallbackTavusVoiceVoiceId) UnmarshalJSON(data []byte) error { var valueR52da2535aStringLiteral string if err := json.Unmarshal(data, &valueR52da2535aStringLiteral); err == nil { - f.typ = "r52da2535aStringLiteral" - f.r52da2535aStringLiteral = valueR52da2535aStringLiteral - if f.r52da2535aStringLiteral != "r52da2535a" { + f.typ = "R52da2535aStringLiteral" + f.R52da2535aStringLiteral = valueR52da2535aStringLiteral + if f.R52da2535aStringLiteral != "r52da2535a" { return fmt.Errorf("unexpected value for literal on type %T; expected %v got %v", f, "r52da2535a", valueR52da2535aStringLiteral) } return nil @@ -25549,7 +26507,7 @@ func (f *FallbackTavusVoiceVoiceId) UnmarshalJSON(data []byte) error { } func (f FallbackTavusVoiceVoiceId) MarshalJSON() ([]byte, error) { - if f.typ == "r52da2535aStringLiteral" || f.r52da2535aStringLiteral != "" { + if f.typ == "R52da2535aStringLiteral" || f.R52da2535aStringLiteral != "" { return json.Marshal("r52da2535a") } if f.typ == "String" || f.String != "" { @@ -25564,8 +26522,8 @@ type FallbackTavusVoiceVoiceIdVisitor interface { } func (f *FallbackTavusVoiceVoiceId) Accept(visitor FallbackTavusVoiceVoiceIdVisitor) error { - if f.typ == "r52da2535aStringLiteral" || f.r52da2535aStringLiteral != "" { - return visitor.VisitR52da2535aStringLiteral(f.r52da2535aStringLiteral) + if f.typ == "R52da2535aStringLiteral" || f.R52da2535aStringLiteral != "" { + return visitor.VisitR52da2535aStringLiteral(f.R52da2535aStringLiteral) } if f.typ == "String" || f.String != "" { return visitor.VisitString(f.String) @@ -26033,6 +26991,94 @@ func (f *FunctionToolWithToolCallMessagesItem) Accept(visitor FunctionToolWithTo return fmt.Errorf("type %T does not include a non-empty union type", f) } +type Gather struct { + Schema *JsonSchema `json:"schema,omitempty" url:"schema,omitempty"` + Instruction string `json:"instruction" url:"instruction"` + Name string `json:"name" url:"name"` + type_ string + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (g *Gather) GetSchema() *JsonSchema { + if g == nil { + return nil + } + return g.Schema +} + +func (g *Gather) GetInstruction() string { + if g == nil { + return "" + } + return g.Instruction +} + +func (g *Gather) GetName() string { + if g == nil { + return "" + } + return g.Name +} + +func (g *Gather) Type() string { + return g.type_ +} + +func (g *Gather) GetExtraProperties() map[string]interface{} { + return g.extraProperties +} + +func (g *Gather) UnmarshalJSON(data []byte) error { + type embed Gather + var unmarshaler = struct { + embed + Type string `json:"type"` + }{ + embed: embed(*g), + } + if err := json.Unmarshal(data, &unmarshaler); err != nil { + return err + } + *g = Gather(unmarshaler.embed) + if unmarshaler.Type != "gather" { + return fmt.Errorf("unexpected value for literal on type %T; expected %v got %v", g, "gather", unmarshaler.Type) + } + g.type_ = unmarshaler.Type + extraProperties, err := internal.ExtractExtraProperties(data, *g, "type") + if err != nil { + return err + } + g.extraProperties = extraProperties + g.rawJSON = json.RawMessage(data) + return nil +} + +func (g *Gather) MarshalJSON() ([]byte, error) { + type embed Gather + var marshaler = struct { + embed + Type string `json:"type"` + }{ + embed: embed(*g), + Type: "gather", + } + return json.Marshal(marshaler) +} + +func (g *Gather) String() string { + if len(g.rawJSON) > 0 { + if value, err := internal.StringifyJSON(g.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(g); err == nil { + return value + } + return fmt.Sprintf("%#v", g) +} + type GcpCredential struct { // This is the unique identifier for the credential. Id string `json:"id" url:"id"` @@ -29724,6 +30770,8 @@ type JsonSchema struct { // // This only makes sense if the type is "object". Required []string `json:"required,omitempty" url:"required,omitempty"` + // This array specifies the allowed values that can be used to restrict the output of the model. + Enum []string `json:"enum,omitempty" url:"enum,omitempty"` extraProperties map[string]interface{} rawJSON json.RawMessage @@ -29764,6 +30812,13 @@ func (j *JsonSchema) GetRequired() []string { return j.Required } +func (j *JsonSchema) GetEnum() []string { + if j == nil { + return nil + } + return j.Enum +} + func (j *JsonSchema) GetExtraProperties() map[string]interface{} { return j.extraProperties } @@ -34990,6 +36045,78 @@ func (p PlayHtVoiceModel) Ptr() *PlayHtVoiceModel { return &p } +type ProgrammaticEdgeCondition struct { + BooleanExpression *string `json:"booleanExpression,omitempty" url:"booleanExpression,omitempty"` + type_ string + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (p *ProgrammaticEdgeCondition) GetBooleanExpression() *string { + if p == nil { + return nil + } + return p.BooleanExpression +} + +func (p *ProgrammaticEdgeCondition) Type() string { + return p.type_ +} + +func (p *ProgrammaticEdgeCondition) GetExtraProperties() map[string]interface{} { + return p.extraProperties +} + +func (p *ProgrammaticEdgeCondition) UnmarshalJSON(data []byte) error { + type embed ProgrammaticEdgeCondition + var unmarshaler = struct { + embed + Type string `json:"type"` + }{ + embed: embed(*p), + } + if err := json.Unmarshal(data, &unmarshaler); err != nil { + return err + } + *p = ProgrammaticEdgeCondition(unmarshaler.embed) + if unmarshaler.Type != "programmatic" { + return fmt.Errorf("unexpected value for literal on type %T; expected %v got %v", p, "programmatic", unmarshaler.Type) + } + p.type_ = unmarshaler.Type + extraProperties, err := internal.ExtractExtraProperties(data, *p, "type") + if err != nil { + return err + } + p.extraProperties = extraProperties + p.rawJSON = json.RawMessage(data) + return nil +} + +func (p *ProgrammaticEdgeCondition) MarshalJSON() ([]byte, error) { + type embed ProgrammaticEdgeCondition + var marshaler = struct { + embed + Type string `json:"type"` + }{ + embed: embed(*p), + Type: "programmatic", + } + return json.Marshal(marshaler) +} + +func (p *ProgrammaticEdgeCondition) String() string { + if len(p.rawJSON) > 0 { + if value, err := internal.StringifyJSON(p.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(p); err == nil { + return value + } + return fmt.Sprintf("%#v", p) +} + type PunctuationBoundary string const ( @@ -36310,6 +37437,86 @@ func (s *S3Credential) String() string { return fmt.Sprintf("%#v", s) } +type Say struct { + Instruction string `json:"instruction" url:"instruction"` + Name string `json:"name" url:"name"` + type_ string + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *Say) GetInstruction() string { + if s == nil { + return "" + } + return s.Instruction +} + +func (s *Say) GetName() string { + if s == nil { + return "" + } + return s.Name +} + +func (s *Say) Type() string { + return s.type_ +} + +func (s *Say) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *Say) UnmarshalJSON(data []byte) error { + type embed Say + var unmarshaler = struct { + embed + Type string `json:"type"` + }{ + embed: embed(*s), + } + if err := json.Unmarshal(data, &unmarshaler); err != nil { + return err + } + *s = Say(unmarshaler.embed) + if unmarshaler.Type != "say" { + return fmt.Errorf("unexpected value for literal on type %T; expected %v got %v", s, "say", unmarshaler.Type) + } + s.type_ = unmarshaler.Type + extraProperties, err := internal.ExtractExtraProperties(data, *s, "type") + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *Say) MarshalJSON() ([]byte, error) { + type embed Say + var marshaler = struct { + embed + Type string `json:"type"` + }{ + embed: embed(*s), + Type: "say", + } + return json.Marshal(marshaler) +} + +func (s *Say) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + type SbcConfiguration struct { extraProperties map[string]interface{} rawJSON json.RawMessage @@ -36347,6 +37554,78 @@ func (s *SbcConfiguration) String() string { return fmt.Sprintf("%#v", s) } +type SemanticEdgeCondition struct { + Matches []string `json:"matches,omitempty" url:"matches,omitempty"` + type_ string + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (s *SemanticEdgeCondition) GetMatches() []string { + if s == nil { + return nil + } + return s.Matches +} + +func (s *SemanticEdgeCondition) Type() string { + return s.type_ +} + +func (s *SemanticEdgeCondition) GetExtraProperties() map[string]interface{} { + return s.extraProperties +} + +func (s *SemanticEdgeCondition) UnmarshalJSON(data []byte) error { + type embed SemanticEdgeCondition + var unmarshaler = struct { + embed + Type string `json:"type"` + }{ + embed: embed(*s), + } + if err := json.Unmarshal(data, &unmarshaler); err != nil { + return err + } + *s = SemanticEdgeCondition(unmarshaler.embed) + if unmarshaler.Type != "semantic" { + return fmt.Errorf("unexpected value for literal on type %T; expected %v got %v", s, "semantic", unmarshaler.Type) + } + s.type_ = unmarshaler.Type + extraProperties, err := internal.ExtractExtraProperties(data, *s, "type") + if err != nil { + return err + } + s.extraProperties = extraProperties + s.rawJSON = json.RawMessage(data) + return nil +} + +func (s *SemanticEdgeCondition) MarshalJSON() ([]byte, error) { + type embed SemanticEdgeCondition + var marshaler = struct { + embed + Type string `json:"type"` + }{ + embed: embed(*s), + Type: "semantic", + } + return json.Marshal(marshaler) +} + +func (s *SemanticEdgeCondition) String() string { + if len(s.rawJSON) > 0 { + if value, err := internal.StringifyJSON(s.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(s); err == nil { + return value + } + return fmt.Sprintf("%#v", s) +} + type Server struct { // This is the timeout in seconds for the request to your server. Defaults to 20 seconds. // @@ -42562,12 +43841,12 @@ func (s *ServerMessageToolCallsPhoneNumber) Accept(visitor ServerMessageToolCall } type ServerMessageToolCallsToolWithToolCallListItem struct { - FunctionToolWithToolCall *FunctionToolWithToolCall - GhlToolWithToolCall *GhlToolWithToolCall - MakeToolWithToolCall *MakeToolWithToolCall - Unknown interface{} - Unknown interface{} - Unknown interface{} + FunctionToolWithToolCall *FunctionToolWithToolCall + GhlToolWithToolCall *GhlToolWithToolCall + MakeToolWithToolCall *MakeToolWithToolCall + BashToolWithToolCall *BashToolWithToolCall + ComputerToolWithToolCall *ComputerToolWithToolCall + TextEditorToolWithToolCall *TextEditorToolWithToolCall typ string } @@ -42593,25 +43872,25 @@ func (s *ServerMessageToolCallsToolWithToolCallListItem) GetMakeToolWithToolCall return s.MakeToolWithToolCall } -func (s *ServerMessageToolCallsToolWithToolCallListItem) GetUnknown() interface{} { +func (s *ServerMessageToolCallsToolWithToolCallListItem) GetBashToolWithToolCall() *BashToolWithToolCall { if s == nil { return nil } - return s.Unknown + return s.BashToolWithToolCall } -func (s *ServerMessageToolCallsToolWithToolCallListItem) GetUnknown() interface{} { +func (s *ServerMessageToolCallsToolWithToolCallListItem) GetComputerToolWithToolCall() *ComputerToolWithToolCall { if s == nil { return nil } - return s.Unknown + return s.ComputerToolWithToolCall } -func (s *ServerMessageToolCallsToolWithToolCallListItem) GetUnknown() interface{} { +func (s *ServerMessageToolCallsToolWithToolCallListItem) GetTextEditorToolWithToolCall() *TextEditorToolWithToolCall { if s == nil { return nil } - return s.Unknown + return s.TextEditorToolWithToolCall } func (s *ServerMessageToolCallsToolWithToolCallListItem) UnmarshalJSON(data []byte) error { @@ -42633,22 +43912,22 @@ func (s *ServerMessageToolCallsToolWithToolCallListItem) UnmarshalJSON(data []by s.MakeToolWithToolCall = valueMakeToolWithToolCall return nil } - var valueUnknown interface{} - if err := json.Unmarshal(data, &valueUnknown); err == nil { - s.typ = "Unknown" - s.Unknown = valueUnknown + valueBashToolWithToolCall := new(BashToolWithToolCall) + if err := json.Unmarshal(data, &valueBashToolWithToolCall); err == nil { + s.typ = "BashToolWithToolCall" + s.BashToolWithToolCall = valueBashToolWithToolCall return nil } - var valueUnknown interface{} - if err := json.Unmarshal(data, &valueUnknown); err == nil { - s.typ = "Unknown" - s.Unknown = valueUnknown + valueComputerToolWithToolCall := new(ComputerToolWithToolCall) + if err := json.Unmarshal(data, &valueComputerToolWithToolCall); err == nil { + s.typ = "ComputerToolWithToolCall" + s.ComputerToolWithToolCall = valueComputerToolWithToolCall return nil } - var valueUnknown interface{} - if err := json.Unmarshal(data, &valueUnknown); err == nil { - s.typ = "Unknown" - s.Unknown = valueUnknown + valueTextEditorToolWithToolCall := new(TextEditorToolWithToolCall) + if err := json.Unmarshal(data, &valueTextEditorToolWithToolCall); err == nil { + s.typ = "TextEditorToolWithToolCall" + s.TextEditorToolWithToolCall = valueTextEditorToolWithToolCall return nil } return fmt.Errorf("%s cannot be deserialized as a %T", data, s) @@ -42664,14 +43943,14 @@ func (s ServerMessageToolCallsToolWithToolCallListItem) MarshalJSON() ([]byte, e if s.typ == "MakeToolWithToolCall" || s.MakeToolWithToolCall != nil { return json.Marshal(s.MakeToolWithToolCall) } - if s.typ == "Unknown" || s.Unknown != nil { - return json.Marshal(s.Unknown) + if s.typ == "BashToolWithToolCall" || s.BashToolWithToolCall != nil { + return json.Marshal(s.BashToolWithToolCall) } - if s.typ == "Unknown" || s.Unknown != nil { - return json.Marshal(s.Unknown) + if s.typ == "ComputerToolWithToolCall" || s.ComputerToolWithToolCall != nil { + return json.Marshal(s.ComputerToolWithToolCall) } - if s.typ == "Unknown" || s.Unknown != nil { - return json.Marshal(s.Unknown) + if s.typ == "TextEditorToolWithToolCall" || s.TextEditorToolWithToolCall != nil { + return json.Marshal(s.TextEditorToolWithToolCall) } return nil, fmt.Errorf("type %T does not include a non-empty union type", s) } @@ -42680,9 +43959,9 @@ type ServerMessageToolCallsToolWithToolCallListItemVisitor interface { VisitFunctionToolWithToolCall(*FunctionToolWithToolCall) error VisitGhlToolWithToolCall(*GhlToolWithToolCall) error VisitMakeToolWithToolCall(*MakeToolWithToolCall) error - VisitUnknown(interface{}) error - VisitUnknown(interface{}) error - VisitUnknown(interface{}) error + VisitBashToolWithToolCall(*BashToolWithToolCall) error + VisitComputerToolWithToolCall(*ComputerToolWithToolCall) error + VisitTextEditorToolWithToolCall(*TextEditorToolWithToolCall) error } func (s *ServerMessageToolCallsToolWithToolCallListItem) Accept(visitor ServerMessageToolCallsToolWithToolCallListItemVisitor) error { @@ -42695,14 +43974,14 @@ func (s *ServerMessageToolCallsToolWithToolCallListItem) Accept(visitor ServerMe if s.typ == "MakeToolWithToolCall" || s.MakeToolWithToolCall != nil { return visitor.VisitMakeToolWithToolCall(s.MakeToolWithToolCall) } - if s.typ == "Unknown" || s.Unknown != nil { - return visitor.VisitUnknown(s.Unknown) + if s.typ == "BashToolWithToolCall" || s.BashToolWithToolCall != nil { + return visitor.VisitBashToolWithToolCall(s.BashToolWithToolCall) } - if s.typ == "Unknown" || s.Unknown != nil { - return visitor.VisitUnknown(s.Unknown) + if s.typ == "ComputerToolWithToolCall" || s.ComputerToolWithToolCall != nil { + return visitor.VisitComputerToolWithToolCall(s.ComputerToolWithToolCall) } - if s.typ == "Unknown" || s.Unknown != nil { - return visitor.VisitUnknown(s.Unknown) + if s.typ == "TextEditorToolWithToolCall" || s.TextEditorToolWithToolCall != nil { + return visitor.VisitTextEditorToolWithToolCall(s.TextEditorToolWithToolCall) } return fmt.Errorf("type %T does not include a non-empty union type", s) } @@ -45756,8 +47035,8 @@ type Subscription struct { // // Note: This is a string to avoid floating point precision issues. Credits string `json:"credits" url:"credits"` - // This is the total concurrency limit for the subscription. - ConcurrencyLimit float64 `json:"concurrencyLimit" url:"concurrencyLimit"` + // This is the total number of active calls (concurrency) across all orgs under this subscription. + ConcurrencyCounter float64 `json:"concurrencyCounter" url:"concurrencyCounter"` // This is the default concurrency limit for the subscription. ConcurrencyLimitIncluded float64 `json:"concurrencyLimitIncluded" url:"concurrencyLimitIncluded"` // This is the purchased add-on concurrency limit for the subscription. @@ -45854,11 +47133,11 @@ func (s *Subscription) GetCredits() string { return s.Credits } -func (s *Subscription) GetConcurrencyLimit() float64 { +func (s *Subscription) GetConcurrencyCounter() float64 { if s == nil { return 0 } - return s.ConcurrencyLimit + return s.ConcurrencyCounter } func (s *Subscription) GetConcurrencyLimitIncluded() float64 { @@ -47298,14 +48577,14 @@ func (t *TavusVoice) String() string { // This is the provider-specific ID that will be used. type TavusVoiceVoiceId struct { - r52da2535aStringLiteral string + R52da2535aStringLiteral string String string typ string } func NewTavusVoiceVoiceIdWithR52da2535aStringLiteral() *TavusVoiceVoiceId { - return &TavusVoiceVoiceId{typ: "r52da2535aStringLiteral", r52da2535aStringLiteral: "r52da2535a"} + return &TavusVoiceVoiceId{typ: "R52da2535aStringLiteral", R52da2535aStringLiteral: "r52da2535a"} } func (t *TavusVoiceVoiceId) GetString() string { @@ -47315,16 +48594,12 @@ func (t *TavusVoiceVoiceId) GetString() string { return t.String } -func (t *TavusVoiceVoiceId) R52da2535aStringLiteral() string { - return t.r52da2535aStringLiteral -} - func (t *TavusVoiceVoiceId) UnmarshalJSON(data []byte) error { var valueR52da2535aStringLiteral string if err := json.Unmarshal(data, &valueR52da2535aStringLiteral); err == nil { - t.typ = "r52da2535aStringLiteral" - t.r52da2535aStringLiteral = valueR52da2535aStringLiteral - if t.r52da2535aStringLiteral != "r52da2535a" { + t.typ = "R52da2535aStringLiteral" + t.R52da2535aStringLiteral = valueR52da2535aStringLiteral + if t.R52da2535aStringLiteral != "r52da2535a" { return fmt.Errorf("unexpected value for literal on type %T; expected %v got %v", t, "r52da2535a", valueR52da2535aStringLiteral) } return nil @@ -47339,7 +48614,7 @@ func (t *TavusVoiceVoiceId) UnmarshalJSON(data []byte) error { } func (t TavusVoiceVoiceId) MarshalJSON() ([]byte, error) { - if t.typ == "r52da2535aStringLiteral" || t.r52da2535aStringLiteral != "" { + if t.typ == "R52da2535aStringLiteral" || t.R52da2535aStringLiteral != "" { return json.Marshal("r52da2535a") } if t.typ == "String" || t.String != "" { @@ -47354,8 +48629,8 @@ type TavusVoiceVoiceIdVisitor interface { } func (t *TavusVoiceVoiceId) Accept(visitor TavusVoiceVoiceIdVisitor) error { - if t.typ == "r52da2535aStringLiteral" || t.r52da2535aStringLiteral != "" { - return visitor.VisitR52da2535aStringLiteral(t.r52da2535aStringLiteral) + if t.typ == "R52da2535aStringLiteral" || t.R52da2535aStringLiteral != "" { + return visitor.VisitR52da2535aStringLiteral(t.R52da2535aStringLiteral) } if t.typ == "String" || t.String != "" { return visitor.VisitString(t.String) @@ -48468,6 +49743,261 @@ func (t TextContentLanguage) Ptr() *TextContentLanguage { return &t } +type TextEditorToolWithToolCall struct { + // This determines if the tool is async. + // + // If async, the assistant will move forward without waiting for your server to respond. This is useful if you just want to trigger something on your server. + // + // If sync, the assistant will wait for your server to respond. This is useful if want assistant to respond with the result from your server. + // + // Defaults to synchronous (`false`). + Async *bool `json:"async,omitempty" url:"async,omitempty"` + // These are the messages that will be spoken to the user as the tool is running. + // + // For some tools, this is auto-filled based on special fields like `tool.destinations`. For others like the function tool, these can be custom configured. + Messages []*TextEditorToolWithToolCallMessagesItem `json:"messages,omitempty" url:"messages,omitempty"` + // The type of tool. "textEditor" for Text Editor tool. + // The sub type of tool. + ToolCall *ToolCall `json:"toolCall,omitempty" url:"toolCall,omitempty"` + // The name of the tool, fixed to 'str_replace_editor' + // This is the function definition of the tool. + // + // For `endCall`, `transferCall`, and `dtmf` tools, this is auto-filled based on tool-specific fields like `tool.destinations`. But, even in those cases, you can provide a custom function definition for advanced use cases. + // + // An example of an advanced use case is if you want to customize the message that's spoken for `endCall` tool. You can specify a function where it returns an argument "reason". Then, in `messages` array, you can have many "request-complete" messages. One of these messages will be triggered if the `messages[].conditions` matches the "reason" argument. + Function *OpenAiFunction `json:"function,omitempty" url:"function,omitempty"` + // This is the server that will be hit when this tool is requested by the model. + // + // All requests will be sent with the call object among other things. You can find more details in the Server URL documentation. + // + // This overrides the serverUrl set on the org and the phoneNumber. Order of precedence: highest tool.server.url, then assistant.serverUrl, then phoneNumber.serverUrl, then org.serverUrl. + Server *Server `json:"server,omitempty" url:"server,omitempty"` + type_ string + subType string + name string + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (t *TextEditorToolWithToolCall) GetAsync() *bool { + if t == nil { + return nil + } + return t.Async +} + +func (t *TextEditorToolWithToolCall) GetMessages() []*TextEditorToolWithToolCallMessagesItem { + if t == nil { + return nil + } + return t.Messages +} + +func (t *TextEditorToolWithToolCall) GetToolCall() *ToolCall { + if t == nil { + return nil + } + return t.ToolCall +} + +func (t *TextEditorToolWithToolCall) GetFunction() *OpenAiFunction { + if t == nil { + return nil + } + return t.Function +} + +func (t *TextEditorToolWithToolCall) GetServer() *Server { + if t == nil { + return nil + } + return t.Server +} + +func (t *TextEditorToolWithToolCall) Type() string { + return t.type_ +} + +func (t *TextEditorToolWithToolCall) SubType() string { + return t.subType +} + +func (t *TextEditorToolWithToolCall) Name() string { + return t.name +} + +func (t *TextEditorToolWithToolCall) GetExtraProperties() map[string]interface{} { + return t.extraProperties +} + +func (t *TextEditorToolWithToolCall) UnmarshalJSON(data []byte) error { + type embed TextEditorToolWithToolCall + var unmarshaler = struct { + embed + Type string `json:"type"` + SubType string `json:"subType"` + Name string `json:"name"` + }{ + embed: embed(*t), + } + if err := json.Unmarshal(data, &unmarshaler); err != nil { + return err + } + *t = TextEditorToolWithToolCall(unmarshaler.embed) + if unmarshaler.Type != "textEditor" { + return fmt.Errorf("unexpected value for literal on type %T; expected %v got %v", t, "textEditor", unmarshaler.Type) + } + t.type_ = unmarshaler.Type + if unmarshaler.SubType != "text_editor_20241022" { + return fmt.Errorf("unexpected value for literal on type %T; expected %v got %v", t, "text_editor_20241022", unmarshaler.SubType) + } + t.subType = unmarshaler.SubType + if unmarshaler.Name != "str_replace_editor" { + return fmt.Errorf("unexpected value for literal on type %T; expected %v got %v", t, "str_replace_editor", unmarshaler.Name) + } + t.name = unmarshaler.Name + extraProperties, err := internal.ExtractExtraProperties(data, *t, "type", "subType", "name") + if err != nil { + return err + } + t.extraProperties = extraProperties + t.rawJSON = json.RawMessage(data) + return nil +} + +func (t *TextEditorToolWithToolCall) MarshalJSON() ([]byte, error) { + type embed TextEditorToolWithToolCall + var marshaler = struct { + embed + Type string `json:"type"` + SubType string `json:"subType"` + Name string `json:"name"` + }{ + embed: embed(*t), + Type: "textEditor", + SubType: "text_editor_20241022", + Name: "str_replace_editor", + } + return json.Marshal(marshaler) +} + +func (t *TextEditorToolWithToolCall) String() string { + if len(t.rawJSON) > 0 { + if value, err := internal.StringifyJSON(t.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(t); err == nil { + return value + } + return fmt.Sprintf("%#v", t) +} + +type TextEditorToolWithToolCallMessagesItem struct { + ToolMessageStart *ToolMessageStart + ToolMessageComplete *ToolMessageComplete + ToolMessageFailed *ToolMessageFailed + ToolMessageDelayed *ToolMessageDelayed + + typ string +} + +func (t *TextEditorToolWithToolCallMessagesItem) GetToolMessageStart() *ToolMessageStart { + if t == nil { + return nil + } + return t.ToolMessageStart +} + +func (t *TextEditorToolWithToolCallMessagesItem) GetToolMessageComplete() *ToolMessageComplete { + if t == nil { + return nil + } + return t.ToolMessageComplete +} + +func (t *TextEditorToolWithToolCallMessagesItem) GetToolMessageFailed() *ToolMessageFailed { + if t == nil { + return nil + } + return t.ToolMessageFailed +} + +func (t *TextEditorToolWithToolCallMessagesItem) GetToolMessageDelayed() *ToolMessageDelayed { + if t == nil { + return nil + } + return t.ToolMessageDelayed +} + +func (t *TextEditorToolWithToolCallMessagesItem) UnmarshalJSON(data []byte) error { + valueToolMessageStart := new(ToolMessageStart) + if err := json.Unmarshal(data, &valueToolMessageStart); err == nil { + t.typ = "ToolMessageStart" + t.ToolMessageStart = valueToolMessageStart + return nil + } + valueToolMessageComplete := new(ToolMessageComplete) + if err := json.Unmarshal(data, &valueToolMessageComplete); err == nil { + t.typ = "ToolMessageComplete" + t.ToolMessageComplete = valueToolMessageComplete + return nil + } + valueToolMessageFailed := new(ToolMessageFailed) + if err := json.Unmarshal(data, &valueToolMessageFailed); err == nil { + t.typ = "ToolMessageFailed" + t.ToolMessageFailed = valueToolMessageFailed + return nil + } + valueToolMessageDelayed := new(ToolMessageDelayed) + if err := json.Unmarshal(data, &valueToolMessageDelayed); err == nil { + t.typ = "ToolMessageDelayed" + t.ToolMessageDelayed = valueToolMessageDelayed + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, t) +} + +func (t TextEditorToolWithToolCallMessagesItem) MarshalJSON() ([]byte, error) { + if t.typ == "ToolMessageStart" || t.ToolMessageStart != nil { + return json.Marshal(t.ToolMessageStart) + } + if t.typ == "ToolMessageComplete" || t.ToolMessageComplete != nil { + return json.Marshal(t.ToolMessageComplete) + } + if t.typ == "ToolMessageFailed" || t.ToolMessageFailed != nil { + return json.Marshal(t.ToolMessageFailed) + } + if t.typ == "ToolMessageDelayed" || t.ToolMessageDelayed != nil { + return json.Marshal(t.ToolMessageDelayed) + } + return nil, fmt.Errorf("type %T does not include a non-empty union type", t) +} + +type TextEditorToolWithToolCallMessagesItemVisitor interface { + VisitToolMessageStart(*ToolMessageStart) error + VisitToolMessageComplete(*ToolMessageComplete) error + VisitToolMessageFailed(*ToolMessageFailed) error + VisitToolMessageDelayed(*ToolMessageDelayed) error +} + +func (t *TextEditorToolWithToolCallMessagesItem) Accept(visitor TextEditorToolWithToolCallMessagesItemVisitor) error { + if t.typ == "ToolMessageStart" || t.ToolMessageStart != nil { + return visitor.VisitToolMessageStart(t.ToolMessageStart) + } + if t.typ == "ToolMessageComplete" || t.ToolMessageComplete != nil { + return visitor.VisitToolMessageComplete(t.ToolMessageComplete) + } + if t.typ == "ToolMessageFailed" || t.ToolMessageFailed != nil { + return visitor.VisitToolMessageFailed(t.ToolMessageFailed) + } + if t.typ == "ToolMessageDelayed" || t.ToolMessageDelayed != nil { + return visitor.VisitToolMessageDelayed(t.ToolMessageDelayed) + } + return fmt.Errorf("type %T does not include a non-empty union type", t) +} + type TimeRange struct { // This is the time step for aggregations. // @@ -52187,12 +53717,14 @@ type UpdateAzureCredentialDtoRegion string const ( UpdateAzureCredentialDtoRegionAustralia UpdateAzureCredentialDtoRegion = "australia" - UpdateAzureCredentialDtoRegionCanada UpdateAzureCredentialDtoRegion = "canada" + UpdateAzureCredentialDtoRegionCanadaeast UpdateAzureCredentialDtoRegion = "canadaeast" + UpdateAzureCredentialDtoRegionCanadacentral UpdateAzureCredentialDtoRegion = "canadacentral" UpdateAzureCredentialDtoRegionEastus2 UpdateAzureCredentialDtoRegion = "eastus2" UpdateAzureCredentialDtoRegionEastus UpdateAzureCredentialDtoRegion = "eastus" UpdateAzureCredentialDtoRegionFrance UpdateAzureCredentialDtoRegion = "france" UpdateAzureCredentialDtoRegionIndia UpdateAzureCredentialDtoRegion = "india" - UpdateAzureCredentialDtoRegionJapan UpdateAzureCredentialDtoRegion = "japan" + UpdateAzureCredentialDtoRegionJapaneast UpdateAzureCredentialDtoRegion = "japaneast" + UpdateAzureCredentialDtoRegionJapanwest UpdateAzureCredentialDtoRegion = "japanwest" UpdateAzureCredentialDtoRegionUaenorth UpdateAzureCredentialDtoRegion = "uaenorth" UpdateAzureCredentialDtoRegionNorthcentralus UpdateAzureCredentialDtoRegion = "northcentralus" UpdateAzureCredentialDtoRegionNorway UpdateAzureCredentialDtoRegion = "norway" @@ -52208,8 +53740,10 @@ func NewUpdateAzureCredentialDtoRegionFromString(s string) (UpdateAzureCredentia switch s { case "australia": return UpdateAzureCredentialDtoRegionAustralia, nil - case "canada": - return UpdateAzureCredentialDtoRegionCanada, nil + case "canadaeast": + return UpdateAzureCredentialDtoRegionCanadaeast, nil + case "canadacentral": + return UpdateAzureCredentialDtoRegionCanadacentral, nil case "eastus2": return UpdateAzureCredentialDtoRegionEastus2, nil case "eastus": @@ -52218,8 +53752,10 @@ func NewUpdateAzureCredentialDtoRegionFromString(s string) (UpdateAzureCredentia return UpdateAzureCredentialDtoRegionFrance, nil case "india": return UpdateAzureCredentialDtoRegionIndia, nil - case "japan": - return UpdateAzureCredentialDtoRegionJapan, nil + case "japaneast": + return UpdateAzureCredentialDtoRegionJapaneast, nil + case "japanwest": + return UpdateAzureCredentialDtoRegionJapanwest, nil case "uaenorth": return UpdateAzureCredentialDtoRegionUaenorth, nil case "northcentralus": @@ -52406,12 +53942,14 @@ type UpdateAzureOpenAiCredentialDtoRegion string const ( UpdateAzureOpenAiCredentialDtoRegionAustralia UpdateAzureOpenAiCredentialDtoRegion = "australia" - UpdateAzureOpenAiCredentialDtoRegionCanada UpdateAzureOpenAiCredentialDtoRegion = "canada" + UpdateAzureOpenAiCredentialDtoRegionCanadaeast UpdateAzureOpenAiCredentialDtoRegion = "canadaeast" + UpdateAzureOpenAiCredentialDtoRegionCanadacentral UpdateAzureOpenAiCredentialDtoRegion = "canadacentral" UpdateAzureOpenAiCredentialDtoRegionEastus2 UpdateAzureOpenAiCredentialDtoRegion = "eastus2" UpdateAzureOpenAiCredentialDtoRegionEastus UpdateAzureOpenAiCredentialDtoRegion = "eastus" UpdateAzureOpenAiCredentialDtoRegionFrance UpdateAzureOpenAiCredentialDtoRegion = "france" UpdateAzureOpenAiCredentialDtoRegionIndia UpdateAzureOpenAiCredentialDtoRegion = "india" - UpdateAzureOpenAiCredentialDtoRegionJapan UpdateAzureOpenAiCredentialDtoRegion = "japan" + UpdateAzureOpenAiCredentialDtoRegionJapaneast UpdateAzureOpenAiCredentialDtoRegion = "japaneast" + UpdateAzureOpenAiCredentialDtoRegionJapanwest UpdateAzureOpenAiCredentialDtoRegion = "japanwest" UpdateAzureOpenAiCredentialDtoRegionUaenorth UpdateAzureOpenAiCredentialDtoRegion = "uaenorth" UpdateAzureOpenAiCredentialDtoRegionNorthcentralus UpdateAzureOpenAiCredentialDtoRegion = "northcentralus" UpdateAzureOpenAiCredentialDtoRegionNorway UpdateAzureOpenAiCredentialDtoRegion = "norway" @@ -52427,8 +53965,10 @@ func NewUpdateAzureOpenAiCredentialDtoRegionFromString(s string) (UpdateAzureOpe switch s { case "australia": return UpdateAzureOpenAiCredentialDtoRegionAustralia, nil - case "canada": - return UpdateAzureOpenAiCredentialDtoRegionCanada, nil + case "canadaeast": + return UpdateAzureOpenAiCredentialDtoRegionCanadaeast, nil + case "canadacentral": + return UpdateAzureOpenAiCredentialDtoRegionCanadacentral, nil case "eastus2": return UpdateAzureOpenAiCredentialDtoRegionEastus2, nil case "eastus": @@ -52437,8 +53977,10 @@ func NewUpdateAzureOpenAiCredentialDtoRegionFromString(s string) (UpdateAzureOpe return UpdateAzureOpenAiCredentialDtoRegionFrance, nil case "india": return UpdateAzureOpenAiCredentialDtoRegionIndia, nil - case "japan": - return UpdateAzureOpenAiCredentialDtoRegionJapan, nil + case "japaneast": + return UpdateAzureOpenAiCredentialDtoRegionJapaneast, nil + case "japanwest": + return UpdateAzureOpenAiCredentialDtoRegionJapanwest, nil case "uaenorth": return UpdateAzureOpenAiCredentialDtoRegionUaenorth, nil case "northcentralus": @@ -55058,6 +56600,172 @@ func (u *UpdateVonageCredentialDto) String() string { return fmt.Sprintf("%#v", u) } +type UpdateWorkflowDto struct { + Nodes []*UpdateWorkflowDtoNodesItem `json:"nodes,omitempty" url:"nodes,omitempty"` + Name *string `json:"name,omitempty" url:"name,omitempty"` + Edges []*Edge `json:"edges,omitempty" url:"edges,omitempty"` + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (u *UpdateWorkflowDto) GetNodes() []*UpdateWorkflowDtoNodesItem { + if u == nil { + return nil + } + return u.Nodes +} + +func (u *UpdateWorkflowDto) GetName() *string { + if u == nil { + return nil + } + return u.Name +} + +func (u *UpdateWorkflowDto) GetEdges() []*Edge { + if u == nil { + return nil + } + return u.Edges +} + +func (u *UpdateWorkflowDto) GetExtraProperties() map[string]interface{} { + return u.extraProperties +} + +func (u *UpdateWorkflowDto) UnmarshalJSON(data []byte) error { + type unmarshaler UpdateWorkflowDto + var value unmarshaler + if err := json.Unmarshal(data, &value); err != nil { + return err + } + *u = UpdateWorkflowDto(value) + extraProperties, err := internal.ExtractExtraProperties(data, *u) + if err != nil { + return err + } + u.extraProperties = extraProperties + u.rawJSON = json.RawMessage(data) + return nil +} + +func (u *UpdateWorkflowDto) String() string { + if len(u.rawJSON) > 0 { + if value, err := internal.StringifyJSON(u.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(u); err == nil { + return value + } + return fmt.Sprintf("%#v", u) +} + +type UpdateWorkflowDtoNodesItem struct { + Say *Say + Gather *Gather + Unknown interface{} + CreateWorkflowDto *CreateWorkflowDto + + typ string +} + +func (u *UpdateWorkflowDtoNodesItem) GetSay() *Say { + if u == nil { + return nil + } + return u.Say +} + +func (u *UpdateWorkflowDtoNodesItem) GetGather() *Gather { + if u == nil { + return nil + } + return u.Gather +} + +func (u *UpdateWorkflowDtoNodesItem) GetUnknown() interface{} { + if u == nil { + return nil + } + return u.Unknown +} + +func (u *UpdateWorkflowDtoNodesItem) GetCreateWorkflowDto() *CreateWorkflowDto { + if u == nil { + return nil + } + return u.CreateWorkflowDto +} + +func (u *UpdateWorkflowDtoNodesItem) UnmarshalJSON(data []byte) error { + valueSay := new(Say) + if err := json.Unmarshal(data, &valueSay); err == nil { + u.typ = "Say" + u.Say = valueSay + return nil + } + valueGather := new(Gather) + if err := json.Unmarshal(data, &valueGather); err == nil { + u.typ = "Gather" + u.Gather = valueGather + return nil + } + var valueUnknown interface{} + if err := json.Unmarshal(data, &valueUnknown); err == nil { + u.typ = "Unknown" + u.Unknown = valueUnknown + return nil + } + valueCreateWorkflowDto := new(CreateWorkflowDto) + if err := json.Unmarshal(data, &valueCreateWorkflowDto); err == nil { + u.typ = "CreateWorkflowDto" + u.CreateWorkflowDto = valueCreateWorkflowDto + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, u) +} + +func (u UpdateWorkflowDtoNodesItem) MarshalJSON() ([]byte, error) { + if u.typ == "Say" || u.Say != nil { + return json.Marshal(u.Say) + } + if u.typ == "Gather" || u.Gather != nil { + return json.Marshal(u.Gather) + } + if u.typ == "Unknown" || u.Unknown != nil { + return json.Marshal(u.Unknown) + } + if u.typ == "CreateWorkflowDto" || u.CreateWorkflowDto != nil { + return json.Marshal(u.CreateWorkflowDto) + } + return nil, fmt.Errorf("type %T does not include a non-empty union type", u) +} + +type UpdateWorkflowDtoNodesItemVisitor interface { + VisitSay(*Say) error + VisitGather(*Gather) error + VisitUnknown(interface{}) error + VisitCreateWorkflowDto(*CreateWorkflowDto) error +} + +func (u *UpdateWorkflowDtoNodesItem) Accept(visitor UpdateWorkflowDtoNodesItemVisitor) error { + if u.typ == "Say" || u.Say != nil { + return visitor.VisitSay(u.Say) + } + if u.typ == "Gather" || u.Gather != nil { + return visitor.VisitGather(u.Gather) + } + if u.typ == "Unknown" || u.Unknown != nil { + return visitor.VisitUnknown(u.Unknown) + } + if u.typ == "CreateWorkflowDto" || u.CreateWorkflowDto != nil { + return visitor.VisitCreateWorkflowDto(u.CreateWorkflowDto) + } + return fmt.Errorf("type %T does not include a non-empty union type", u) +} + type UpdateXAiCredentialDto struct { // This is not returned in the API. ApiKey *string `json:"apiKey,omitempty" url:"apiKey,omitempty"` @@ -55235,6 +56943,10 @@ type VapiModel struct { // This is the ID of the knowledge base the model will use. KnowledgeBaseId *string `json:"knowledgeBaseId,omitempty" url:"knowledgeBaseId,omitempty"` Steps []*VapiModelStepsItem `json:"steps,omitempty" url:"steps,omitempty"` + // This is the workflow that will be used for the call. To use a transient workflow, use `workflow` instead. + WorkflowId *string `json:"workflowId,omitempty" url:"workflowId,omitempty"` + // This is the workflow that will be used for the call. To use an existing workflow, use `workflowId` instead. + Workflow *Workflow `json:"workflow,omitempty" url:"workflow,omitempty"` // This is the name of the model. Ex. cognitivecomputations/dolphin-mixtral-8x7b Model string `json:"model" url:"model"` // This is the temperature that will be used for calls. Default is 0 to leverage caching for lower latency. @@ -55301,6 +57013,20 @@ func (v *VapiModel) GetSteps() []*VapiModelStepsItem { return v.Steps } +func (v *VapiModel) GetWorkflowId() *string { + if v == nil { + return nil + } + return v.WorkflowId +} + +func (v *VapiModel) GetWorkflow() *Workflow { + if v == nil { + return nil + } + return v.Workflow +} + func (v *VapiModel) GetModel() string { if v == nil { return "" @@ -56259,6 +57985,238 @@ func (w *WebhookCredential) String() string { return fmt.Sprintf("%#v", w) } +type Workflow struct { + Nodes []*WorkflowNodesItem `json:"nodes,omitempty" url:"nodes,omitempty"` + Id string `json:"id" url:"id"` + OrgId string `json:"orgId" url:"orgId"` + CreatedAt time.Time `json:"createdAt" url:"createdAt"` + UpdatedAt time.Time `json:"updatedAt" url:"updatedAt"` + Name string `json:"name" url:"name"` + Edges []*Edge `json:"edges,omitempty" url:"edges,omitempty"` + type_ string + + extraProperties map[string]interface{} + rawJSON json.RawMessage +} + +func (w *Workflow) GetNodes() []*WorkflowNodesItem { + if w == nil { + return nil + } + return w.Nodes +} + +func (w *Workflow) GetId() string { + if w == nil { + return "" + } + return w.Id +} + +func (w *Workflow) GetOrgId() string { + if w == nil { + return "" + } + return w.OrgId +} + +func (w *Workflow) GetCreatedAt() time.Time { + if w == nil { + return time.Time{} + } + return w.CreatedAt +} + +func (w *Workflow) GetUpdatedAt() time.Time { + if w == nil { + return time.Time{} + } + return w.UpdatedAt +} + +func (w *Workflow) GetName() string { + if w == nil { + return "" + } + return w.Name +} + +func (w *Workflow) GetEdges() []*Edge { + if w == nil { + return nil + } + return w.Edges +} + +func (w *Workflow) Type() string { + return w.type_ +} + +func (w *Workflow) GetExtraProperties() map[string]interface{} { + return w.extraProperties +} + +func (w *Workflow) UnmarshalJSON(data []byte) error { + type embed Workflow + var unmarshaler = struct { + embed + CreatedAt *internal.DateTime `json:"createdAt"` + UpdatedAt *internal.DateTime `json:"updatedAt"` + Type string `json:"type"` + }{ + embed: embed(*w), + } + if err := json.Unmarshal(data, &unmarshaler); err != nil { + return err + } + *w = Workflow(unmarshaler.embed) + w.CreatedAt = unmarshaler.CreatedAt.Time() + w.UpdatedAt = unmarshaler.UpdatedAt.Time() + if unmarshaler.Type != "workflow" { + return fmt.Errorf("unexpected value for literal on type %T; expected %v got %v", w, "workflow", unmarshaler.Type) + } + w.type_ = unmarshaler.Type + extraProperties, err := internal.ExtractExtraProperties(data, *w, "type") + if err != nil { + return err + } + w.extraProperties = extraProperties + w.rawJSON = json.RawMessage(data) + return nil +} + +func (w *Workflow) MarshalJSON() ([]byte, error) { + type embed Workflow + var marshaler = struct { + embed + CreatedAt *internal.DateTime `json:"createdAt"` + UpdatedAt *internal.DateTime `json:"updatedAt"` + Type string `json:"type"` + }{ + embed: embed(*w), + CreatedAt: internal.NewDateTime(w.CreatedAt), + UpdatedAt: internal.NewDateTime(w.UpdatedAt), + Type: "workflow", + } + return json.Marshal(marshaler) +} + +func (w *Workflow) String() string { + if len(w.rawJSON) > 0 { + if value, err := internal.StringifyJSON(w.rawJSON); err == nil { + return value + } + } + if value, err := internal.StringifyJSON(w); err == nil { + return value + } + return fmt.Sprintf("%#v", w) +} + +type WorkflowNodesItem struct { + Say *Say + Gather *Gather + Unknown interface{} + CreateWorkflowDto *CreateWorkflowDto + + typ string +} + +func (w *WorkflowNodesItem) GetSay() *Say { + if w == nil { + return nil + } + return w.Say +} + +func (w *WorkflowNodesItem) GetGather() *Gather { + if w == nil { + return nil + } + return w.Gather +} + +func (w *WorkflowNodesItem) GetUnknown() interface{} { + if w == nil { + return nil + } + return w.Unknown +} + +func (w *WorkflowNodesItem) GetCreateWorkflowDto() *CreateWorkflowDto { + if w == nil { + return nil + } + return w.CreateWorkflowDto +} + +func (w *WorkflowNodesItem) UnmarshalJSON(data []byte) error { + valueSay := new(Say) + if err := json.Unmarshal(data, &valueSay); err == nil { + w.typ = "Say" + w.Say = valueSay + return nil + } + valueGather := new(Gather) + if err := json.Unmarshal(data, &valueGather); err == nil { + w.typ = "Gather" + w.Gather = valueGather + return nil + } + var valueUnknown interface{} + if err := json.Unmarshal(data, &valueUnknown); err == nil { + w.typ = "Unknown" + w.Unknown = valueUnknown + return nil + } + valueCreateWorkflowDto := new(CreateWorkflowDto) + if err := json.Unmarshal(data, &valueCreateWorkflowDto); err == nil { + w.typ = "CreateWorkflowDto" + w.CreateWorkflowDto = valueCreateWorkflowDto + return nil + } + return fmt.Errorf("%s cannot be deserialized as a %T", data, w) +} + +func (w WorkflowNodesItem) MarshalJSON() ([]byte, error) { + if w.typ == "Say" || w.Say != nil { + return json.Marshal(w.Say) + } + if w.typ == "Gather" || w.Gather != nil { + return json.Marshal(w.Gather) + } + if w.typ == "Unknown" || w.Unknown != nil { + return json.Marshal(w.Unknown) + } + if w.typ == "CreateWorkflowDto" || w.CreateWorkflowDto != nil { + return json.Marshal(w.CreateWorkflowDto) + } + return nil, fmt.Errorf("type %T does not include a non-empty union type", w) +} + +type WorkflowNodesItemVisitor interface { + VisitSay(*Say) error + VisitGather(*Gather) error + VisitUnknown(interface{}) error + VisitCreateWorkflowDto(*CreateWorkflowDto) error +} + +func (w *WorkflowNodesItem) Accept(visitor WorkflowNodesItemVisitor) error { + if w.typ == "Say" || w.Say != nil { + return visitor.VisitSay(w.Say) + } + if w.typ == "Gather" || w.Gather != nil { + return visitor.VisitGather(w.Gather) + } + if w.typ == "Unknown" || w.Unknown != nil { + return visitor.VisitUnknown(w.Unknown) + } + if w.typ == "CreateWorkflowDto" || w.CreateWorkflowDto != nil { + return visitor.VisitCreateWorkflowDto(w.CreateWorkflowDto) + } + return fmt.Errorf("type %T does not include a non-empty union type", w) +} + type XAiCredential struct { // This is the api key for Grok in XAi's console. Get it from here: https://console.x.ai // This is not returned in the API.