Home » OpenAI GPT-4 and GPT-3.5-Turbo Updates: Cheaper and Bigger Context | by Jim Clyde Monge | Jun, 2023

OpenAI GPT-4 and GPT-3.5-Turbo Updates: Cheaper and Bigger Context | by Jim Clyde Monge | Jun, 2023

by Narnia
0 comment

Function calling permits builders to explain features to the mannequin and have it intelligently select to output a JSON object containing arguments to name these features.

This is a brand new strategy to extra reliably join GPT’s capabilities with exterior instruments and APIs.

Here’s an instance:

{
"mannequin": "gpt-3.5-turbo-0613",
"messages": [
{"role": "user", "content": "Send Jim an email asking for a coffee date?"}
],
"features": [
{
"name": "send_email",
"description": "Please send an email.",
"parameters": {
"type": "object",
"properties": {
"to_address": {
"type": "string",
"description": "To address for email"
},
"subject": {
"type": "string",
"description": "subject of the email"
},
"body": {
"type": "string",
"description": "Body of the email"
}
}
}
}
]
}

I despatched the POST request by way of Postman; you may attempt it out for your self right here.

Image by Jim Clyde Monge

This is the response I acquired from the mannequin in JSON format.

{
"id": "chatcmpl-7RATyvNoqYlbkoeffEkIEbXUL7zqW",
"object": "chat.completion",
"created": 1686709506,
"mannequin": "gpt-3.5-turbo-0613",
"selections": [
{
"index": 0,
"message": {
"role": "assistant",
"content": null,
"function_call": {
"name": "send_email",
"arguments": "{n "to_address": "[email protected]",n "subject": "Coffee Date",n "body": "Hi Jim,nnI hope you're doing well. I was wondering if you'd be available for a coffee date sometime this week. It would be great to catch up!nnLet me know what works for you.nnBest regards,n[Your Name]"n}"
}
},
"finish_reason": "function_call"
}
],
"utilization": {
"prompt_tokens": 81,
"completion_tokens": 88,
"total_tokens": 169
}
}

Pretty cool, proper?

This structured response basically permits the AI to execute operate calls in response to person inputs, paving the best way for extra environment friendly and interactive AI purposes.

The major use instances for this characteristic are:

  • Create chatbots that reply questions by calling exterior instruments (e.g., ChatGPT Plugins)
  • Convert pure language queries into structured JSON knowledge
  • Extract structured knowledge from textual content

You may also like

Leave a Comment