Skip to content

Commit cca8df2

Browse files
committed
splitting code
1 parent aa7bc2c commit cca8df2

File tree

1 file changed

+21
-16
lines changed

1 file changed

+21
-16
lines changed

articles/ai-services/agents/how-to/tools/function-calling.md

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,28 @@ message = project_client.agents.create_message(
211211
content="Hello, send an email with the datetime and weather information in New York?",
212212
)
213213
print(f"Created message, ID: {message.id}")
214+
```
215+
216+
# [C#](#tab/csharp)
217+
218+
```csharp
219+
Response<AgentThread> threadResponse = await client.CreateThreadAsync();
220+
AgentThread thread = threadResponse.Value;
214221

222+
Response<ThreadMessage> messageResponse = await client.CreateMessageAsync(
223+
thread.Id,
224+
MessageRole.User,
225+
"What's the weather like in my favorite city?");
226+
ThreadMessage message = messageResponse.Value;
227+
```
228+
229+
---
230+
231+
## Create a run and check the output
232+
233+
# [python](#tab/python)
234+
235+
```python
215236
# Create and process agent run in thread with tools
216237
run = project_client.agents.create_and_process_run(thread_id=thread.id, assistant_id=agent.id)
217238
print(f"Run finished with status: {run.status}")
@@ -231,15 +252,6 @@ print(f"Messages: {messages}")
231252
# [C#](#tab/csharp)
232253

233254
```csharp
234-
Response<AgentThread> threadResponse = await client.CreateThreadAsync();
235-
AgentThread thread = threadResponse.Value;
236-
237-
Response<ThreadMessage> messageResponse = await client.CreateMessageAsync(
238-
thread.Id,
239-
MessageRole.User,
240-
"What's the weather like in my favorite city?");
241-
ThreadMessage message = messageResponse.Value;
242-
243255
Response<ThreadRun> runResponse = await client.CreateRunAsync(thread, agent);
244256

245257
#region Snippet:FunctionsHandlePollingWithRequiredAction
@@ -288,13 +300,6 @@ foreach (ThreadMessage threadMessage in messages)
288300

289301
---
290302

291-
## Create a run and check the output
292-
293-
# [python](#tab/python)
294-
295-
# [C#](#tab/csharp)
296-
297-
298303
::: zone-end
299304

300305
## See also

0 commit comments

Comments
 (0)