┌────┐ ┌───────┐ ┌──────┐ ┌──────┐ │User│ │ChatBot│ │OpenAI│ │3rdAPI│ └──┬─┘ └───┬───┘ └───┬──┘ └───┬──┘ │ "What is the weather in Boston?" │ │ │ │───────────────────────────────────────────────────>│ │ │ │ │ │ │ │ │ Chat Function Calling │ │ │ │─────────────────────────────────────────────────────────────────────────────────────────────────────────────>│ │ │ │ │ │ │ │ get_weather, location=Boston. │ │ │ │<─────────────────────────────────────────────────────────────────────────────────────────────────────────────│ │ │ │ │ │ │ │ Call get_weather("Boston") │ │ │ │────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────>│ │ │ │ │ │ │ Get the result ("Boston weather is 22 degrees Celsius.") │ │ │ │<────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────│ │ │ │ │ │ │ Send the response back to the model to summarize. │ │ │ │─────────────────────────────────────────────────────────────────────────────────────────────────────────────>│ │ │ │ │ │ │ │"The weather in Boston is currently sunny with a temperature of 22 degrees Celsius.", "finish_reason": "stop" │ │ │ │<─────────────────────────────────────────────────────────────────────────────────────────────────────────────│ │ │ │ │ │ │if "finish_reason": "stop" --> Pass result to user. │ │ │ │<───────────────────────────────────────────────────│ │ │ ┌──┴─┐ ┌───┴───┐ ┌───┴──┐ ┌───┴──┐ │User│ │ChatBot│ │OpenAI│ │3rdAPI│ └────┘ └───────┘ └──────┘ └──────┘