@@ -6,15 +6,26 @@ namespace CallRequestResponseService
66{
77 class Program
88 {
9- private static string apiKey ;
9+ private static string apiKey , deploymentModelName ;
1010 static void Main ( string [ ] args )
1111 {
12+ // NOTE: For the demo code here, I'm using a secrets.json file that looks like this:
13+ /*
14+ {
15+ "aistudio-deployment-apikey": "your api key",
16+ "aistudio-deployment-name": "your model name"
17+ }
18+
19+ */
20+
21+
1222 // Build the configuration
1323 IConfiguration configuration = new ConfigurationBuilder ( )
1424 . AddUserSecrets < Program > ( )
1525 . Build ( ) ;
1626
17- apiKey = configuration [ "apikey-tobias-3655" ] ;
27+ deploymentModelName = configuration [ "aistudio-deployment-name" ] ;
28+ apiKey = configuration [ "aistudio-deployment-apikey" ] ;
1829
1930 InvokeRequestResponseService ( ) . Wait ( ) ;
2031 }
@@ -30,6 +41,7 @@ static async Task InvokeRequestResponseService()
3041 using ( var client = new HttpClient ( handler ) )
3142 {
3243 Console . WriteLine ( "Enter any text to summarize. When you're done, hit Enter:" ) ;
44+ Console . WriteLine ( "-------------------" ) ;
3345
3446 // For demo purposes.
3547 // You should protect the strings and ensure proper encoding to accept more complext text, including quotation marks, etc.
@@ -53,10 +65,10 @@ static async Task InvokeRequestResponseService()
5365
5466 // This header will force the request to go to a specific deployment.
5567 // Remove this line to have the request observe the endpoint traffic rules
56- content . Headers . Add ( "azureml-model-deployment" , "human-centered-summarization-10" ) ;
68+ content . Headers . Add ( "azureml-model-deployment" , deploymentModelName ) ;
5769
5870 HttpResponseMessage response = await client . PostAsync ( "" , content ) ;
59-
71+
6072 if ( response . IsSuccessStatusCode )
6173 {
6274 string result = await response . Content . ReadAsStringAsync ( ) ;
0 commit comments