vapi

package
v0.5.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 16, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIClient

type APIClient struct {
	BaseURL    string
	Token      string
	HTTPClient *http.Client
}

APIClient handles communication with the remote provider.

func (*APIClient) CreateAssistant added in v0.5.0

func (c *APIClient) CreateAssistant(requestData CreateAssistantRequest) ([]byte, int, error)

CreateAssistant creates a new assistant.

func (*APIClient) CreateToolFunction added in v0.4.0

func (c *APIClient) CreateToolFunction(requestData FunctionRequest) ([]byte, int, error)

CreateToolFunction method.

func (*APIClient) DeleteAssistant added in v0.5.0

func (c *APIClient) DeleteAssistant(id string) ([]byte, int, error)

DeleteAssistant deletes an existing assistant by ID.

func (*APIClient) DeleteFile added in v0.3.0

func (c *APIClient) DeleteFile(id string) ([]byte, int, error)

DeleteFile deletes a specific phone number by ID.

func (*APIClient) DeletePhoneNumber added in v0.3.0

func (c *APIClient) DeletePhoneNumber(id string) ([]byte, int, error)

DeletePhoneNumber deletes a specific phone number by ID.

func (*APIClient) DeleteToolFunction added in v0.4.0

func (c *APIClient) DeleteToolFunction(id string) ([]byte, int, error)

DeleteToolFunction deletes a specific tool by ID.

func (*APIClient) GetAssistant added in v0.5.0

func (c *APIClient) GetAssistant(id string) ([]byte, int, error)

GetAssistant retrieves the details of a specific assistant by ID.

func (*APIClient) GetFile added in v0.3.0

func (c *APIClient) GetFile(id string) ([]byte, int, error)

GetFile retrieves the details of a specific phone number by ID.

func (*APIClient) GetPhoneNumber added in v0.3.0

func (c *APIClient) GetPhoneNumber(id string) ([]byte, int, error)

GetPhoneNumber retrieves the details of a specific phone number by ID.

func (*APIClient) GetToolFunction added in v0.4.0

func (c *APIClient) GetToolFunction(id string) ([]byte, int, error)

GetToolFunction retrieves the details of a specific tool by ID.

func (*APIClient) ImportTwilioPhoneNumber added in v0.3.0

func (c *APIClient) ImportTwilioPhoneNumber(requestData ImportTwilioRequest) ([]byte, int, error)

ImportTwilioPhoneNumber requests the creation of a new phone number.

func (*APIClient) SendRequest

func (c *APIClient) SendRequest(method, endpoint string, body interface{}) ([]byte, int, error)

SendRequest Sends a request to the API.

func (*APIClient) UpdateAssistant added in v0.5.5

func (c *APIClient) UpdateAssistant(id string, requestData CreateAssistantRequest) ([]byte, int, error)

UpdateAssistant updates assistant.

func (*APIClient) UploadData added in v0.3.3

func (c *APIClient) UploadData(fieldName, filename string, content []byte) ([]byte, int, error)

UploadData Uploads a file using multipart/form-data.

type AnalysisPlan added in v0.5.0

type AnalysisPlan struct {
	SummaryPrompt           string                `json:"summaryPrompt"`
	StructuredDataPrompt    string                `json:"structuredDataPrompt"`
	StructuredDataSchema    *StructuredDataSchema `json:"structuredDataSchema"`
	SuccessEvaluationPrompt string                `json:"successEvaluationPrompt"`
	SuccessEvaluationRubric string                `json:"successEvaluationRubric"`
}

AnalysisPlan struct.

type Assistant added in v0.5.0

