Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

i get this error anyone can tell me how can i solve this! #29

Closed
MuhammadAdil-Developer opened this issue Apr 21, 2024 · 4 comments
Closed

Comments

@MuhammadAdil-Developer
Copy link

node --no-deprecation app.js
Server running on port 3000
Twilio -> Starting Media Stream for MZeb5d94dbc813cf20f227ed2a7163312c
Interaction 1: TTS -> TWILIO: Hello! I understand you're looking for a pair of AirPods, is that correct?
Twilio -> Interruption, Clearing stream
Interaction 0 – STT -> GPT: Hello?
STT -> Speech was already final when UtteranceEnd recevied
Twilio -> Audio completed mark (195): 3898e4b5-4a15-4b41-871f-fd3c47b8ee77
Interaction 0: GPT -> TTS: Hi there! Thanks for calling in today. •
Interaction 0: GPT -> TTS: How can I assist you with your AirPods selection? •
Interaction 0: TTS -> TWILIO: Hi there! Thanks for calling in today. •
Interaction 0: GPT -> TTS: Do you prefer headphones that go in your ear •
Interaction 0: GPT -> TTS: or over the ear?
GPT -> user context length: 5
Interaction 0: TTS -> TWILIO: How can I assist you with your AirPods selection? •
Interaction 0: TTS -> TWILIO: Do you prefer headphones that go in your ear •
Interaction 0: TTS -> TWILIO: or over the ear?
Twilio -> Audio completed mark (467): 0ece6179-11ff-4a59-a4e9-eda039dabe4b
Twilio -> Audio completed mark (596): accf6e83-7e3c-4af4-b8d4-27bf3eb5ffa2
Twilio -> Audio completed mark (697): 9c2d998d-a0b5-43d6-860a-b4fd98ea9bf7
Twilio -> Audio completed mark (754): bb3228de-18f9-4019-b31d-f4119f48bc44
Interaction 1 – STT -> GPT: Can you tell me
Interaction 1: GPT -> TTS: Absolutely! •
Interaction 1: TTS -> TWILIO: Absolutely! •
Interaction 1: GPT -> TTS: Would you like to know more about the in-ear AirPods and AirPods Pro, •
Twilio -> Interruption, Clearing stream
Twilio -> Audio completed mark (1109): bd21b254-3f01-49b1-8119-08d3dcddffa0
Interaction 1: GPT -> TTS: or the over-the-ear AirPods Max?
GPT -> user context length: 7
Interaction 1: TTS -> TWILIO: Would you like to know more about the in-ear AirPods and AirPods Pro, •
Twilio -> Interruption, Clearing stream
Interaction 1: TTS -> TWILIO: or the over-the-ear AirPods Max?
Twilio -> Audio completed mark (1171): 44c7d4e8-1820-42e1-8456-8087fe4b8b92
UtteranceEnd received before speechFinal, emit the text collected so far: one headphone price?
Interaction 2 – STT -> GPT: one headphone price?
Twilio -> Audio completed mark (1280): ea654842-6155-4e89-a724-dca99bdbd21b
Warning: Double function arguments returned by OpenAI: {"model": "airpods"}{"model": "airpods pro"}{"model": "airpods max"}
Interaction 2: GPT -> TTS: Let me check the price, one moment.
GPT -> called checkPrice function
**C:\Python Important\call-gpt-main\node_modules\openai\error.js:43
return new BadRequestError(status, error, message, headers);
^

