Skip to content

Commit b7a3e7b

Browse files
committed
update
1 parent 800154a commit b7a3e7b

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

articles/ai-services/openai/includes/chat-go.md

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ ms.service: azure-ai-openai
77
ms.topic: include
88
author: mrbullwinkle
99
ms.author: mbullwin
10-
ms.date: 08/30/2023
10+
ms.date: 06/30/2024
1111
---
1212

1313
[Source code](https://github.com/Azure/azure-sdk-for-go/tree/main/sdk/ai/azopenai) | [Package (Go)](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/ai/azopenai)| [Samples](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/ai/azopenai#pkg-examples)
@@ -47,6 +47,8 @@ import (
4747
func main() {
4848
azureOpenAIKey := os.Getenv("AZURE_OPENAI_API_KEY")
4949
modelDeploymentID := os.Getenv("YOUR_MODEL_DEPLOYMENT_NAME")
50+
maxTokens:= int32(400)
51+
5052

5153
// Ex: "https://<your-azure-openai-host>.openai.azure.com"
5254
azureOpenAIEndpoint := os.Getenv("AZURE_OPENAI_ENDPOINT")
@@ -81,7 +83,7 @@ func main() {
8183
&azopenai.ChatRequestAssistantMessage{Content: to.Ptr("Yes, customer managed keys are supported by Azure OpenAI")},
8284

8385
// The user answers the question based on the latest reply.
84-
&azopenai.ChatRequestUserMessage{Content: azopenai.NewChatRequestUserMessageContent("What's the best way to train a parrot?")},
86+
&azopenai.ChatRequestUserMessage{Content: azopenai.NewChatRequestUserMessageContent("What other Azure Services support customer managed keys?")},
8587

8688
// from here you'd keep iterating, sending responses back from ChatGPT
8789
}
@@ -93,6 +95,7 @@ func main() {
9395
// NOTE: all messages count against token usage for this API.
9496
Messages: messages,
9597
DeploymentName: &modelDeploymentID,
98+
MaxTokens: &maxTokens,
9699
}, nil)
97100

98101
if err != nil {
@@ -128,7 +131,7 @@ func main() {
128131
}
129132

130133
if gotReply {
131-
fmt.Fprintf(os.Stderr, "Got chat completions reply\n")
134+
fmt.Fprintf(os.Stderr, "Received chat completions reply\n")
132135
}
133136

134137
}
@@ -154,7 +157,21 @@ go run chat_completions.go
154157
## Output
155158

156159
```output
157-
Content[0]: Yes, many Azure AI services also support customer managed keys. These services enable you to bring your own encryption keys for data at rest, which provides you with more control over the security of your data.
160+
Content filter results
161+
Hate: sev: safe, filtered: false
162+
SelfHarm: sev: safe, filtered: false
163+
Sexual: sev: safe, filtered: false
164+
Violence: sev: safe, filtered: false
165+
Content[0]: As of my last update in early 2023, in Azure, several AI services support the use of customer-managed keys (CMKs) through Azure Key Vault. This allows customers to have control over the encryption keys used to secure their data at rest. The services that support this feature typically fall under Azure's range of cognitive services and might include:
166+
167+
1. Azure Cognitive Search: It supports using customer-managed keys to encrypt the index data.
168+
2. Azure Form Recognizer: For data at rest, you can use customer-managed keys for added security.
169+
3. Azure Text Analytics: CMKs can be used for encrypting your data at rest.
170+
4. Azure Blob Storage: While not exclusively an AI service, it's often used in conjunction with AI services to store data, and it supports customer-managed keys for encrypting blob data.
171+
172+
Note that the support for CMKs can vary by service and sometimes even by the specific feature within the service. Additionally, the landscape of cloud services is fast evolving, and new features, including security capabilities, are frequently added. Therefore, it's recommended to check the latest Azure documentation or contact Azure support for the most current information about CMK support for any specific Azure AI service.
173+
Finish reason[0]: stop
174+
Received chat completions reply
158175
```
159176

160177
## Clean up resources

0 commit comments

Comments
 (0)