You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
message:=openai.NewMessage("user", "What will the weather be like in Berlin tomorrow?")
39
-
response, err:=client.Chat([]*openai.Message{message}, openai.OptFunction("get_weather", "Get the weather in a specific city and country", openai.ToolParameter{
40
-
Name: "city",
41
-
Type: "string",
42
-
Description: "The city to get the weather for",
43
-
Required: true,
44
-
}, openai.ToolParameter{
45
-
Name: "country",
46
-
Type: "string",
47
-
Description: "The country to get the weather for",
48
-
Required: true,
49
-
}, openai.ToolParameter{
50
-
Name: "time",
51
-
Type: "string",
52
-
Description: "When to get the weather for. If not specified, defaults to the current time",
53
-
Required: true,
54
-
}))
41
+
message:=schema.NewMessage("user", "What will the weather be like in Berlin tomorrow?")
42
+
assert.NotNil(message)
43
+
44
+
get_weather:=schema.NewTool("get_weather", "Get the weather in a specific city and country")
45
+
assert.NotNil(get_weather)
46
+
assert.NoError(get_weather.Add("city", "The city to get the weather for", true, reflect.TypeOf("string")))
47
+
assert.NoError(get_weather.Add("country", "The country to get the weather for", true, reflect.TypeOf("string")))
48
+
assert.NoError(get_weather.Add("time", "When to get the weather for. If not specified, defaults to the current time", true, reflect.TypeOf("string")))
message:=openai.NewMessage("user", "What is in this image").AppendImageUrl("https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg")
images, err:=client.CreateImages("A painting of a cat in the style of Salvador Dali", openai.OptResponseFormat("b64_json"), openai.OptCount(1))
35
+
images, err:=client.CreateImages(context.Background(), "A painting of a cat in the style of Salvador Dali", openai.OptResponseFormat("b64_json"), openai.OptCount(1))
images, err:=client.CreateImages("A painting of a cat in the style of Van Gogh", openai.OptResponseFormat("url"), openai.OptCount(1))
64
+
images, err:=client.CreateImages(context.Background(), "A painting of a cat in the style of Van Gogh", openai.OptResponseFormat("url"), openai.OptCount(1))
0 commit comments