Skip to content

Commit cba5fdc

Browse files
committed
fix build
1 parent 8898d8d commit cba5fdc

File tree

5 files changed

+30
-18
lines changed

5 files changed

+30
-18
lines changed

sdk/agentserver/azure-ai-agentserver-agentframework/azure/ai/agentserver/agentframework/models/agent_framework_output_streaming_converter.py

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
import datetime
99
import json
10-
from typing import Any, AsyncIterable, List, Optional
10+
from typing import Any, AsyncIterable, List
1111

1212
from agent_framework import AgentRunResponseUpdate, BaseContent, FunctionApprovalRequestContent, FunctionResultContent
1313
from agent_framework._types import (
@@ -48,7 +48,7 @@
4848
class _BaseStreamingState:
4949
"""Base interface for streaming state handlers."""
5050

51-
def convert_contents(self, contents: AsyncIterable[BaseContent]) -> AsyncIterable[ResponseStreamEvent]: # pylint: disable=unused-argument
51+
async def convert_contents(self, contents: AsyncIterable[BaseContent]) -> AsyncIterable[ResponseStreamEvent]: # pylint: disable=unused-argument
5252
raise NotImplementedError
5353

5454

@@ -126,7 +126,9 @@ class _FunctionCallStreamingState(_BaseStreamingState):
126126
def __init__(self, parent: AgentFrameworkOutputStreamingConverter):
127127
self._parent = parent
128128

129-
async def convert_contents(self, contents: AsyncIterable[FunctionCallContent]) -> AsyncIterable[ResponseStreamEvent]:
129+
async def convert_contents(
130+
self, contents: AsyncIterable[FunctionCallContent]
131+
) -> AsyncIterable[ResponseStreamEvent]:
130132
content_by_call_id = {}
131133
ids_by_call_id = {}
132134

@@ -149,18 +151,17 @@ async def convert_contents(self, contents: AsyncIterable[FunctionCallContent]) -
149151
arguments="",
150152
),
151153
)
152-
continue
153154
else:
154155
content_by_call_id[content.call_id] = content_by_call_id[content.call_id] + content
155156
item_id, output_index = ids_by_call_id[content.call_id]
156157

157-
args_delta = content.arguments if isinstance(content.arguments, str) else ""
158-
yield ResponseFunctionCallArgumentsDeltaEvent(
159-
sequence_number=self._parent.next_sequence(),
160-
item_id=item_id,
161-
output_index=output_index,
162-
delta=args_delta,
163-
)
158+
args_delta = content.arguments if isinstance(content.arguments, str) else ""
159+
yield ResponseFunctionCallArgumentsDeltaEvent(
160+
sequence_number=self._parent.next_sequence(),
161+
item_id=item_id,
162+
output_index=output_index,
163+
delta=args_delta,
164+
)
164165

165166
for call_id, content in content_by_call_id.items():
166167
item_id, output_index = ids_by_call_id[call_id]
@@ -194,7 +195,9 @@ class _FunctionCallOutputStreamingState(_BaseStreamingState):
194195
def __init__(self, parent: AgentFrameworkOutputStreamingConverter):
195196
self._parent = parent
196197

197-
async def convert_contents(self, contents: AsyncIterable[FunctionResultContent]) -> AsyncIterable[ResponseStreamEvent]:
198+
async def convert_contents(
199+
self, contents: AsyncIterable[FunctionResultContent]
200+
) -> AsyncIterable[ResponseStreamEvent]:
198201
async for content in contents:
199202
item_id = self._parent.context.id_generator.generate_function_output_id()
200203
output_index = self._parent.next_output_index()
@@ -281,7 +284,7 @@ async def convert(self, updates: AsyncIterable[AgentRunResponseUpdate]) -> Async
281284
)
282285

283286
is_changed = (
284-
lambda a, b: a is not None and b is not None and a.message_id != b.message_id
287+
lambda a, b: a is not None and b is not None and a.message_id != b.message_id # pylint: disable=unnecessary-lambda-assignment
285288
)
286289
async for group in chunk_on_change(updates, is_changed):
287290
has_value, first, contents = await peek(self._read_updates(group))

