Skip to content

Commit a540e9c

Browse files
authored
dotnet: update README attachment examples to use AttachmentFile/AttachmentBlob; fix Session example (fixes #2196 (#2208)
1 parent f324f72 commit a540e9c

2 files changed

Lines changed: 9 additions & 10 deletions

File tree

dotnet/README.md

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -296,9 +296,9 @@ The SDK supports image attachments via the `Attachments` parameter. You can atta
296296
await session.SendAsync(new MessageOptions
297297
{
298298
Prompt = "What's in this image?",
299-
Attachments = new List<UserMessageDataAttachmentsItem>
299+
Attachments = new List<Attachment>
300300
{
301-
new UserMessageDataAttachmentsItemFile
301+
new AttachmentFile
302302
{
303303
Path = "/path/to/image.jpg",
304304
DisplayName = "image.jpg",
@@ -310,9 +310,9 @@ await session.SendAsync(new MessageOptions
310310
await session.SendAsync(new MessageOptions
311311
{
312312
Prompt = "What's in this image?",
313-
Attachments = new List<UserMessageDataAttachmentsItem>
313+
Attachments = new List<Attachment>
314314
{
315-
new UserMessageDataAttachmentsItemBlob
315+
new AttachmentBlob
316316
{
317317
Data = base64ImageData,
318318
MimeType = "image/png",
@@ -721,13 +721,12 @@ await session2.SendAsync(new MessageOptions { Prompt = "Hello from session 2" })
721721
await session.SendAsync(new MessageOptions
722722
{
723723
Prompt = "Analyze this file",
724-
Attachments = new List<UserMessageDataAttachmentsItem>
724+
Attachments = new List<Attachment>
725725
{
726-
new UserMessageDataAttachmentsItem
726+
new AttachmentFile
727727
{
728-
Type = UserMessageDataAttachmentsItemType.File,
729728
Path = "/path/to/file.cs",
730-
DisplayName = "My File"
729+
DisplayName = "My File",
731730
}
732731
}
733732
});

dotnet/src/Session.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*---------------------------------------------------------------------------------------------
1+
/*---------------------------------------------------------------------------------------------
22
* Copyright (c) Microsoft Corporation. All rights reserved.
33
*--------------------------------------------------------------------------------------------*/
44

@@ -263,7 +263,7 @@ public Task<string> SendAsync(string prompt, CancellationToken cancellationToken
263263
/// Prompt = "Explain this code",
264264
/// Attachments = new List&lt;Attachment&gt;
265265
/// {
266-
/// new() { Type = "file", Path = "./Program.cs" }
266+
/// new AttachmentFile { Path = "./Program.cs", DisplayName = "Program.cs" }
267267
/// }
268268
/// });
269269
/// </code>

0 commit comments

Comments
 (0)