type Assistant struct {
	ID                           string             `json:"id,omitempty"`
	OrgID                        string             `json:"orgId,omitempty"`
	Name                         string             `json:"name,omitempty"`
	FirstMessageMode             string             `json:"firstMessageMode,omitempty"`
	HipaaEnabled                 bool               `json:"hipaaEnabled,omitempty"`
	BackgroundSound              string             `json:"backgroundSound,omitempty"`
	BackgroundDenoising          bool               `json:"backgroundDenoisingEnabled,omitempty"`
	ModelOutputEnabled           bool               `json:"modelOutputInMessagesEnabled,omitempty"`
	Language                     string             `json:"language,omitempty"`
	ForwardingPhoneNumber        string             `json:"forwardingPhoneNumber,omitempty"`
	InterruptionsEnabled         bool               `json:"interruptionsEnabled,omitempty"`
	EndCallFunctionEnabled       bool               `json:"endCallFunctionEnabled,omitempty"`
	DialKeypadFunctionEnabled    bool               `json:"dialKeypadFunctionEnabled,omitempty"`
	FillersEnabled               bool               `json:"fillersEnabled,omitempty"`
	SilenceTimeoutSeconds        *float64           `json:"silenceTimeoutSeconds,omitempty"`
	ResponseDelaySeconds         *float64           `json:"responseDelaySeconds,omitempty"`
	NumWordsToInterruptAssistant *int64             `json:"numWordsToInterruptAssistant,omitempty"`
	LiveTranscriptsEnabled       *bool              `json:"liveTranscriptsEnabled,omitempty"`
	Keywords                     []string           `json:"keywords,omitempty"`
	ParentID                     *string            `json:"parentId,omitempty"`
	Voice                        *Voice             `json:"voice,omitempty"`
	Model                        *Model             `json:"model,omitempty"`
	RecordingEnabled             bool               `json:"recordingEnabled,omitempty"`
	FirstMessage                 string             `json:"firstMessage,omitempty"`
	VoicemailMessage             string             `json:"voicemailMessage,omitempty"`
	EndCallMessage               string             `json:"endCallMessage,omitempty"`
	Transcriber                  *Transcriber       `json:"transcriber,omitempty"`
	ServerURL                    string             `json:"serverUrl,omitempty"`
	ServerURLSecret              string             `json:"serverUrlSecret,omitempty"`
	ClientMessages               []string           `json:"clientMessages,omitempty"`
	ServerMessages               []string           `json:"serverMessages,omitempty"`
	EndCallPhrases               []string           `json:"endCallPhrases,omitempty"`
	MaxDurationSeconds           int64              `json:"maxDurationSeconds,omitempty"`
	AnalysisPlan                 *AnalysisPlan      `json:"analysisPlan,omitempty"`
	MessagePlan                  *MessagePlan       `json:"messagePlan,omitempty"`
	StartSpeakingPlan            *StartSpeakingPlan `json:"startSpeakingPlan,omitempty"`
	StopSpeakingPlan             *StopSpeakingPlan  `json:"StopSpeakingPlan,omitempty"`
}

Assistant struct.

type CreateAssistantRequest added in v0.5.0

type CreateAssistantRequest struct {
	Name                         string             `json:"name"`
	FirstMessageMode             string             `json:"firstMessageMode,omitempty"`
	HipaaEnabled                 bool               `json:"hipaaEnabled,omitempty"`
	ClientMessages               []string           `json:"clientMessages,omitempty"`
	ServerMessages               []string           `json:"serverMessages,omitempty"`
	BackgroundSound              string             `json:"backgroundSound,omitempty"`
	BackgroundDenoising          bool               `json:"backgroundDenoisingEnabled,omitempty"`
	ModelOutputEnabled           bool               `json:"modelOutputInMessagesEnabled,omitempty"`
	Language                     string             `json:"language,omitempty"`
	ForwardingPhoneNumber        string             `json:"forwardingPhoneNumber,omitempty"`
	InterruptionsEnabled         bool               `json:"interruptionsEnabled,omitempty"`
	EndCallFunctionEnabled       bool               `json:"endCallFunctionEnabled,omitempty"`
	DialKeypadFunctionEnabled    bool               `json:"dialKeypadFunctionEnabled,omitempty"`
	FillersEnabled               bool               `json:"fillersEnabled,omitempty"`
	SilenceTimeoutSeconds        *float64           `json:"silenceTimeoutSeconds,omitempty"`
	ResponseDelaySeconds         *float64           `json:"responseDelaySeconds,omitempty"`
	NumWordsToInterruptAssistant *int64             `json:"numWordsToInterruptAssistant,omitempty"`
	LiveTranscriptsEnabled       *bool              `json:"liveTranscriptsEnabled,omitempty"`
	Keywords                     []string           `json:"keywords,omitempty"`
	Voice                        *Voice             `json:"voice,omitempty"`
	Model                        *Model             `json:"model,omitempty"`
	RecordingEnabled             bool               `json:"recordingEnabled,omitempty"`
	FirstMessage                 string             `json:"firstMessage,omitempty"`
	VoicemailMessage             string             `json:"voicemailMessage,omitempty"`
	EndCallMessage               string             `json:"endCallMessage,omitempty"`
	Transcriber                  *Transcriber       `json:"transcriber,omitempty"`
	ServerURL                    string             `json:"serverUrl,omitempty"`
	ServerURLSecret              string             `json:"serverUrlSecret,omitempty"`
	EndCallPhrases               []string           `json:"endCallPhrases,omitempty"`
	MaxDurationSeconds           int64              `json:"maxDurationSeconds,omitempty"`
	AnalysisPlan                 *AnalysisPlan      `json:"analysisPlan,omitempty"`
	MessagePlan                  *MessagePlan       `json:"messagePlan,omitempty"`
	StartSpeakingPlan            *StartSpeakingPlan `json:"startSpeakingPlan,omitempty"`
	StopSpeakingPlan             *StopSpeakingPlan  `json:"stopSpeakingPlan,omitempty"`
}

