Functions in the Assistant API Playground?

Hey All - I was reviewing the new playgrounds for the assistants and when creating a new one i do see an option in the playground UI to toggle “Functions”. That allows us to put in the function description JSON. I’m not clear however where one would put the actual python code for that function in the playground. Is that possible?

The cookbook document i looked at explains how to do this but with local code, not the playground.

2 Likes

Hi @Maxime1,

Welcome to the community.

IIRC, in this case, function calling is meant to be consumed on the machine that’s making the API calls to the Assistant’s API.

Based on the function definition(s) provided to the assistant, the model can choose when to call specific function(s) and the parameters to pass to the function. The function will then be executed on the machine that made the API call, and the function’s response may or may not be returned to the API in the next call.

That’s my understanding as well, which leaves me sort of puzzled as to what the toggle switch is for in the playground webui :slight_smile: I guess it works when you call the API from the machine but if you are only using it on the playground “threads” chat interface, it wont activate?

In my understanding, the playground assistants mode is a no-code UI to quickly build assistants and not to consume them.

That seems like that to me as well, although there is a way to consume / test them in the playground but that seems limited to text input / response.

1 Like

In the same vein, the playground has an “upload file” functionality that seems to work properly. But then I can’t seem to get the assistant model to retrieve that file from playground. Not sure if that’s just me not using it properly.

Edit - this seems to not work both if a file is uploaded ahead of time in the agent by clicking the little “upload” button or if one uses the little paperclip attachment to add a new message to the thread. In both cases the model responds that it is unable to retrieve the file.

1 Like

In my case it throws an error telling me that the file extension I’m uploading is not supported while including the exact extension in the list of supported file extensions.

There was an error uploading the file FileManager.ts: Invalid file format. Supported formats: [‘c’, ‘cpp’, ‘csv’, ‘docx’, ‘html’, ‘java’, ‘json’, ‘md’, ‘pdf’, ‘php’, ‘pptx’, ‘py’, ‘rb’, ‘tex’, ‘txt’, ‘css’, ‘jpeg’, ‘jpg’, ‘js’, ‘gif’, ‘png’, ‘tar’, ‘ts’, ‘xlsx’, ‘xml’, ‘zip’]

It’s a bug that I believe will be sorted in due time.

Did you enable retrieval while creating the assistant?

1 Like

I did enable retrieval yes. Enabled everything really as I am going through each of them and testing. The file I tested was HTML so I did not encounter the filetype error. It just said “it seems that the content of the html file is still not being displayed”. Then suggested I paste it inline.

In the playground assistants mode, I uploaded a python file that containd a class and some functions. Then in the intstructions I identified the file (not by title but by the alphanumeric code given to it by the playground). Additionally, I used the instructions field to say that in the file was a class and which functions I expected to use.

When I tested the queries, the class and function were loaded and it processed the data I had added in the query, using my function.

2 Likes