#Can chat completion functions chain from each other? Output from one into the next, in a single go?
10 messages · Page 1 of 1 (latest)
If your request is set to FunctionCall=auto, it decides whether to call a followup function or respond to the user, after you give it the results of the first one.
It is expected that you repeatedly query it for a response until it gives a non function response, and only then can the user give their next input
Well, I was more so thinking of providing a series of functions to act as a pipeline. Often times a single function is not granular enough. I suppose I'll have to find an alternative way to do that.
You can show it only functions that are available from its current state (also saves tokens)
i was only using post requests.. are you talking about the sdk? does the sdk allow you to save tokens in that way? i wasn't aware. 
It is totally possible to chain function calls. It is totally possible to chain function calls. Here is a good example.
User: Turn on the light of the living room, take a picture, and turn it off
FunctionCall: control_light(location=living room, switch=on)
FunctionCall: take_picture(location=living room)
FunctionCall: control_light(location=living room, switch=off)
Assistant: I have turned on the light of the living room, taken a picture, and turned off the light. Is there anything else I can help you with?
This is a part of open source project, SlashGPT. Please take a look.
@misty heath this is all within the same request?
No. You need to make a ChatCompletion request after each function call, by appending the return value from the function in following format.
messages.append({
"role":"function",
"content":return_value_from_function,
"name":function_name })
gotcha, makes sense, i was hoping there were a way, it would be pretty cool, i often find myself creating pipelines for data
Hey!
Kinda got the same question but may need some help. I'm currently trying to use GPT to manage my google calendar. But to update an event I would need the correct eventID. I made a function to get the the eventIDs in a given timeframe. Now I want GPT to choose the right event and then update it. Any idea on how to realize that?
def updateEvent(self, lookUpDate, eventID = None, lookUpTime = "00:00", calendar_id='primary', title=None, startDate=None, startTime=None, endDate=None, endTime=None, location=None, attendees=None): [...] if eventID is not None: [...] return "The event {title} has successfully been ." else: [...] if events is not None: for event in events: [...] event_strs.append(f"ID {event['id']} with {event['summary']} from {start} till {end}") return { "content": "FUpcoming events are: " + ", ".join(event_strs), "function_call": { "name": "updateEvent", "arguments": {"eventID": "ID of the event to update"} } } else: return "There are no upcoming events."
(handling the text returns somewhere else)