sdk/agentserver/azure-ai-agentserver-agentframework/azure/ai/agentserver/agentframework/models/utils/async_iter.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from __future__ import annotations
55

66
from collections.abc import AsyncIterable, AsyncIterator, Callable
7-
from typing import TypeVar, Optional, Tuple, Awaitable
7+
from typing import TypeVar, Optional, Tuple
88

99
TSource = TypeVar("TSource")
1010
TKey = TypeVar("TKey")
@@ -19,9 +19,12 @@ async def chunk_on_change(
1919
Chunks an async iterable into groups based on when consecutive elements change.
2020
2121
:param source: Async iterable of items.
22+
:type source: AsyncIterable[TSource]
2223
:param is_changed: Function(prev, current) -> bool indicating if value changed.
2324
If None, uses != by default.
25+
:type is_changed: Optional[Callable[[Optional[TSource], Optional[TSource]], bool]]
2426
:return: An async iterator of async iterables (chunks).
27+
:rtype: AsyncIterator[AsyncIterable[TSource]]
2528
"""
2629

2730
if is_changed is None:
@@ -46,9 +49,13 @@ async def chunk_by_key(
4649
Chunks the async iterable into groups based on a key selector.
4750
4851
:param source: Async iterable of items.
52+
:type source: AsyncIterable[TSource]
4953
:param key_selector: Function mapping item -> key.
54+
:type key_selector: Callable[[TSource], TKey]
5055
:param key_equal: Optional equality function for keys. Defaults to '=='.
56+
:type key_equal: Optional[Callable[[TKey, TKey], bool]]
5157
:return: An async iterator of async iterables (chunks).
58+
:rtype: AsyncIterator[AsyncIterable[TSource]]
5259
"""
5360

5461
if key_equal is None:
@@ -104,7 +111,9 @@ async def peek(
104111
Peeks at the first element of an async iterable without consuming it.
105112
106113
:param source: Async iterable.
114+
:type source: AsyncIterable[T]
107115
:return: (has_value, first, full_sequence_including_first)
116+
:rtype: Tuple[bool, Optional[T], AsyncIterable[T]]
108117
"""
109118

110119
it = source.__aiter__()
@@ -131,6 +140,6 @@ async def sequence() -> AsyncIterator[T]:
131140

132141

133142
async def _empty_async() -> AsyncIterator[T]:
134-
if False:
143+
if False: # pylint: disable=using-constant-test
135144
# This is just to make this an async generator for typing
136145
yield None # type: ignore[misc]

sdk/agentserver/azure-ai-agentserver-core/azure/ai/agentserver/core/client/tools/_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# ---------------------------------------------------------
22
# Copyright (c) Microsoft Corporation. All rights reserved.
33
# ---------------------------------------------------------
4-
4+
# pylint: disable=protected-access
55
from typing import Any, List, Mapping, Union
66
from azure.core import PipelineClient
77
from azure.core.pipeline import policies

sdk/agentserver/azure-ai-agentserver-core/azure/ai/agentserver/core/client/tools/aio/_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# ---------------------------------------------------------
22
# Copyright (c) Microsoft Corporation. All rights reserved.
33
# ---------------------------------------------------------
4-
4+
# pylint: disable=protected-access,do-not-import-asyncio
55
from typing import Any, List, Mapping, Union, TYPE_CHECKING
66
from asyncio import gather
77
from azure.core import AsyncPipelineClient

sdk/agentserver/azure-ai-agentserver-langgraph/azure/ai/agentserver/langgraph/langgraph.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# ---------------------------------------------------------
22
# Copyright (c) Microsoft Corporation. All rights reserved.
33
# ---------------------------------------------------------
4-
# pylint: disable=logging-fstring-interpolation,broad-exception-caught
4+
# pylint: disable=logging-fstring-interpolation,broad-exception-caught,no-member
55
# mypy: disable-error-code="assignment,arg-type"
66
import os
77
import re

0 commit comments

Comments
 (0)