Model: “gpt-4-0125-preview”
I’m experimenting with function calling and I have defined a couple of functions:
- GetCurrentDateTime returns the current date / time in RFC3339 format
- GetPricesForMeteringPoint takes two parameters, one is the date to return prices for
In the system prompt I have included this information “Don’t guess what date it is today. Call a function to get the current date / time.”
The problem is that sometimes it calls the function to get the current date / time, but sometimes it just guesses a date. I have set Temperature to 0.0 for testing this.
Run 1 (correctly calling GetCurrentDateTime):
Q: What are my prices for grid rent?
Thinking…
GetChatCompletionsAsync completed in 5.1556814s. PromptTokens=1101 CompletionTokens=37 TotalTokens=1138.
A: To provide you with accurate information about your grid rent prices, I need the unique identifier for your electricity metering point. Could you please provide me with your metering point ID?
Q: X
Thinking…
GetChatCompletionsAsync completed in 3.0439931s. PromptTokens=1111 CompletionTokens=14 TotalTokens=1125.
[ Calling function GetCurrentDateTime() ]
[ Adding the result from the function call (20 bytes) to the chat context. ]
Thinking…
GetChatCompletionsAsync completed in 5.8911798s. PromptTokens=1129 CompletionTokens=35 TotalTokens=1164.
[ Calling function GetPricesForMeteringPoint(“X”, “2024-03-06”) ]
[ Adding the result from the function call (29138 bytes) to the chat context. ]
Thinking…
GetChatCompletionsAsync completed in 27.4985586s. PromptTokens=9693 CompletionTokens=237 TotalTokens=9930.
Run 2: (guessing date):
Q: What are my prices for grid rent?
Thinking…
GetChatCompletionsAsync completed in 6.5411176s. PromptTokens=1101 CompletionTokens=37 TotalTokens=1138.
A: To provide you with accurate information about your grid rent prices, I need the unique identifier for your electricity metering point. Could you please provide me with your metering point ID?
Q: X
Thinking…
GetChatCompletionsAsync completed in 5.1242311s. PromptTokens=1111 CompletionTokens=35 TotalTokens=1146.
[ Calling function GetPricesForMeteringPoint(“X”, “2023-04-14”) ]
[ Adding the result from the function call (29020 bytes) to the chat context. ]
Thinking…
GetChatCompletionsAsync completed in 50.6275093s. PromptTokens=9621 CompletionTokens=467 TotalTokens=10088.
How can I get it to always call GetCurrentDateTime and avoid the guessing?