Skip to content
OpenAI Assistants w...
 
Notifications
Clear all

OpenAI Assistants with Function Calling

4 Posts
3 Users
0 Reactions
4 Views
PaulBack
(@paulback)
Posts: 2
New Member
Topic starter
 

Hi,

I'm hoping someone can offer some assistance. I'm looking for information regarding function calling with the V2 Assistants API. In the function/tool configuration, it requests a function/tool URL. However, there isn't much guidance available on how to create this.

My assumption is that it requires a new scenario set up with a webhook, which then forwards the request to an API POST call. But I'm unsure about the specific data that needs to be passed. My understanding is that outside the OpenAI platform, you need to pass IDs to the chat so it can submit to the correct thread.

Can anyone provide some insight? I'm really stuck on this.

 
Posted : 15/09/2024 6:21 pm
LinkYourTech
(@linkyourtech)
Posts: 15
Active Member
 

Here is the documentation that will guide you on how to begin with function calling.
https://platform.openai.com/docs/guides/function-calling

Hope this assists!

 
Posted : 15/09/2024 8:31 pm
PaulBack
(@paulback)
Posts: 2
New Member
Topic starter
 

Hi, that document helps with building the API through my own cloud functions, however, it doesn't really cover the callin.io setup, or am I missing something?

Just to be clear, I have the functions in the assistant setup. On my JS-based API, I can make it work because it handles the function code within the assistant code.

I want to use the functions with the assistant in callin.io, but it asks for a URL for each function. This is different from how OpenAI handles it.

 
Posted : 15/09/2024 9:38 pm
Darin_Patterson
(@darin_patterson)
Posts: 6
Active Member
 

Hi Paul,

I can offer some detailed insights into how this module functions. Additionally, others have shared helpful overviews on setting this up here and here.

Essentially, this callin.io module goes “above and beyond” what a typical callin.io module might do. The following occurs if you input a URL into the field for each function your Assistant has configured.

  1. The module initially retrieves information about the assistant.
  2. Then, it creates a thread with the assistant, adds new messages, and runs the thread.
  3. It then continuously monitors the status of the run until it is either completed or requires action.
  4. “Requires action” signifies that the assistant has responded with one or more functions that need to be called, using some JSON structure generated by the assistant.
  5. callin.io will then actually invoke the URL you specified for that function, passing in the JSON generated by the assistant. That URL could technically be any URL globally, but it's quite practical for the URL to be a callin.io webhook URL, enabling the use of that data to return some data via a webhook response.

Note: While it might seem a bit counterintuitive, the webhook response should return data as plain text (not with content-type application/json). This is the expected format by OpenAI’s assistant API. (e.g., your response should be either text or stringified JSON).

  1. callin.io will then take the response provided by those URLs and submit it to the Assistant API as “tool outputs”. This will re-queue the run, and callin.io will continue to check the run's status until the run is either complete or requires additional functions (steps 3 through 7 will loop as needed).
  2. Once the run is “complete”, callin.io will retrieve the final response from the Assistant API.

What this means in simple terms:

  • This module represents one of the most straightforward methods within callin.io to implement agentic behavior, where an LLM determines the appropriate processes to invoke based on its own logic.
  • You can leverage callin.io scenarios to provide tools for your agent (these can range from querying a CRM to dispatching emails).
  • callin.io has incorporated complex logic within this module to manage the intricacies of *potentially invoking* different functions based on the API's response. (Quite impressive).
  • A small word of caution – this capability is exceptionally powerful. And with great power comes great responsibility. These functions can perform any action if the Assistant deems it necessary. You could inadvertently send out emails with content you might not be comfortable with very quickly :wink: .

Hopefully, this is helpful. Cheers.

 
Posted : 06/01/2025 5:36 pm
Share: