Skip to content
Open
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
10 changes: 5 additions & 5 deletions examples/adk_streaming_thinking_usage.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ def _build_weather_tool() -> Any:
name="get_demo_weather",
description="Return canned weather information for a city.",
parameters=genai_types.Schema(
type="OBJECT",
type=genai_types.Type.OBJECT,
properties={
"city": genai_types.Schema(
type="STRING",
type=genai_types.Type.STRING,
description="City name to look up.",
)
},
Expand Down Expand Up @@ -102,9 +102,9 @@ def _build_request(
thinking_budget=thinking_budget,
)
if enable_tool_call:
config_kwargs["system_instruction"] = (
"When the user asks about weather, call the provided tool exactly once."
)
config_kwargs[
"system_instruction"
] = "When the user asks about weather, call the provided tool exactly once."
config_kwargs["tools"] = [_build_weather_tool()]
if config_kwargs:
kwargs["config"] = genai_types.GenerateContentConfig(**config_kwargs)
Expand Down
2 changes: 1 addition & 1 deletion examples/hello_world_portkey_strands.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ async def main() -> None:
]

print(f"Streaming with model: {model_id}")
async for event in model.stream(messages=messages):
async for event in model.stream(messages=messages): # type: ignore[arg-type]
# Events follow the Strands stream event shape produced by our adapter.
if isinstance(event, dict) and "contentBlockDelta" in event:
delta = event["contentBlockDelta"].get("delta", {})
Expand Down
2 changes: 1 addition & 1 deletion portkey_ai/integrations/adk.py
Original file line number Diff line number Diff line change
Expand Up @@ -659,7 +659,7 @@ async def generate_content_async(
event, "output_index", len(streamed_function_calls_by_index)
)
if getattr(item, "arguments", None) is None:
item.arguments = ""
item.arguments = "" # type: ignore[union-attr]
streamed_function_calls_by_index[output_index] = item
key = _function_call_key(item)
if key:
Expand Down
2 changes: 1 addition & 1 deletion portkey_ai/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
VERSION = "2.2.0"
VERSION = "2.2.1"
9 changes: 7 additions & 2 deletions tests/integrations/test_adk_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,9 @@ async def test_streaming_merge_enriches_incomplete_final_response(

async def fake_stream_gen() -> AsyncIterator[Any]:
yield _FakeOutputItemAddedEvent(streamed_item, output_index=0)
yield _FakeFunctionArgsDeltaEvent('{"city":"SF"}', item_id="call_1", output_index=0)
yield _FakeFunctionArgsDeltaEvent(
'{"city":"SF"}', item_id="call_1", output_index=0
)
yield _FakeCompletedEvent(final_response)

async def fake_create(**kwargs: Any) -> AsyncIterator[Any]:
Expand Down Expand Up @@ -529,7 +531,10 @@ def test_ensure_strict_json_schema_nested_objects() -> None:
result = _ensure_strict_json_schema(schema)
assert result["additionalProperties"] is False
assert result["properties"]["location"]["additionalProperties"] is False
assert result["properties"]["location"]["properties"]["coords"]["additionalProperties"] is False
assert (
result["properties"]["location"]["properties"]["coords"]["additionalProperties"]
is False
)


def test_ensure_strict_json_schema_array_of_objects() -> None:
Expand Down
Loading