File tree Expand file tree Collapse file tree 1 file changed +24
-1
lines changed
articles/cognitive-services/openai/how-to Expand file tree Collapse file tree 1 file changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ manager: nitinme
7
7
ms.service : cognitive-services
8
8
ms.subservice : openai
9
9
ms.topic : how-to
10
- ms.date : 6/24/2022
10
+ ms.date : 5/9/2023
11
11
author : ChrisHMSFT
12
12
ms.author : chrhoder
13
13
recommendations : false
@@ -46,6 +46,29 @@ response = openai.Embedding.create(
46
46
embeddings = response[' data' ][0 ][' embedding' ]
47
47
print (embeddings)
48
48
```
49
+
50
+ # [ C#] ( #tab/csharp )
51
+ ``` csharp
52
+ using Azure ;
53
+ using Azure .AI .OpenAI ;
54
+
55
+ Uri oaiEndpoint = new (" https://YOUR_RESOURCE_NAME.openai.azure.com" );
56
+ string oaiKey = " YOUR_API_KEY" ;
57
+
58
+ AzureKeyCredential credentials = new (oaiKey );
59
+
60
+ OpenAIClient openAIClient = new (oaiEndpoint , credentials );
61
+
62
+ EmbeddingsOptions embeddingOptions = new (" Your text string goes here" );
63
+
64
+ var returnValue = openAIClient .GetEmbeddings (" YOUR_DEPLOYMENT_NAME" , embeddingOptions );
65
+
66
+ foreach (float item in returnValue .Value .Data [0 ].Embedding )
67
+ {
68
+ Console .WriteLine (item );
69
+ }
70
+ ```
71
+
49
72
---
50
73
51
74
## Best Practices
You can’t perform that action at this time.
0 commit comments