@@ -162,6 +162,7 @@ print("Deleted agent")
162162::: zone-end
163163
164164::: zone pivot="csharp"
165+
165166## Create a project client
166167
167168Create a client object, which will contain the project endpoint for connecting to your AI project and other resources.
@@ -170,19 +171,10 @@ Create a client object, which will contain the project endpoint for connecting t
170171using Azure ;
171172using Azure .AI .Agents .Persistent ;
172173using Azure .Identity ;
173- using Microsoft .Extensions .Configuration ;
174- using System ;
175- using System .Threading ;
176-
177- // Get Connection information from app configuration
178- IConfigurationRoot configuration = new ConfigurationBuilder ()
179- .SetBasePath (AppContext .BaseDirectory )
180- .AddJsonFile (" appsettings.json" , optional : false , reloadOnChange : true )
181- .Build ();
182174
183- var projectEndpoint = configuration [ " ProjectEndpoint" ] ;
184- var modelDeploymentName = configuration [ " ModelDeploymentName" ] ;
185- var bingConnectionId = configuration [ " BingConnectionId" ] ;
175+ var projectEndpoint = System . Environment . GetEnvironmentVariable ( " ProjectEndpoint" ) ;
176+ var projectEndpoint = System . Environment . GetEnvironmentVariable ( " ModelDeploymentName" ) ;
177+ var projectEndpoint = System . Environment . GetEnvironmentVariable ( " BingConnectionId" ) ;
186178
187179// Create the Agent Client
188180PersistentAgentsClient agentClient = new (projectEndpoint , new DefaultAzureCredential ());
@@ -193,18 +185,10 @@ PersistentAgentsClient agentClient = new(projectEndpoint, new DefaultAzureCreden
193185To make the Grounding with Bing search tool available to your agent, use a connection to initialize the tool and attach it to the agent. You can find your connection in the ** connected resources** section of your project in the [ Azure AI Foundry portal] ( https://ai.azure.com/?cid=learnDocs ) .
194186
195187``` csharp
196- BingGroundingSearchConfiguration searchConfig = new BingGroundingSearchConfiguration (bingConnectionId )
197- {
198- Count = 5 ,
199- Freshness = " Week"
200- };
201-
202- // Create the BingGroundingToolDefinition object used when creating the agent
203- BingGroundingToolDefinition bingGroundingTool = new BingGroundingToolDefinition (
188+
189+ BingGroundingToolDefinition bingGroundingTool = new (
204190 new BingGroundingSearchToolParameters (
205- [
206- searchConfig
207- ]
191+ [new BingGroundingSearchConfiguration (bingConnectionId )]
208192 )
209193);
210194
@@ -335,7 +319,6 @@ Clean up the resources from this sample.
335319agentClient .Threads .DeleteThread (threadId : thread .Id );
336320agentClient .Administration .DeleteAgent (agentId : agent .Id );
337321```
338-
339322::: zone-end
340323
341324::: zone pivot="javascript"
0 commit comments