File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed
articles/cognitive-services/openai/how-to Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -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