You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Update quickstart to use the Microsoft Extensions AI library
Co-authored-by: Genevieve Warren <[email protected]>
---------
Co-authored-by: Genevieve Warren <[email protected]>
Copy file name to clipboardExpand all lines: docs/ai/quickstarts/get-started-openai.md
+5-6Lines changed: 5 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -48,7 +48,7 @@ Get started with OpenAI and [Semantic Kernel](../semantic-kernel-dotnet-overview
48
48
49
49
1. To provision an Azure OpenAI service and model using the Azure CLI, complete the steps in the [Create and deploy an Azure OpenAI Service resource](/azure/ai-services/openai/how-to/create-resource?pivots=cli) article.
50
50
51
-
1. From a terminal or command prompt, navigate to the `src\quickstarts\azure-openai\02-HikerAI` directory.
51
+
1. From a terminal or command prompt, navigate to the `src\quickstarts\azure-openai\semantic-kernel\02-HikerAI` directory.
52
52
53
53
1. Run the following commands to configure your OpenAI API key as a secret for the sample app:
54
54
@@ -60,7 +60,7 @@ Get started with OpenAI and [Semantic Kernel](../semantic-kernel-dotnet-overview
60
60
61
61
1. To provision an Azure OpenAI service and model using the Azure portal, complete the steps in the [Create and deploy an Azure OpenAI Service resource](/azure/ai-services/openai/how-to/create-resource?pivots=web-portal) article.
62
62
63
-
1. From a terminal or command prompt, navigate to the `src\quickstarts\azure-openai\02-HikerAI` directory.
63
+
1. From a terminal or command prompt, navigate to the `src\quickstarts\azure-openai\semantic-kernel\02-HikerAI` directory.
64
64
65
65
1. Run the following commands to configure your OpenAI API key as a secret for the sample app:
66
66
@@ -77,7 +77,7 @@ Get started with OpenAI and [Semantic Kernel](../semantic-kernel-dotnet-overview
77
77
<!-- markdownlint-disable MD029 MD044 -->
78
78
:::zone target="docs" pivot="openai"
79
79
80
-
1. From a terminal or command prompt, navigate to the `openai\02-HikerAI` directory.
80
+
1. From a terminal or command prompt, navigate to the `src\quickstarts\azure-openai\semantic-kernel\02-HikerAI` directory.
81
81
82
82
1. Run the following commands to configure your OpenAI API key as a secret for the sample app:
83
83
@@ -96,7 +96,7 @@ Get started with OpenAI and [Semantic Kernel](../semantic-kernel-dotnet-overview
96
96
97
97
:::zone target="docs" pivot="azure-openai"
98
98
99
-
1. From a terminal or command prompt, navigate to the `azure-openai\02-HikerAI` directory.
99
+
1. From a terminal or command prompt, navigate to the `semantic-kernel\02-HikerAI` directory.
100
100
101
101
2. Use the `dotnet run`command to run the app:
102
102
@@ -147,14 +147,13 @@ The entire application is contained within the **Program.cs** file. The first se
147
147
var config = new ConfigurationBuilder().AddUserSecrets<Program>().Build();
Copy file name to clipboardExpand all lines: docs/ai/quickstarts/includes/clone-sample-repo.md
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,9 @@ ms.date: 07/03/2024
5
5
ms.topic: include
6
6
---
7
7
8
-
Clone the GitHub repository that contains the sample apps for all of the quickstarts:
8
+
## Clone the sample repository
9
+
10
+
You can create your own app and follow along the steps in the sections ahead, or you can clone the GitHub repository that contains the completed sample apps for all of the quickstarts. The sample repo is also structured as an Azure Developer CLI template that can provision an Azure OpenAI resource for you.
1. To provision an Azure OpenAI service and model using the Azure CLI, complete the steps in the [Create and deploy an Azure OpenAI Service resource](/azure/ai-services/openai/how-to/create-resource?pivots=cli) article.
10
+
11
+
1. From a terminal or command prompt, navigate to the root of your project directory.
12
+
13
+
1. Run the following commands to configure your OpenAI API key as a secret for the sample app:
14
+
15
+
```bash
16
+
dotnet user-secrets init
17
+
dotnet user-secrets set AZURE_OPENAI_ENDPOINT <your-azure-openai-endpoint>
18
+
dotnet user-secrets set AZURE_OPENAI_GPT_NAME <your-azure-openai-model-name>
19
+
```
20
+
21
+
# [Azure Portal](#tab/azure-portal)
22
+
23
+
1. To provision an Azure OpenAI service and model using the Azure portal, complete the steps in the [Create and deploy an Azure OpenAI Service resource](/azure/ai-services/openai/how-to/create-resource?pivots=web-portal) article.
24
+
25
+
1. From a terminal or command prompt, navigate to the root of your project directory.
26
+
27
+
1. Run the following commands to configure your OpenAI API key as a secret for the sample app:
28
+
29
+
```bash
30
+
dotnet user-secrets init
31
+
dotnet user-secrets set AZURE_OPENAI_ENDPOINT <your-openai-key>
32
+
dotnet user-secrets set AZURE_OPENAI_GPT_NAME <your-azure-openai-model-name>
Copy file name to clipboardExpand all lines: docs/ai/quickstarts/includes/deploy-azd.md
+2-5Lines changed: 2 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,14 +7,11 @@ ms.topic: include
7
7
8
8
The sample GitHub repository is structured as an Azure Developer CLI (`azd`) template, which `azd` can use to provision the Azure OpenAI service and model for you.
9
9
10
-
1. From a terminal or command prompt, navigate to the _src\quickstarts\azure-openai_ directory of the sample repo.
10
+
1. From a terminal or command prompt, navigate to the `src\quickstarts\azure-openai` directory of the sample repo.
11
11
1. Run the `azd up` command to provision the Azure OpenAI resources. It might take several minutes to create the Azure OpenAI service and deploy the model.
12
12
13
13
```azdeveloper
14
14
azd up
15
15
```
16
16
17
-
`azd` also configures the required user secrets for the sample app, such as the OpenAI access key.
18
-
19
-
> [!NOTE]
20
-
> If you encounter an error during the `azd up` deployment, visit the [troubleshooting](#troubleshoot) section.
17
+
`azd` also configures the required user secrets for the sample app, such as the Azure OpenAI endpoint and model name.
Copy file name to clipboardExpand all lines: docs/ai/quickstarts/includes/prerequisites-azure-openai.md
+1-2Lines changed: 1 addition & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,6 +9,5 @@ ms.topic: include
9
9
10
10
- .NET 8 SDK - [Install the .NET 8 SDK](https://dotnet.microsoft.com/download/dotnet/8.0).
11
11
- An Azure subscription - [Create one for free](https://azure.microsoft.com/free).
12
-
- Azure Developer CLI - [Install or update the Azure Developer CLI](/azure/developer/azure-developer-cli/install-azd).
13
12
- Access to [Azure OpenAI service](/azure/ai-services/openai/overview#how-do-i-get-access-to-azure-openai).
14
-
-On Windows, PowerShell `v7+` is required. To validate your version, run `pwsh` in a terminal. It should return the current version. If it returns an error, execute the following command: `dotnet tool update --global PowerShell`.
13
+
-Azure Developer CLI (Optional) - [Install or update the Azure Developer CLI](/azure/developer/azure-developer-cli/install-azd).
Copy file name to clipboardExpand all lines: docs/ai/quickstarts/quickstart-ai-chat-with-data.md
+5-6Lines changed: 5 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -46,7 +46,7 @@ Get started with AI development using a .NET 8 console app to connect to an Open
46
46
47
47
1. To provision an Azure OpenAI service and model using the Azure CLI, complete the steps in the [Create and deploy an Azure OpenAI Service resource](/azure/ai-services/openai/how-to/create-resource?pivots=cli) article.
48
48
49
-
1. From a terminal or command prompt, navigate to the `src\quickstarts\azure-openai\03-ChattingAboutMyHikes` directory.
49
+
1. From a terminal or command prompt, navigate to the `src\quickstarts\azure-openai\semantic-kernel\03-ChattingAboutMyHikes` directory.
50
50
51
51
1. Run the following commands to configure your OpenAI API key as a secret for the sample app:
52
52
@@ -58,7 +58,7 @@ Get started with AI development using a .NET 8 console app to connect to an Open
58
58
59
59
1. To provision an Azure OpenAI service and model using the Azure portal, complete the steps in the [Create and deploy an Azure OpenAI Service resource](/azure/ai-services/openai/how-to/create-resource?pivots=web-portal) article.
60
60
61
-
1. From a terminal or command prompt, navigate to the `src\quickstarts\azure-openai\03-ChattingAboutMyHikes` directory.
61
+
1. From a terminal or command prompt, navigate to the `src\quickstarts\azure-openai\semantic-kernel\03-ChattingAboutMyHikes` directory.
62
62
63
63
1. Run the following commands to configure your OpenAI API key as a secret for the sample app:
64
64
@@ -75,7 +75,7 @@ Get started with AI development using a .NET 8 console app to connect to an Open
75
75
<!-- markdownlint-disable MD029 MD044 -->
76
76
:::zone target="docs" pivot="openai"
77
77
78
-
1. From a terminal or command prompt, navigate to the `openai\03-ChattingAboutMyHikes` directory.
78
+
1. From a terminal or command prompt, navigate to the `src\quickstarts\openai\semantic-kernel\03-ChattingAboutMyHikes` directory.
79
79
80
80
1. Run the following commands to configure your OpenAI API key as a secret for the sample app:
81
81
@@ -94,7 +94,7 @@ Get started with AI development using a .NET 8 console app to connect to an Open
94
94
95
95
:::zone target="docs" pivot="azure-openai"
96
96
97
-
1. From a terminal or command prompt, navigate to the `azure-openai\02-HikerAI` directory.
97
+
1. From a terminal or command prompt, navigate to the `semantic-kernel\02-HikerAI` directory.
98
98
99
99
2. Use the `dotnet run`command to run the app:
100
100
@@ -145,14 +145,13 @@ The entire application is contained within the **Program.cs** file. The first se
145
145
var config = new ConfigurationBuilder().AddUserSecrets<Program>().Build();
The `AzureOpenAIChatCompletionService` service facilitates the requests and responses.
152
151
153
152
```csharp
154
153
// == Create the Azure OpenAI Chat Completion Service ==========
155
-
AzureOpenAIChatCompletionService service = new(deployment, endpoint, key);
154
+
AzureOpenAIChatCompletionService service = new(deployment, endpoint, new DefaultAzureCredential());
156
155
```
157
156
158
157
Once the `OpenAIChatCompletionService` client is created, the app reads the content of the file `hikes.md` and uses it to provide more context to the model by adding a system prompt. This influences model behavior and the generated completions during the conversation.
Copy file name to clipboardExpand all lines: docs/ai/quickstarts/quickstart-azure-openai-tool.md
+5-6Lines changed: 5 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -48,7 +48,7 @@ Get started with AI by creating a simple .NET 8 console chat application. The ap
48
48
49
49
1. To provision an Azure OpenAI service and model using the Azure CLI, complete the steps in the [Create and deploy an Azure OpenAI Service resource](/azure/ai-services/openai/how-to/create-resource?pivots=cli) article.
50
50
51
-
1. From a terminal or command prompt, navigate to the `src\quickstarts\azure-openai\04-HikerAIPro` directory.
51
+
1. From a terminal or command prompt, navigate to the `src\quickstarts\azure-openai\semantic-kernel\04-HikerAIPro` directory.
52
52
53
53
1. Run the following commands to configure your OpenAI API key as a secret for the sample app:
54
54
@@ -60,7 +60,7 @@ Get started with AI by creating a simple .NET 8 console chat application. The ap
60
60
61
61
1. To provision an Azure OpenAI service and model using the Azure portal, complete the steps in the [Create and deploy an Azure OpenAI Service resource](/azure/ai-services/openai/how-to/create-resource?pivots=web-portal) article.
62
62
63
-
1. From a terminal or command prompt, navigate to the `src\quickstarts\azure-openai\04-HikerAIPro` directory.
63
+
1. From a terminal or command prompt, navigate to the `src\quickstarts\azure-openai\semantic-kernel\04-HikerAIPro` directory.
64
64
65
65
1. Run the following commands to configure your OpenAI API key as a secret for the sample app:
66
66
@@ -77,7 +77,7 @@ Get started with AI by creating a simple .NET 8 console chat application. The ap
77
77
<!-- markdownlint-disable MD029 MD044 -->
78
78
:::zone target="docs" pivot="openai"
79
79
80
-
1. From a terminal or command prompt, navigate to the `azure-openai\04-HikerAIPro` directory.
80
+
1. From a terminal or command prompt, navigate to the `src\quickstarts\openai\semantic-kernel\04-HikerAIPro` directory.
81
81
82
82
1. Run the following commands to configure your OpenAI API key as a secret for the sample app:
83
83
@@ -96,7 +96,7 @@ Get started with AI by creating a simple .NET 8 console chat application. The ap
96
96
97
97
:::zone target="docs" pivot="azure-openai"
98
98
99
-
1. From a terminal or command prompt, navigate to the `azure-openai\04-HikerAIPro` directory.
99
+
1. From a terminal or command prompt, navigate to the `semantic-kernel\04-HikerAIPro` directory.
100
100
101
101
2. Use the `dotnet run`command to run the app:
102
102
@@ -149,7 +149,6 @@ The entire application is contained within the **Program.cs** file. The first se
149
149
var config = new ConfigurationBuilder().AddUserSecrets<Program>().Build();
Copy file name to clipboardExpand all lines: docs/ai/quickstarts/quickstart-openai-generate-images.md
+4-5Lines changed: 4 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -44,7 +44,7 @@ Get started with AI by creating a simple .NET 8 console chat application. The ap
44
44
45
45
1. To provision an Azure OpenAI service and model using the Azure CLI, complete the steps in the [Create and deploy an Azure OpenAI Service resource](/azure/ai-services/openai/how-to/create-resource?pivots=cli) article.
46
46
47
-
1. From a terminal or command prompt, navigate to the `src\quickstarts\azure-openai\05-HikeImages` directory.
47
+
1. From a terminal or command prompt, navigate to the `src\quickstarts\azure-openai\semantic-kernel\05-HikeImages` directory.
48
48
49
49
1. Run the following commands to configure your OpenAI API key as a secret for the sample app:
50
50
@@ -56,7 +56,7 @@ Get started with AI by creating a simple .NET 8 console chat application. The ap
56
56
57
57
1. To provision an Azure OpenAI service and model using the Azure portal, complete the steps in the [Create and deploy an Azure OpenAI Service resource](/azure/ai-services/openai/how-to/create-resource?pivots=web-portal) article.
58
58
59
-
1. From a terminal or command prompt, navigate to the `src\quickstarts\azure-openai\05-HikeImages` directory.
59
+
1. From a terminal or command prompt, navigate to the `src\quickstarts\azure-openai\semantic-kernel\05-HikeImages` directory.
60
60
61
61
1. Run the following commands to configure your OpenAI API key as a secret for the sample app:
62
62
@@ -91,7 +91,7 @@ Get started with AI by creating a simple .NET 8 console chat application. The ap
91
91
92
92
:::zone target="docs" pivot="azure-openai"
93
93
94
-
1. From a terminal or command prompt, navigate to the `azure-openai\05-HikeImages` directory.
94
+
1. From a terminal or command prompt, navigate to the `azure-openai\semantic-kernel\05-HikeImages` directory.
95
95
96
96
2. Use the `dotnet run`command to run the app:
97
97
@@ -136,13 +136,12 @@ The _Program.cs_ file contains all of the app code. The first several lines of c
136
136
var config = new ConfigurationBuilder().AddUserSecrets<Program>().Build();
0 commit comments