How to used External Url Api

From the gpt assistant API used I want to send a value like this:

I’m chatting with the creator of the new assistant thread api system (This system answers the question about adding playground pdf (RAG))

If the user asks the tour name or the tour area plan, the pdf answers the tour title of the tour according to the information, then when this user asks the price of the gpt tour, this system sends the gpt tour code to another url.

Example scenario
User: I want to see the list of Paris tours
gpt assistant:tur litse as below
1- Paris 3 nights tour code 957
2- BLACK SEA 5 NIGHTS tour code 57

User: What is the price of the tour?
gpt assistant: Can you give me the tour code?

User: I want to learn this tour code 957
gpt ok I check
(gpt sends this tour code to another url (from That url value is returned to gpt

How can I add this external api to my assistant in the add function section from the playground section?

Help me please

I don’t understand what the function calls gpt and why it is used

I would extract all the content of the website in a file and attach it to the assistant for file search!

I don’t think I would use function call if you don’t have a specific api endpoint!

First of all, thank you for your return.

but I need to send to another website url. And by the way, I have some documents in GPT. When I ask a question about them, he answers. If he wants the price of this information, I have to send the tour id to another API (website) and show the value of that tour id to the gpt assistant bot.

The API cannot connect with the internet. It can only emit AI-produced language back to you.

You will need to code a function-call handler that receives the AI response and arguments, and then makes the API network call to the service. Your code shim then not only translates the AI-emitted parameters into actual API call parameters, but also processes the return from the API, and places it with natural language that can be understood by the AI as a new message added and re-ran.

AI designed to answer your needs:

Here’s a tool specification for the external pricing data retrieval API. This specification includes a function that the AI can call to retrieve the most current price of a tour by sending the tour ID to the specified external API.

toolspec = []

    "type": "function",
    "function": {
        "name": "get_tour_price",
        "description": "Retrieves the current price of a tour by sending the tour ID to an external API.",
        "parameters": {
            "type": "object",
            "properties": {
                "tour_id": {
                    "type": "string",
                    "description": "The unique identifier of the tour."
            "required": ["tour_id"]

Usage Explanation

  1. get_tour_price: This function is designed to retrieve the current price of a tour. It accepts a single parameter, tour_id, which is the unique identifier of the tour. When called, this function will send the tour_id to an external API to get the latest pricing information.

With this specification, the AI will be able to respond to user inquiries regarding the price of a tour by calling this function with the appropriate tour ID and fetching the latest price from the external API.

You will have to write the code to capture the tool_call and arguments returned from the OpenAI API, and then handle sending to the pricing API.

1 Like

This was a very clear explanation. Well, I want to examine my code. Can you tell me what I’m missing and how to fix it? Please, I wrote a similar function to this function from an external Python code. I redirected the tour id I got from there. I took another url and the answer there was gpt. Can you check my code and the playground system and see if I’m doing it right?

my python code

my playground window