CreateAssistantRequest represents the request body for creating an assistant.

type Customer added in v0.5.1

type Customer struct {
	Number string `json:"number"`
}

Customer struct.

type FallbackDestination added in v0.3.0

type FallbackDestination struct {
	Type                   string `json:"type,omitempty"`
	NumberE164CheckEnabled bool   `json:"numberE164CheckEnabled,omitempty"`
	Number                 string `json:"number,omitempty"`
	Extension              string `json:"extension,omitempty"`
	Message                string `json:"message,omitempty"`
	Description            string `json:"description,omitempty"`
}

FallbackDestination struct.

type FileResponse

type FileResponse struct {
	ID           string                 `json:"id"`
	Name         string                 `json:"name"`
	OriginalName string                 `json:"originalName"`
	Bytes        int64                  `json:"bytes"`
	Mimetype     string                 `json:"mimetype"`
	Path         string                 `json:"path"`
	URL          string                 `json:"url"`
	Metadata     map[string]interface{} `json:"metadata"`
	OrgID        string                 `json:"orgId"`
	CreatedAt    string                 `json:"createdAt"`
	UpdatedAt    string                 `json:"updatedAt"`
	Status       string                 `json:"status"`
	Purpose      string                 `json:"purpose"`
	Bucket       string                 `json:"bucket"`
}

FileResponse represents the structure of the API response.

func (*FileResponse) UnmarshalJSON

func (fr *FileResponse) UnmarshalJSON(data []byte) error

UnmarshalJSON implements custom unmarshaling for FileResponse.

type Function added in v0.4.0

type Function struct {
	Description string         `json:"description"`
	Async       bool           `json:"async,omitempty"`
	Name        string         `json:"name,omitempty"`
	Parameters  FunctionParams `json:"parameters,omitempty"`
}

type FunctionParams added in v0.4.0

type FunctionParams struct {
	Type       string              `json:"type"`
	Properties map[string]Property `json:"properties"`
}

type FunctionRequest added in v0.4.0

type FunctionRequest struct {
	Server   Server   `json:"server"`
	Function Function `json:"function"`
	Type     string   `json:"type"`
	Async    bool     `json:"async"`
}

FunctionRequest struct.

type FunctionResponse added in v0.4.0

type FunctionResponse struct {
	ID        string           `json:"id"`
	CreatedAt string           `json:"createdAt"`
	UpdatedAt string           `json:"updatedAt"`
	Type      string           `json:"type"`
	Function  ResponseFunction `json:"function"`
	OrgID     string           `json:"orgId"`
	Server    ResponseServer   `json:"server"`
	Async     bool             `json:"async"`
}

FunctionResponse struct.

type ImportTwilioRequest added in v0.3.0

type ImportTwilioRequest struct {
	Provider         string               `json:"provider"`
	Name             string               `json:"name"`
	Number           string               `json:"number"`
	TwilioAccountSID string               `json:"twilioAccountSid"`
	TwilioAuthToken  string               `json:"twilioAuthToken"`
	AssistantID      string               `json:"assistantId,omitempty"`
	Fallback         *FallbackDestination `json:"fallbackDestination,omitempty"`
}

ImportTwilioRequest struct.

type KnowledgeBase added in v0.5.1

type KnowledgeBase struct {
	TopK     int64    `json:"topK"`
	FileIDs  []string `json:"fileIds"`
	Provider string   `json:"provider"`
}

KnowledgeBase struct.

type Message added in v0.5.1

type Message struct {
	Role    string `json:"role"`
	Content string `json:"content"`
}

Message struct.

