Custom API - Json body json parameters not quoted

Hi.
New here today, what a find! Make looks like it is going to save me a lot of time. Just one hiccup so far:
I have created a webhook which calls a custom HTTP module (to front a call to openai). When I refer to the incoming form values they are not quoted and so the call fails as it is not value json:

{
“model”: “gpt-4”,
“messages”: [
{
“role”: “system”,
“content”: {{1.SystemPrompt}}
},
{
“role”: “user”,
“content”: {{1.UserPrompt}}
}
],

}

Results in this in the logs for the HTTP module:

Request contentLong String
{
“model”: “gpt-4”,
“messages”: [
{
“role”: “system”,
“content”: You are a helpful assistant
},
{
“role”: “user”,
“content”: tell me about Manchester, England
}

}

Note the lack of quotes around the two variable strings.

I tried quoting the variables, but if course, that then prints out the string literally (“1.SystemPrompt”). This must be a common issue, whats the solution?

Cheers

Kevin

Welcome to the Make community!

You simply need to manually insert double quotes before and after your mapped variables in the JSON.

"{{1.SystemPrompt}}"

"{{1.UserPrompt}}"

Why not simply use the OpenAI “Create a Completion (Prompt)” module instead?

Creates a completion for a prompt or chat.

Then, you won’t have to manually build the JSON request.

For more information, see https://www.make.com/en/integrations/openai-gpt-3, and https://www.make.com/en/help/app/openai-gpt-3 in the help centre.

Hope this helps! Let me know if there are any further questions or issues.

@samliew

P.S.: Investing some effort into the Make Academy will save you lots of time and frustration using Make.