Skip to content

Commit 2b3be35

Browse files
committed
add code from Dan's branch
1 parent f8348c5 commit 2b3be35

File tree

2 files changed

+33
-12
lines changed

2 files changed

+33
-12
lines changed

.openpublishing.publish.config.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,12 @@
110110
"branch": "dantaylo/nov2024",
111111
"branch_mapping": {}
112112
},
113+
{
114+
"path_to_root": "azureai-samples-csharp",
115+
"url": "https://github.com/Azure-Samples/azureai-samples",
116+
"branch": "dantaylo/csharp",
117+
"branch_mapping": {}
118+
},
113119
{
114120
"path_to_root": "azureml-examples-main",
115121
"url": "https://github.com/azure/azureml-examples",

articles/ai-studio/how-to/develop/sdk-overview.md

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -85,23 +85,20 @@ project = await AIProjectClient.from_connection_string(
8585

8686
::: zone pivot="programming-language-csharp"
8787

88-
```bash
88+
```dotnet
8989
dotnet add package Azure.AI.Projects
90+
dotnet add package Azure.Identity
9091
```
9192

9293
Create a project client in code:
9394

9495
# [Sync](#tab/sync)
9596

96-
```csharp
97-
98-
```
97+
:::code language="csharp" source="~/azureai-samples-csharp/csharp/scenarios/projects/basic-csharp/Program.cs" id="snippet_get_project":::
9998

10099
# [Async](#tab/async)
101100

102-
```csharp
103-
104-
```
101+
Not yet available in C#.
105102

106103
::: zone-end
107104

@@ -148,14 +145,18 @@ response = openai.chat.completions.create(
148145
print(response.choices[0].message.content)
149146
```
150147

151-
If you’re already using the [Azure OpenAI SDK](../../../ai-services/openai/chatgpt-quickstart.md) directly against the Azure OpenAI Service, the project provides a convenient way to use Azure OpenAI Service capabilities alongside the rest of the AI Foundry capabilities.
152-
153148
::: zone-end
154149

155150
::: zone pivot="programming-language-csharp"
156151

152+
If you have existing code that uses the OpenAI SDK, you can use the project client to create an `AzureOpenAI` client that uses your project's Azure OpenAI connection:
153+
154+
:::code language="csharp" source="~/azureai-samples-csharp/csharp/scenarios/projects/basic-csharp/Program.cs" id="azure_openai":::
155+
157156
::: zone-end
158157

158+
If you’re already using the [Azure OpenAI SDK](../../../ai-services/openai/chatgpt-quickstart.md) directly against the Azure OpenAI Service, the project provides a convenient way to use Azure OpenAI Service capabilities alongside the rest of the AI Foundry capabilities.
159+
159160
## Azure AI model inference service
160161

161162
The [Azure AI model inference service](/azure/ai-studio/ai-services/model-inference) offers access to powerful models from leading providers like OpenAI, Microsoft, Meta, and more. These models support tasks such as content generation, summarization, and code generation.
@@ -170,7 +171,7 @@ Install the `azure-ai-inferencing` client library:
170171
pip install azure-ai-inference
171172
```
172173

173-
You can use the project client to get a configured and authenticated ```ChatCompletionsClient``` or ```EmbeddingsClient```:
174+
You can use the project client to get a configured and authenticated `ChatCompletionsClient` or `EmbeddingsClient`:
174175

175176
```Python
176177
# get an chat inferencing client using the project's default model inferencing endpoint
@@ -192,6 +193,13 @@ print(response.choices[0].message.content)
192193

193194
::: zone pivot="programming-language-csharp"
194195

196+
```csharp
197+
dotnet add package Azure.AI.Inference
198+
```
199+
You can use the project client to get a configured and authenticated `ChatCompletionsClient` or `EmbeddingsClient`:
200+
201+
:::code language="csharp" source="~/azureai-samples-csharp/csharp/scenarios/projects/basic-csharp/Program.cs" id="snippet_inference":::
202+
195203
::: zone-end
196204

197205
You can change the model name to any model that you deployed to the inference service or Azure OpenAI service.
@@ -275,10 +283,10 @@ response = chat.complete(
275283

276284
If you have an Azure AI Search resource connected to your project, you can also use the project client to create an Azure AI Search client using the project connection.
277285

278-
::: zone pivot="programming-language-python"
279-
280286
Install the Azure AI Search client library:
281287

288+
::: zone pivot="programming-language-python"
289+
282290
```bash
283291
pip install azure-search-documents
284292
```
@@ -314,6 +322,13 @@ search_client = SearchClient(
314322

315323
::: zone pivot="programming-language-csharp"
316324

325+
```dotnet
326+
dotnet add package Azure.Search.Documents
327+
```
328+
Instantiate the search and/or search index client as desired:
329+
330+
:::code language="csharp" source="~/azureai-samples-csharp/csharp/scenarios/projects/basic-csharp/Program.cs" id="azure_aisearch":::
331+
317332
::: zone-end
318333

319334
To learn more about using Azure AI Search, check out [Azure AI Search documentation](/azure/search/).

0 commit comments

Comments
 (0)