gorilla
gorilla copied to clipboard
[bug] Hosted Gorilla: MULTIPLE FUNCTIONS calls
Describe the bug I am using gorilla-openfunctions-v1 to allow multiple function calling but it calls just the first one in the list
To Reproduce Steps to reproduce the behavior: I tried the following code using LMStudio as inference for Gorilla on port 1234:
import openai
import urllib.parse
import json
# Query Gorilla server
def get_gorilla_response(prompt="", model="gorilla-openfunctions-v1", functions=[]):
openai.api_key = "EMPTY"
openai.api_base = "http://localhost:1234/v1"
try:
prompt = f'<<question>> {prompt} <<function>> {json.dumps(functions)}'
completion = openai.ChatCompletion.create(
model="gorilla-openfunctions-v1",
temperature=0.0,
messages=[{"role": "user", "content": prompt}],
functions=functions,
)
return completion.choices[0].message.content
except Exception as e:
print(e, model, prompt)
here the query:
#query = "Call me an Uber ride type confort in Rome hotel in 10 minutes"
query= "send a message to Jhon using the email [email protected] and tell him that I need some money to buy a gift"
functions = [
{
"name": "Uber Carpool",
"api_name": "uber.ride",
"description": "Find suitable ride for customers given the location, type of ride, and the amount of time the customer is willing to wait as parameters",
"parameters": [{"name": "loc", "description": "location of the starting place of the uber ride"}, {"name":"type", "enum": ["plus", "comfort", "black"], "description": "types of uber ride user is ordering"}, {"name": "time", "description": "the amount of time in minutes the customer is willing to wait"}]
},
{
"name": "Send Message",
"api_name": "send.message",
"description": "Send an email message to the destinatary",
"parameters": [{"name": "dest", "description": "email address, example [email protected]"}, {"name":"message", "description": "body of the message, here you have to summarize the content of the message to be sent"}]
}
]
get_gorilla_response(query, functions=functions)
I was expecting to call the function for sending a message
But i got:
'uber.ride(loc="LOCATION", type="TYPE", time=30)'
not able to reproduce
how to make multiple function call with "gorilla-openfunctions-v1"? Let's suppose we have a list function call:
- send email
- get weather condition for a location
Or simply reply to a question without involving a function call
Hi @HAL9KKK you got the solution for the multiple function?
Hi @CHIRU98 unfortunately not....I do not know why this multiple function feature is not working! @ShishirPatil can you please explain how to use your code to make 2 function calls and the LLM should understand how to classify the call based on the context?
- send email
- get weather condition for a location
The same problem, only one function can be called each time.
Hey @HAL9KKK were you able to solve this? I'm having the same problem..