Skip to content

Commit 90b29b2

Browse files
feat(api): add ImageInput to UserInputBlock proto
1 parent 5fe4ef9 commit 90b29b2

File tree

3 files changed

+31
-8
lines changed

3 files changed

+31
-8
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: 160
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gitpod%2Fgitpod-3c080e16ecc8c0377535643430e1abc1425a0b8f474fd6f211cac5e617b7ba28.yml
3-
openapi_spec_hash: 154065951ac8ea5188227ec10c2c10c8
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/gitpod%2Fgitpod-665d1d0e7f0040c5fbbb664487724af4ecc58d3c702e8099ceef4a05ba589369.yml
3+
openapi_spec_hash: 3688253b79ec0cf6d41ff586d71e9f07
44
config_hash: 8e1b089e9f5af438fd56b523014af4f2

src/gitpod/types/user_input_block_param.py

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,42 @@
44

55
from typing import Union
66
from datetime import datetime
7-
from typing_extensions import Required, Annotated, TypedDict
7+
from typing_extensions import Annotated, TypedDict
88

9+
from .._types import Base64FileInput
910
from .._utils import PropertyInfo
11+
from .._models import set_pydantic_config
1012

11-
__all__ = ["UserInputBlockParam", "Text"]
13+
__all__ = ["UserInputBlockParam", "Image", "Text"]
14+
15+
16+
class Image(TypedDict, total=False):
17+
"""
18+
ImageInput allows sending images to the agent.
19+
Media type is inferred from magic bytes by the backend.
20+
"""
21+
22+
data: Annotated[Union[str, Base64FileInput], PropertyInfo(format="base64")]
23+
"""Raw image data (max 4MB). Supported formats: PNG, JPEG, WebP."""
24+
25+
26+
set_pydantic_config(Image, {"arbitrary_types_allowed": True})
1227

1328

1429
class Text(TypedDict, total=False):
1530
content: str
1631

1732

1833
class UserInputBlockParam(TypedDict, total=False):
19-
text: Required[Text]
20-
2134
id: str
2235

2336
created_at: Annotated[Union[str, datetime], PropertyInfo(alias="createdAt", format="iso8601")]
2437
"""Timestamp when this block was created. Used for debugging and support bundles."""
38+
39+
image: Image
40+
"""
41+
ImageInput allows sending images to the agent. Media type is inferred from magic
42+
bytes by the backend.
43+
"""
44+
45+
text: Text

tests/api_resources/test_agents.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -359,9 +359,10 @@ def test_method_send_to_execution_with_all_params(self, client: Gitpod) -> None:
359359
agent = client.agents.send_to_execution(
360360
agent_execution_id="6fa1a3c7-fbb7-49d1-ba56-1890dc7c4c35",
361361
user_input={
362-
"text": {"content": "Generate a report based on the latest logs."},
363362
"id": "id",
364363
"created_at": parse_datetime("2019-12-27T18:11:19.117Z"),
364+
"image": {"data": "U3RhaW5sZXNzIHJvY2tz"},
365+
"text": {"content": "Generate a report based on the latest logs."},
365366
},
366367
)
367368
assert_matches_type(object, agent, path=["response"])
@@ -869,9 +870,10 @@ async def test_method_send_to_execution_with_all_params(self, async_client: Asyn
869870
agent = await async_client.agents.send_to_execution(
870871
agent_execution_id="6fa1a3c7-fbb7-49d1-ba56-1890dc7c4c35",
871872
user_input={
872-
"text": {"content": "Generate a report based on the latest logs."},
873873
"id": "id",
874874
"created_at": parse_datetime("2019-12-27T18:11:19.117Z"),
875+
"image": {"data": "U3RhaW5sZXNzIHJvY2tz"},
876+
"text": {"content": "Generate a report based on the latest logs."},
875877
},
876878
)
877879
assert_matches_type(object, agent, path=["response"])

0 commit comments

Comments
 (0)