type MessagePlan added in v0.5.1

type MessagePlan struct {
	IdleMessages []string `json:"idleMessages"`
}

MessagePlan struct.

type Model added in v0.5.0

type Model struct {
	Model         string         `json:"model"`
	SystemPrompt  string         `json:"systemPrompt"`
	Provider      string         `json:"provider"`
	MaxTokens     int64          `json:"maxTokens,omitempty"`
	Temperature   float64        `json:"temperature,omitempty"`
	ToolIDs       []string       `json:"toolIds,omitempty"`
	Messages      []Message      `json:"messages,omitempty"`
	KnowledgeBase *KnowledgeBase `json:"knowledgeBase,omitempty"`
}

Model struct.

type Property added in v0.4.0

type Property struct {
	Type        string `json:"type"`
	Description string `json:"description"`
}

type ResponseFunction added in v0.4.0

type ResponseFunction struct {
	Name        string                 `json:"name"`
	Async       bool                   `json:"async"`
	Description string                 `json:"description"`
	Parameters  ResponseFunctionParams `json:"parameters"`
}

type ResponseFunctionParams added in v0.4.0

type ResponseFunctionParams struct {
	Type       string                      `json:"type"`
	Properties map[string]ResponseProperty `json:"properties"`
}

type ResponseProperty added in v0.4.0

type ResponseProperty struct {
	Description string `json:"description"`
	Type        string `json:"type"`
}

type ResponseServer added in v0.4.0

type ResponseServer struct {
	URL string `json:"url"`
}

type Server added in v0.4.0

type Server struct {
	URL    string `json:"url"`
	Secret string `json:"secret"`
}

type StartSpeakingPlan added in v0.5.0

type StartSpeakingPlan struct {
	WaitSeconds                  float64                       `json:"waitSeconds,omitempty"`
	SmartEndpointingEnabled      bool                          `json:"smartEndpointingEnabled,omitempty"`
	TranscriptionEndpointingPlan *TranscriptionEndpointingPlan `json:"transcriptionEndpointingPlan,omitempty"`
}

StartSpeakingPlan struct.

type StopSpeakingPlan added in v0.5.0

type StopSpeakingPlan struct {
	NumWords       float64 `json:"numWords,omitempty"`
	VoiceSeconds   float64 `json:"voiceSeconds,omitempty"`
	BackoffSeconds float64 `json:"backoffSeconds,omitempty"`
}

StopSpeakingPlan struct.

type StructuredDataSchema added in v0.5.0

type StructuredDataSchema struct {
	Type       string               `json:"type"`
	Properties map[string]*Property `json:"properties"`
}

StructuredDataSchema struct.

type Transcriber added in v0.5.0

type Transcriber struct {
	Model    string `json:"model"`
	Language string `json:"language"`
	Provider string `json:"provider"`
}

Transcriber struct.

type TranscriptionEndpointingPlan added in v0.5.0

type TranscriptionEndpointingPlan struct {
	OnPunctuationSeconds   float64 `json:"onPunctuationSeconds,omitempty"`
	OnNoPunctuationSeconds float64 `json:"onNoPunctuationSeconds,omitempty"`
	OnNumberSeconds        float64 `json:"onNumberSeconds,omitempty"`
}

TranscriptionEndpointingPlan struct.

type TwilioPhoneNumber added in v0.3.0

type TwilioPhoneNumber struct {
	ID               string               `json:"id"`
	OrgID            string               `json:"orgId"`
	Number           string               `json:"number"`
	CreatedAt        string               `json:"createdAt"`
	UpdatedAt        string               `json:"updatedAt"`
	TwilioAccountSid string               `json:"twilioAccountSid"`
	TwilioAuthToken  string               `json:"twilioAuthToken"`
	Name             string               `json:"name"`
	Provider         string               `json:"provider"`
	AssistantID      string               `json:"assistantId"`
	Fallback         *FallbackDestination `json:"fallbackDestination,omitempty"`
}

TwilioPhoneNumber represents the structure of a Twilio phone number API response.

type Voice added in v0.5.0

type Voice struct {
	Model           string  `json:"model,omitempty"`
	VoiceID         string  `json:"voiceId,omitempty"`
	Provider        string  `json:"provider,omitempty"`
	Stability       float64 `json:"stability,omitempty"`
	SimilarityBoost float64 `json:"similarityBoost,omitempty"`
}

Voice struct.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL