@@ -70,44 +70,40 @@ func main() {
7070	}
7171}
7272
73- var  tools  =  []openai.ChatCompletionToolParam {
74- 	{
75- 		Function : openai.FunctionDefinitionParam {
76- 			Name :        "get_live_weather" ,
77- 			Description : openai .String ("Get weather at the given location" ),
78- 			Parameters : openai.FunctionParameters {
79- 				"type" : "object" ,
80- 				"properties" : map [string ]interface {}{
81- 					"location" : map [string ]string {
82- 						"type" : "string" ,
83- 					},
73+ var  tools  =  []openai.ChatCompletionToolUnionParam {
74+ 	openai .ChatCompletionFunctionTool (openai.FunctionDefinitionParam {
75+ 		Name :        "get_live_weather" ,
76+ 		Description : openai .String ("Get weather at the given location" ),
77+ 		Parameters : openai.FunctionParameters {
78+ 			"type" : "object" ,
79+ 			"properties" : map [string ]any {
80+ 				"location" : map [string ]string {
81+ 					"type" : "string" ,
8482				},
85- 				"required" : []string {"location" },
8683			},
84+ 			"required" : []string {"location" },
8785		},
88- 	},
89- 	{
90- 		Function : openai.FunctionDefinitionParam {
91- 			Name :        "get_population" ,
92- 			Description : openai .String ("Get population of a given town" ),
93- 			Parameters : openai.FunctionParameters {
94- 				"type" : "object" ,
95- 				"properties" : map [string ]interface {}{
96- 					"town" : map [string ]string {
97- 						"type" : "string" ,
98- 					},
99- 					"nation" : map [string ]string {
100- 						"type" : "string" ,
101- 					},
102- 					"rounding" : map [string ]string {
103- 						"type" :        "integer" ,
104- 						"description" : "Nearest base 10 to round to, e.g. 1000 or 1000000" ,
105- 					},
86+ 	}),
87+ 	openai .ChatCompletionFunctionTool (openai.FunctionDefinitionParam {
88+ 		Name :        "get_population" ,
89+ 		Description : openai .String ("Get population of a given town" ),
90+ 		Parameters : openai.FunctionParameters {
91+ 			"type" : "object" ,
92+ 			"properties" : map [string ]any {
93+ 				"town" : map [string ]string {
94+ 					"type" : "string" ,
95+ 				},
96+ 				"nation" : map [string ]string {
97+ 					"type" : "string" ,
98+ 				},
99+ 				"rounding" : map [string ]string {
100+ 					"type" :        "integer" ,
101+ 					"description" : "Nearest base 10 to round to, e.g. 1000 or 1000000" ,
106102				},
107- 				"required" : []string {"town" , "nation" },
108103			},
104+ 			"required" : []string {"town" , "nation" },
109105		},
110- 	},
106+ 	}) ,
111107}
112108
113109// Mock function to simulate weather data retrieval 
0 commit comments