Skip to content

Commit 22eba84

Browse files
CopilotfriggeriCopilot
authored
Document image attachment support in SDK READMEs (#150)
* Initial plan * Add image support documentation to all SDK READMEs Co-authored-by: friggeri <[email protected]> * Update python/README.md Co-authored-by: Copilot <[email protected]> --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: friggeri <[email protected]> Co-authored-by: Adrien Friggeri <[email protected]> Co-authored-by: Copilot <[email protected]>
1 parent 17f54a7 commit 22eba84

File tree

4 files changed

+93
-0
lines changed

4 files changed

+93
-0
lines changed

dotnet/README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,31 @@ session.On(evt =>
200200
});
201201
```
202202

203+
## Image Support
204+
205+
The SDK supports image attachments via the `Attachments` parameter. You can attach images by providing their file path:
206+
207+
```csharp
208+
await session.SendAsync(new MessageOptions
209+
{
210+
Prompt = "What's in this image?",
211+
Attachments = new List<UserMessageDataAttachmentsItem>
212+
{
213+
new UserMessageDataAttachmentsItem
214+
{
215+
Type = UserMessageDataAttachmentsItemType.File,
216+
Path = "/path/to/image.jpg"
217+
}
218+
}
219+
});
220+
```
221+
222+
Supported image formats include JPG, PNG, GIF, and other common image types. The agent's `view` tool can also read images directly from the filesystem, so you can also ask questions like:
223+
224+
```csharp
225+
await session.SendAsync(new MessageOptions { Prompt = "What does the most recent jpg in this directory portray?" });
226+
```
227+
203228
## Streaming
204229

205230
Enable streaming to receive assistant response chunks as they're generated:

go/README.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,30 @@ func main() {
112112

113113
- `Bool(v bool) *bool` - Helper to create bool pointers for `AutoStart`/`AutoRestart` options
114114

115+
## Image Support
116+
117+
The SDK supports image attachments via the `Attachments` field in `MessageOptions`. You can attach images by providing their file path:
118+
119+
```go
120+
_, err = session.Send(copilot.MessageOptions{
121+
Prompt: "What's in this image?",
122+
Attachments: []copilot.Attachment{
123+
{
124+
Type: "file",
125+
Path: "/path/to/image.jpg",
126+
},
127+
},
128+
})
129+
```
130+
131+
Supported image formats include JPG, PNG, GIF, and other common image types. The agent's `view` tool can also read images directly from the filesystem, so you can also ask questions like:
132+
133+
```go
134+
_, err = session.Send(copilot.MessageOptions{
135+
Prompt: "What does the most recent jpg in this directory portray?",
136+
})
137+
```
138+
115139
### Tools
116140

117141
Expose your own functionality to Copilot by attaching tools to a session.

nodejs/README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,28 @@ Sessions emit various events during processing:
183183

184184
See `SessionEvent` type in the source for full details.
185185

186+
## Image Support
187+
188+
The SDK supports image attachments via the `attachments` parameter. You can attach images by providing their file path:
189+
190+
```typescript
191+
await session.send({
192+
prompt: "What's in this image?",
193+
attachments: [
194+
{
195+
type: "file",
196+
path: "/path/to/image.jpg",
197+
},
198+
],
199+
});
200+
```
201+
202+
Supported image formats include JPG, PNG, GIF, and other common image types. The agent's `view` tool can also read images directly from the filesystem, so you can also ask questions like:
203+
204+
```typescript
205+
await session.send({ prompt: "What does the most recent jpg in this directory portray?" });
206+
```
207+
186208
## Streaming
187209

188210
Enable streaming to receive assistant response chunks as they're generated:

python/README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,28 @@ session = await client.create_session({
155155

156156
The SDK automatically handles `tool.call`, executes your handler (sync or async), and responds with the final result when the tool completes.
157157

158+
## Image Support
159+
160+
The SDK supports image attachments via the `attachments` parameter. You can attach images by providing their file path:
161+
162+
```python
163+
await session.send({
164+
"prompt": "What's in this image?",
165+
"attachments": [
166+
{
167+
"type": "file",
168+
"path": "/path/to/image.jpg",
169+
}
170+
]
171+
})
172+
```
173+
174+
Supported image formats include JPG, PNG, GIF, and other common image types. The agent's `view` tool can also read images directly from the filesystem, so you can also ask questions like:
175+
176+
```python
177+
await session.send({"prompt": "What does the most recent jpg in this directory portray?"})
178+
```
179+
158180
## Streaming
159181

160182
Enable streaming to receive assistant response chunks as they're generated:

0 commit comments

Comments
 (0)