Skip to content

Commit 692943d

Browse files
authored
Update dall-e-go.md
Update code to azure-sdk-for-go/sdk/ai/azopenai 0.5.0
1 parent 8c9c03e commit 692943d

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

articles/ai-services/openai/includes/dall-e-go.md

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ import (
6565
"os"
6666

6767
"github.com/Azure/azure-sdk-for-go/sdk/ai/azopenai"
68+
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
6869
"github.com/Azure/azure-sdk-for-go/sdk/azcore/to"
6970
)
7071

@@ -79,19 +80,15 @@ func main() {
7980
return
8081
}
8182

82-
keyCredential, err := azopenai.NewKeyCredential(azureOpenAIKey)
83-
84-
if err != nil {
85-
// handle error
86-
}
83+
keyCredential := azcore.NewKeyCredential(azureOpenAIKey)
8784

8885
client, err := azopenai.NewClientWithKeyCredential(azureOpenAIEndpoint, keyCredential, nil)
8986

9087
if err != nil {
9188
// handle error
9289
}
9390

94-
resp, err := client.CreateImage(context.TODO(), azopenai.ImageGenerationOptions{
91+
resp, err := client.GetImageGenerations(context.TODO(), azopenai.ImageGenerationOptions{
9592
Prompt: to.Ptr("a painting of a cat in the style of Dali"),
9693
ResponseFormat: to.Ptr(azopenai.ImageGenerationResponseFormatURL),
9794
}, nil)

0 commit comments

Comments
 (0)