BadRequestError: 400 'checkPrice' is not one of ['system', 'assistant', 'user', 'function'] - 'messages.8.role'**
at APIError.generate (C:\Python Important\call-gpt-main\node_modules\openai\error.js:43:20)
at OpenAI.makeStatusError (C:\Python Important\call-gpt-main\node_modules\openai\core.js:251:33)
at OpenAI.makeRequest (C:\Python Important\call-gpt-main\node_modules\openai\core.js:290:30)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async GptService.completion (C:\Python Important\call-gpt-main\services\gpt-service.js:55:20)
at async GptService.completion (C:\Python Important\call-gpt-main\services\gpt-service.js:114:9) {
status: 400,
headers: {
'access-control-allow-origin': '*',
'alt-svc': 'h3=":443"; ma=86400',
'cf-cache-status': 'DYNAMIC',
'cf-ray': '877c5ba83ad621e3-KHI',
connection: 'keep-alive',
'content-length': '203',
'content-type': 'application/json',
date: 'Sun, 21 Apr 2024 09:30:54 GMT',
'openai-organization': 'user-gntjrfo4a4rpvvm5p9udpbnq',
'openai-processing-ms': '40',
'openai-version': '2020-10-01',
server: 'cloudflare',
'set-cookie': '__cf_bm=iKylCws.LiQAZjpYO7fLbZyeMgMRa8pUZT7aUFV6k9Q-1713691854-1.0.1.1-kKpI9bMcsYZXFTmzd2m5KozjqvGMkwwPYslFKJnFMLX.Fw4md0fCxEe0B0RWxPXenKhGQw6MkE7maRZ_osYOpg; path=/; expires=Sun, 21-Apr-24 10:00:54 GMT; domain=.api.openai.com; HttpOnly; Secure; SameSite=None, _cfuvid=DFu1pwBHgbgfvXVgiE_thT8EI4OpFrDNR6GdEkJB8zA-1713691854483-0.0.1.1-604800000; path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None',
'strict-transport-security': 'max-age=15724800; includeSubDomains',
'x-ratelimit-limit-requests': '500',
'x-ratelimit-limit-tokens': '300000',
'x-ratelimit-remaining-requests': '499',
'x-ratelimit-remaining-tokens': '299618',
'x-ratelimit-reset-requests': '120ms',
'x-ratelimit-reset-tokens': '76ms',
'x-request-id': 'req_669c8e2baa1c400655a23fd6ab91b696'
},
error: {
message: "'checkPrice' is not one of ['system', 'assistant', 'user', 'function'] - 'messages.8.role'",
type: 'invalid_request_error',
param: null,
code: null
},
code: null,
param: null,
STT -> Speech was already final when UtteranceEnd recevied
Twilio -> Audio completed mark (195): 3898e4b5-4a15-4b41-871f-fd3c47b8ee77
Interaction 0: GPT -> TTS: Hi there! Thanks for calling in today. •
Interaction 0: GPT -> TTS: How can I assist you with your AirPods selection? •
Interaction 0: TTS -> TWILIO: Hi there! Thanks for calling in today. •
Interaction 0: GPT -> TTS: Do you prefer headphones that go in your ear •
Interaction 0: GPT -> TTS: or over the ear?
GPT -> user context length: 5
Interaction 0: TTS -> TWILIO: How can I assist you with your AirPods selection? •
Interaction 0: TTS -> TWILIO: Do you prefer headphones that go in your ear •
Interaction 0: TTS -> TWILIO: or over the ear?
Twilio -> Audio completed mark (467): 0ece6179-11ff-4a59-a4e9-eda039dabe4b
Twilio -> Audio completed mark (596): accf6e83-7e3c-4af4-b8d4-27bf3eb5ffa2
Twilio -> Audio completed mark (697): 9c2d998d-a0b5-43d6-860a-b4fd98ea9bf7
Twilio -> Audio completed mark (754): bb3228de-18f9-4019-b31d-f4119f48bc44
Interaction 1 – STT -> GPT: Can you tell me
Interaction 1: GPT -> TTS: Absolutely! •
Interaction 1: TTS -> TWILIO: Absolutely! •
Interaction 1: GPT -> TTS: Would you like to know more about the in-ear AirPods and AirPods Pro, •
Twilio -> Interruption, Clearing stream
Twilio -> Audio completed mark (1109): bd21b254-3f01-49b1-8119-08d3dcddffa0
Interaction 1: GPT -> TTS: or the over-the-ear AirPods Max?
GPT -> user context length: 7
Interaction 1: TTS -> TWILIO: Would you like to know more about the in-ear AirPods and AirPods Pro, •
Twilio -> Interruption, Clearing stream
Interaction 1: TTS -> TWILIO: or the over-the-ear AirPods Max?
Twilio -> Audio completed mark (1171): 44c7d4e8-1820-42e1-8456-8087fe4b8b92
UtteranceEnd received before speechFinal, emit the text collected so far: one headphone price?
Interaction 2 – STT -> GPT: one headphone price?
Twilio -> Audio completed mark (1280): ea654842-6155-4e89-a724-dca99bdbd21b
Warning: Double function arguments returned by OpenAI: {"model": "airpods"}{"model": "airpods pro"}{"model": "airpods max"}
Interaction 2: GPT -> TTS: Let me check the price, one moment.
GPT -> called checkPrice function
C:\Python Important\call-gpt-main\node_modules\openai\error.js:43
return new BadRequestError(status, error, message, headers);
^

BadRequestError: 400 'checkPrice' is not one of ['system', 'assistant', 'user', 'function'] - 'messages.8.role'
at APIError.generate (C:\Python Important\call-gpt-main\node_modules\openai\error.js:43:20)
at OpenAI.makeStatusError (C:\Python Important\call-gpt-main\node_modules\openai\core.js:251:33)
at OpenAI.makeRequest (C:\Python Important\call-gpt-main\node_modules\openai\core.js:290:30)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async GptService.completion (C:\Python Important\call-gpt-main\services\gpt-service.js:55:20)
at async GptService.completion (C:\Python Important\call-gpt-main\services\gpt-service.js:114:9) {
status: 400,
headers: {
'access-control-allow-origin': '*',
'alt-svc': 'h3=":443"; ma=86400',
'cf-cache-status': 'DYNAMIC',
'cf-ray': '877c5ba83ad621e3-KHI',
connection: 'keep-alive',
'content-length': '203',
'content-type': 'application/json',
date: 'Sun, 21 Apr 2024 09:30:54 GMT',
'openai-organization': 'user-gntjrfo4a4rpvvm5p9udpbnq',
'openai-processing-ms': '40',
'openai-version': '2020-10-01',
server: 'cloudflare',
'set-cookie': '__cf_bm=iKylCws.LiQAZjpYO7fLbZyeMgMRa8pUZT7aUFV6k9Q-1713691854-1.0.1.1-kKpI9bMcsYZXFTmzd2m5KozjqvGMkwwPYslFKJnFMLX.Fw4md0fCxEe0B0RWxPXenKhGQw6MkE7maRZ_osYOpg; path=/; expires=Sun, 21-Apr-24 10:00:54 GMT; domain=.api.openai.com; HttpOnly; Secure; SameSite=None, _cfuvid=DFu1pwBHgbgfvXVgiE_thT8EI4OpFrDNR6GdEkJB8zA-1713691854483-0.0.1.1-604800000; path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None',
'strict-transport-security': 'max-age=15724800; includeSubDomains',
'x-ratelimit-limit-requests': '500',
'x-ratelimit-limit-tokens': '300000',
'x-ratelimit-remaining-requests': '499',
'x-ratelimit-remaining-tokens': '299618',
'x-ratelimit-reset-requests': '120ms',
'x-ratelimit-reset-tokens': '76ms',
'x-request-id': 'req_669c8e2baa1c400655a23fd6ab91b696'
},
error: {
message: "'checkPrice' is not one of ['system', 'assistant', 'user', 'function'] - 'messages.8.role'",
type: 'invalid_request_error',
param: null,
code: null
type: 'invalid_request_error'
}

STT -> Speech was already final when UtteranceEnd recevied
Twilio -> Audio completed mark (195): 3898e4b5-4a15-4b41-871f-fd3c47b8ee77
Interaction 0: GPT -> TTS: Hi there! Thanks for calling in today. •
Interaction 0: GPT -> TTS: How can I assist you with your AirPods selection? •
Interaction 0: TTS -> TWILIO: Hi there! Thanks for calling in today. •
Interaction 0: GPT -> TTS: Do you prefer headphones that go in your ear •
Interaction 0: GPT -> TTS: or over the ear?
GPT -> user context length: 5
Interaction 0: TTS -> TWILIO: How can I assist you with your AirPods selection? •
Interaction 0: TTS -> TWILIO: Do you prefer headphones that go in your ear •
Interaction 0: TTS -> TWILIO: or over the ear?
Twilio -> Audio completed mark (467): 0ece6179-11ff-4a59-a4e9-eda039dabe4b
Twilio -> Audio completed mark (596): accf6e83-7e3c-4af4-b8d4-27bf3eb5ffa2
Twilio -> Audio completed mark (697): 9c2d998d-a0b5-43d6-860a-b4fd98ea9bf7
Twilio -> Audio completed mark (754): bb3228de-18f9-4019-b31d-f4119f48bc44
Interaction 1 – STT -> GPT: Can you tell me
Interaction 1: GPT -> TTS: Absolutely! •
Interaction 1: TTS -> TWILIO: Absolutely! •
Interaction 1: GPT -> TTS: Would you like to know more about the in-ear AirPods and AirPods Pro, •
Twilio -> Interruption, Clearing stream
Twilio -> Audio completed mark (1109): bd21b254-3f01-49b1-8119-08d3dcddffa0
Interaction 1: GPT -> TTS: or the over-the-ear AirPods Max?
GPT -> user context length: 7
Interaction 1: TTS -> TWILIO: Would you like to know more about the in-ear AirPods and AirPods Pro, •
Twilio -> Interruption, Clearing stream
Interaction 1: TTS -> TWILIO: or the over-the-ear AirPods Max?
Twilio -> Audio completed mark (1171): 44c7d4e8-1820-42e1-8456-8087fe4b8b92
UtteranceEnd received before speechFinal, emit the text collected so far: one headphone price?
Interaction 2 – STT -> GPT: one headphone price?
Twilio -> Audio completed mark (1280): ea654842-6155-4e89-a724-dca99bdbd21b
Warning: Double function arguments returned by OpenAI: {"model": "airpods"}{"model": "airpods pro"}{"model": "airpods max"}
Interaction 2: GPT -> TTS: Let me check the price, one moment.
GPT -> called checkPrice function
**C:\Python Important\call-gpt-main\node_modules\openai\error.js:43
return new BadRequestError(status, error, message, headers);
^

BadRequestError: 400 'checkPrice' is not one of ['system', 'assistant', 'user', 'function'] - 'messages.8.role'
at APIError.generate (C:\Python Important\call-gpt-main\node_modules\openai\error.js:43:20)**
at OpenAI.makeStatusError (C:\Python Important\call-gpt-main\node_modules\openai\core.js:251:33)
at OpenAI.makeRequest (C:\Python Important\call-gpt-main\node_modules\openai\core.js:290:30)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async GptService.completion (C:\Python Important\call-gpt-main\services\gpt-service.js:55:20)
at async GptService.completion (C:\Python Important\call-gpt-main\services\gpt-service.js:114:9) {
status: 400,
headers: {
'access-control-allow-origin': '*',
'alt-svc': 'h3=":443"; ma=86400',
'cf-cache-status': 'DYNAMIC',
'cf-ray': '877c5ba83ad621e3-KHI',
connection: 'keep-alive',
'content-length': '203',
'content-type': 'application/json',
date: 'Sun, 21 Apr 2024 09:30:54 GMT',
'openai-organization': 'user-gntjrfo4a4rpvvm5p9udpbnq',
'openai-processing-ms': '40',
'openai-version': '2020-10-01',
server: 'cloudflare',
'set-cookie': '__cf_bm=iKylCws.LiQAZjpYO7fLbZyeMgMRa8pUZT7aUFV6k9Q-1713691854-1.0.1.1-kKpI9bMcsYZXFTmzd2m5KozjqvGMkwwPYslFKJnFMLX.Fw4md0fCxEe0B0RWxPXenKhGQw6MkE7maRZ_osYOpg; path=/; expires=Sun, 21-Apr-24 10:00:54 GMT; domain=.api.openai.com; HttpOnly; Secure; SameSite=None, _cfuvid=DFu1pwBHgbgfvXVgiE_thT8EI4OpFrDNR6GdEkJB8zA-1713691854483-0.0.1.1-604800000; path=/; domain=.api.openai.com; HttpOnly; Secure; SameSite=None',
'strict-transport-security': 'max-age=15724800; includeSubDomains',
'x-ratelimit-limit-requests': '500',
'x-ratelimit-limit-tokens': '300000',
'x-ratelimit-remaining-requests': '499',
'x-ratelimit-remaining-tokens': '299618',
'x-ratelimit-reset-requests': '120ms',
'x-ratelimit-reset-tokens': '76ms',
'x-request-id': 'req_669c8e2baa1c400655a23fd6ab91b696'
},
error: {
message: "'checkPrice' is not one of ['system', 'assistant', 'user', 'function'] - 'messages.8.role'",
type: 'invalid_request_error',
param: null,
code: null
Node.js v21.7.3

@MuhammadAdil-Developer
Copy link
Author

If someone can tell me how to set up these functions in the Gptservice file, I am waiting to yesterday! for someone to tell me.how i can resolve this

@djayanna
Copy link

If someone can tell me how to set up these functions in the Gptservice file, I am waiting to yesterday! for someone to tell me.how i can resolve this

change the first parameter to functionName followed by 'function' (role)
this.updateUserContext(functionName, 'function', functionResponse);
https://github.com/twilio-labs/call-gpt/blob/9968aded01823d23940f57c10b05b1aed779b780/services/gpt-service.js#L111

@Vri6500
Copy link

Vri6500 commented May 21, 2024

Thank you for your reply! It worked

@cweems
Copy link
Collaborator

cweems commented Jun 8, 2024

Fixed with #32

@cweems cweems closed this as completed Jun 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants