noj
06/15/2024, 9:43 PMJSON.parse update_assistant(
assistant_id: assistant_id,
assistant_hash: assistant)
with:
assistant = {
"name" => "Mary",
"voice" => {
"voiceId" => "melissa",
"provider" => "playht"
},
"model" => {
"model" => "gpt-4",
"messages" => [
[0] {
"role" => "system",
"content" => "say hi to the user"
}
],
"provider" => "openai",
"maxTokens" => 250,
"temperature" => 1
},
"recordingEnabled" => true,
"firstMessage" => "Hello, this is Breezy from 'Mandia & Sons Construction'. How are you doing? ",
"voicemailMessage" => "You've reached Mary's Dental voicemail. Please leave a message after the beep, and we'll get back to you as soon as possible.",
"endCallMessage" => "Thank you for contacting Mary's Dental. Have a great day!",
"transcriber" => {
"model" => "nova-2",
"language" => "en",
"provider" => "deepgram"
},
"clientMessages" => [
[0] "transcript",
[1] "hang",
[2] "function-call",
[3] "speech-update",
[4] "metadata",
[5] "conversation-update"
],
"serverMessages" => [
[0] "end-of-call-report",
[1] "status-update",
[2] "hang",
[3] "function-call"
],
"endCallPhrases" => [
[0] "goodbye",
[1] "talk to you soon"
]
}
And getting this error:
{"message"=>["model.temperature must not be greater than 2", "recordingEnabled must be a boolean value"], "error"=>"Bad Request", "statusCode"=>400}
Am I overthinking this? My goal is to change the prompt before an incoming call is coming in.Vapi
06/15/2024, 9:44 PMVapi
06/15/2024, 9:44 PMtemperature
value in the model
object must not exceed 2. You have it set to 1, which is within the valid range, so that part of the error message seems to be a mistake unless there's a different part of your code where the temperature is set incorrectly.
2. The recordingEnabled
field must be a boolean value. In your JSON, it is set to true
, which is a valid boolean value. If you're still getting an error for this field, ensure that the value is not being altered elsewhere in your code.
To change the prompt dynamically before an incoming call, you can use templates with double curly braces {{variableName}}
in the firstMessage
field. For example:
json
"firstMessage": "Hello, this is {{assistantName}} from '{{companyName}}'. How are you doing?"
Then, when starting a call, you can provide the values for {{assistantName}}
and {{companyName}}
to customize the prompt for that specific call.
If you're still encountering issues after making these adjustments, please ensure that the rest of your JSON structure conforms to the API's schema and that all values are correctly typed. If the problem persists, please ask support for more info on this.Vapi
06/15/2024, 9:44 PMnoj
06/16/2024, 4:13 AMnoj
06/16/2024, 4:20 AMdef diff_update_assistant(assistant_id:, new_prompt:)
assistant = get_assistant(assistant_id: assistant_id)
assistant['model']['messages'][0]['content'] = new_prompt
assistant['model'] = assistant['model'].except('temperature', 'maxTokens')
assistant = assistant.except(
'id',
'orgId',
'createdAt',
'updatedAt',
'isServerUrlSecretSet',
'recordingEnabled',
)
ap assistant
JSON.parse update_assistant(
assistant_id: assistant_id,
assistant_hash: assistant)
end
def update_assistant(assistant_id:, assistant_hash:)
HTTParty.patch(
"https://api.vapi.ai/assistant/#{assistant_id}",
headers:,
body: assistant_hash
).body
end
Unfortuantly, I don't think it had any effect on the dashboard.Chowderr
06/16/2024, 7:23 AMnoj
06/16/2024, 11:31 PMhowwy
06/17/2024, 12:42 AMhowwy
06/17/2024, 12:42 AMhowwy
06/17/2024, 12:43 AMSahil
06/17/2024, 3:18 AMnoj
06/17/2024, 5:30 PMSahil
06/18/2024, 2:27 PMSahil
06/18/2024, 2:27 PMnoj
06/20/2024, 6:09 PMnoj
06/20/2024, 6:11 PMSahil
06/20/2024, 6:15 PMChowderr
06/20/2024, 6:24 PMjims
09/16/2024, 6:46 PMjims
09/16/2024, 7:10 PMSahil
09/17/2024, 7:08 PMjims
09/20/2024, 7:10 AM