Skip to content

Commit f22d241

Browse files
feat(api): add inputs array to UserInputBlock proto
1 parent ca3905e commit f22d241

File tree

3 files changed

+68
-11
lines changed

3 files changed

+68
-11
lines changed

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 170
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gitpod%2Fgitpod-eeec67988ceb123d93514d894e04b0fa00dbf0c4678b95baa80868c103aaa0c1.yml
3-
openapi_spec_hash: 3bf178a4e70c15f12fdc23531fe81aea
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gitpod%2Fgitpod-f838b3c6096ed0143c969fcdd6acf63cb619865ef707e1213194d3b82afe10bf.yml
3+
openapi_spec_hash: 00a77c0d2749b833f8e29c8493b7ea98
44
config_hash: d726afb2a92132197e4eae04303e8041

src/gitpod/types/user_input_block_param.py

Lines changed: 40 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,61 @@
22

33
from __future__ import annotations
44

5-
from typing import Union
5+
from typing import Union, Iterable
66
from datetime import datetime
7-
from typing_extensions import Annotated, TypedDict
7+
from typing_extensions import Literal, Annotated, TypedDict
88

99
from .._types import Base64FileInput
1010
from .._utils import PropertyInfo
1111
from .._models import set_pydantic_config
1212

13-
__all__ = ["UserInputBlockParam", "Image", "Text"]
13+
__all__ = ["UserInputBlockParam", "Image", "Input", "InputImage", "InputText", "Text"]
1414

1515

1616
class Image(TypedDict, total=False):
1717
"""
1818
ImageInput allows sending images to the agent.
19-
Media type is inferred from magic bytes by the backend.
19+
Client must provide the MIME type; backend validates against magic bytes.
2020
"""
2121

2222
data: Annotated[Union[str, Base64FileInput], PropertyInfo(format="base64")]
23-
"""Raw image data (max 4MB). Supported formats: PNG, JPEG, WebP."""
23+
"""Raw image data (max 4MB). Supported formats: PNG, JPEG."""
24+
25+
mime_type: Annotated[Literal["image/png", "image/jpeg"], PropertyInfo(alias="mimeType")]
2426

2527

2628
set_pydantic_config(Image, {"arbitrary_types_allowed": True})
2729

2830

31+
class InputImage(TypedDict, total=False):
32+
"""
33+
ImageInput allows sending images to the agent.
34+
Client must provide the MIME type; backend validates against magic bytes.
35+
"""
36+
37+
data: Annotated[Union[str, Base64FileInput], PropertyInfo(format="base64")]
38+
"""Raw image data (max 4MB). Supported formats: PNG, JPEG."""
39+
40+
mime_type: Annotated[Literal["image/png", "image/jpeg"], PropertyInfo(alias="mimeType")]
41+
42+
43+
set_pydantic_config(InputImage, {"arbitrary_types_allowed": True})
44+
45+
46+
class InputText(TypedDict, total=False):
47+
content: str
48+
49+
50+
class Input(TypedDict, total=False):
51+
image: InputImage
52+
"""
53+
ImageInput allows sending images to the agent. Client must provide the MIME
54+
type; backend validates against magic bytes.
55+
"""
56+
57+
text: InputText
58+
59+
2960
class Text(TypedDict, total=False):
3061
content: str
3162

@@ -38,8 +69,10 @@ class UserInputBlockParam(TypedDict, total=False):
3869

3970
image: Image
4071
"""
41-
ImageInput allows sending images to the agent. Media type is inferred from magic
42-
bytes by the backend.
72+
ImageInput allows sending images to the agent. Client must provide the MIME
73+
type; backend validates against magic bytes.
4374
"""
4475

76+
inputs: Iterable[Input]
77+
4578
text: Text

tests/api_resources/test_agents.py

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,19 @@ def test_method_send_to_execution_with_all_params(self, client: Gitpod) -> None:
361361
user_input={
362362
"id": "id",
363363
"created_at": parse_datetime("2019-12-27T18:11:19.117Z"),
364-
"image": {"data": "U3RhaW5sZXNzIHJvY2tz"},
364+
"image": {
365+
"data": "U3RhaW5sZXNzIHJvY2tz",
366+
"mime_type": "image/png",
367+
},
368+
"inputs": [
369+
{
370+
"image": {
371+
"data": "U3RhaW5sZXNzIHJvY2tz",
372+
"mime_type": "image/png",
373+
},
374+
"text": {"content": "x"},
375+
}
376+
],
365377
"text": {"content": "Generate a report based on the latest logs."},
366378
},
367379
)
@@ -874,7 +886,19 @@ async def test_method_send_to_execution_with_all_params(self, async_client: Asyn
874886
user_input={
875887
"id": "id",
876888
"created_at": parse_datetime("2019-12-27T18:11:19.117Z"),
877-
"image": {"data": "U3RhaW5sZXNzIHJvY2tz"},
889+
"image": {
890+
"data": "U3RhaW5sZXNzIHJvY2tz",
891+
"mime_type": "image/png",
892+
},
893+
"inputs": [
894+
{
895+
"image": {
896+
"data": "U3RhaW5sZXNzIHJvY2tz",
897+
"mime_type": "image/png",
898+
},
899+
"text": {"content": "x"},
900+
}
901+
],
878902
"text": {"content": "Generate a report based on the latest logs."},
879903
},
880904
)

0 commit comments

Comments
 (0)