Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 12 additions & 14 deletions docs/features/image-input.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,9 @@ func main() {
session.Send(ctx, copilot.MessageOptions{
Prompt: "Describe what you see in this image",
Attachments: []copilot.Attachment{
{
Type: copilot.AttachmentTypeFile,
Path: &path,
&copilot.UserMessageAttachmentFile{
DisplayName: "screenshot.png",
Path: path,
},
},
})
Expand All @@ -146,9 +146,9 @@ path := "/absolute/path/to/screenshot.png"
session.Send(ctx, copilot.MessageOptions{
Prompt: "Describe what you see in this image",
Attachments: []copilot.Attachment{
{
Type: copilot.AttachmentTypeFile,
Path: &path,
&copilot.UserMessageAttachmentFile{
DisplayName: "screenshot.png",
Path: path,
},
},
})
Expand Down Expand Up @@ -343,10 +343,9 @@ func main() {
session.Send(ctx, copilot.MessageOptions{
Prompt: "Describe what you see in this image",
Attachments: []copilot.Attachment{
{
Type: copilot.AttachmentTypeBlob,
Data: &base64ImageData,
MIMEType: &mimeType,
&copilot.UserMessageAttachmentBlob{
Data: base64ImageData,
MIMEType: mimeType,
DisplayName: &displayName,
},
},
Expand All @@ -361,10 +360,9 @@ displayName := "screenshot.png"
session.Send(ctx, copilot.MessageOptions{
Prompt: "Describe what you see in this image",
Attachments: []copilot.Attachment{
{
Type: copilot.AttachmentTypeBlob,
Data: &base64ImageData, // base64-encoded string
MIMEType: &mimeType,
&copilot.UserMessageAttachmentBlob{
Data: base64ImageData, // base64-encoded string
MIMEType: mimeType,
DisplayName: &displayName,
},
},
Expand Down
13 changes: 6 additions & 7 deletions go/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -246,9 +246,9 @@ The SDK supports image attachments via the `Attachments` field in `MessageOption
_, err = session.Send(context.Background(), copilot.MessageOptions{
Prompt: "What's in this image?",
Attachments: []copilot.Attachment{
{
Type: "file",
Path: "/path/to/image.jpg",
&copilot.UserMessageAttachmentFile{
DisplayName: "image.jpg",
Path: "/path/to/image.jpg",
},
},
})
Expand All @@ -258,10 +258,9 @@ mimeType := "image/png"
_, err = session.Send(context.Background(), copilot.MessageOptions{
Prompt: "What's in this image?",
Attachments: []copilot.Attachment{
{
Type: copilot.AttachmentTypeBlob,
Data: &base64ImageData,
MIMEType: &mimeType,
&copilot.UserMessageAttachmentBlob{
Data: base64ImageData,
MIMEType: mimeType,
},
},
})
Expand Down
Loading
Loading