@@ -162,6 +162,7 @@ print("Deleted agent")
162
162
::: zone-end
163
163
164
164
::: zone pivot="csharp"
165
+
165
166
## Create a project client
166
167
167
168
Create 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
170
171
using Azure ;
171
172
using Azure .AI .Agents .Persistent ;
172
173
using 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 ();
182
174
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" ) ;
186
178
187
179
// Create the Agent Client
188
180
PersistentAgentsClient agentClient = new (projectEndpoint , new DefaultAzureCredential ());
@@ -193,18 +185,10 @@ PersistentAgentsClient agentClient = new(projectEndpoint, new DefaultAzureCreden
193
185
To 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 ) .
194
186
195
187
``` 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 (
204
190
new BingGroundingSearchToolParameters (
205
- [
206
- searchConfig
207
- ]
191
+ [new BingGroundingSearchConfiguration (bingConnectionId )]
208
192
)
209
193
);
210
194
@@ -335,7 +319,6 @@ Clean up the resources from this sample.
335
319
agentClient .Threads .DeleteThread (threadId : thread .Id );
336
320
agentClient .Administration .DeleteAgent (agentId : agent .Id );
337
321
```
338
-
339
322
::: zone-end
340
323
341
324
::: zone pivot="javascript"
0 commit comments