From 742748d2110bffaed959bb28b30f1de5879dc759 Mon Sep 17 00:00:00 2001 From: Chandra Kiran G Date: Thu, 16 Apr 2026 11:35:58 +0530 Subject: [PATCH 1/4] fix: All lintint and formatting errors --- examples/adk_streaming_thinking_usage.py | 10 +++++----- examples/hello_world_portkey_strands.py | 2 +- portkey_ai/integrations/adk.py | 2 +- portkey_ai/integrations/strands.py | 6 +++--- tests/integrations/test_adk_adapter.py | 9 +++++++-- 5 files changed, 17 insertions(+), 12 deletions(-) diff --git a/examples/adk_streaming_thinking_usage.py b/examples/adk_streaming_thinking_usage.py index 67322b06..4cbc4c21 100644 --- a/examples/adk_streaming_thinking_usage.py +++ b/examples/adk_streaming_thinking_usage.py @@ -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.", ) }, @@ -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) diff --git a/examples/hello_world_portkey_strands.py b/examples/hello_world_portkey_strands.py index a3453000..edef0425 100644 --- a/examples/hello_world_portkey_strands.py +++ b/examples/hello_world_portkey_strands.py @@ -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", {}) diff --git a/portkey_ai/integrations/adk.py b/portkey_ai/integrations/adk.py index 4685fb3d..2d3946f4 100644 --- a/portkey_ai/integrations/adk.py +++ b/portkey_ai/integrations/adk.py @@ -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: diff --git a/portkey_ai/integrations/strands.py b/portkey_ai/integrations/strands.py index e07c81c8..e2379d40 100644 --- a/portkey_ai/integrations/strands.py +++ b/portkey_ai/integrations/strands.py @@ -124,13 +124,13 @@ def format_messages( ): formatted.append({"role": role, "content": part["text"]}) elif isinstance(part, dict) and "toolUse" in part: - formatted.append(self._format_tool_use_part(part)) + formatted.append(self._format_tool_use_part(part)) # type: ignore[arg-type] elif ( isinstance(part, dict) and "toolResult" in part and self._current_tool_use_id is not None ): - formatted.append(self._format_tool_result_part(part)) + formatted.append(self._format_tool_result_part(part)) # type: ignore[arg-type] return formatted @@ -339,7 +339,7 @@ async def stream( state["tool_use_id"] = None state["tool_name"] = None - async def structured_output( + async def structured_output( # type: ignore[override] self, output_model: "Type[T]", prompt: List[dict[str, Any]], diff --git a/tests/integrations/test_adk_adapter.py b/tests/integrations/test_adk_adapter.py index f6217e78..ac45d832 100644 --- a/tests/integrations/test_adk_adapter.py +++ b/tests/integrations/test_adk_adapter.py @@ -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]: @@ -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: From dfb23f321b69f29e9d325b3095e4fc73c03496f6 Mon Sep 17 00:00:00 2001 From: Narendranath Gogineni Date: Thu, 16 Apr 2026 12:36:12 +0530 Subject: [PATCH 2/4] remove unnecessary cahnges --- portkey_ai/integrations/strands.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/portkey_ai/integrations/strands.py b/portkey_ai/integrations/strands.py index e2379d40..e07c81c8 100644 --- a/portkey_ai/integrations/strands.py +++ b/portkey_ai/integrations/strands.py @@ -124,13 +124,13 @@ def format_messages( ): formatted.append({"role": role, "content": part["text"]}) elif isinstance(part, dict) and "toolUse" in part: - formatted.append(self._format_tool_use_part(part)) # type: ignore[arg-type] + formatted.append(self._format_tool_use_part(part)) elif ( isinstance(part, dict) and "toolResult" in part and self._current_tool_use_id is not None ): - formatted.append(self._format_tool_result_part(part)) # type: ignore[arg-type] + formatted.append(self._format_tool_result_part(part)) return formatted @@ -339,7 +339,7 @@ async def stream( state["tool_use_id"] = None state["tool_name"] = None - async def structured_output( # type: ignore[override] + async def structured_output( self, output_model: "Type[T]", prompt: List[dict[str, Any]], From 2b406d19395f24f1c816ada36bd68043ce3ac933 Mon Sep 17 00:00:00 2001 From: Narendranath Gogineni Date: Thu, 16 Apr 2026 12:46:34 +0530 Subject: [PATCH 3/4] bump version --- portkey_ai/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/portkey_ai/version.py b/portkey_ai/version.py index 3c00bb49..3f755ed2 100644 --- a/portkey_ai/version.py +++ b/portkey_ai/version.py @@ -1 +1 @@ -VERSION = "2.2.0" +VERSION = "2.2.1" From aea17cf1927635d64d56a918ea95f3572397d278 Mon Sep 17 00:00:00 2001 From: Narendranath Gogineni <47327611+narengogi@users.noreply.github.com> Date: Mon, 20 Apr 2026 12:21:41 +0530 Subject: [PATCH 4/4] update version to minor --- portkey_ai/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/portkey_ai/version.py b/portkey_ai/version.py index 3f755ed2..707faadc 100644 --- a/portkey_ai/version.py +++ b/portkey_ai/version.py @@ -1 +1 @@ -VERSION = "2.2.1" +VERSION = "2.3.0"