Skip to content

Commit 61aa9f9

Browse files
committed
fix format
1 parent f5b8624 commit 61aa9f9

File tree

7 files changed

+20
-18
lines changed

7 files changed

+20
-18
lines changed

examples/basic/stream_function_call_args.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ async def main():
3535

3636
result = Runner.run_streamed(
3737
agent,
38-
input="Create a Python web project called 'my-app' with FastAPI. Version 1.0.0, dependencies: fastapi, uvicorn"
38+
input="Create a Python web project called 'my-app' with FastAPI. Version 1.0.0, dependencies: fastapi, uvicorn",
3939
)
4040

4141
# Track function calls for detailed output
@@ -50,23 +50,20 @@ async def main():
5050
function_name = getattr(event.data.item, "name", "unknown")
5151
call_id = getattr(event.data.item, "call_id", "unknown")
5252

53-
function_calls[call_id] = {
54-
'name': function_name,
55-
'arguments': ""
56-
}
53+
function_calls[call_id] = {"name": function_name, "arguments": ""}
5754
current_active_call_id = call_id
5855
print(f"\n📞 Function call streaming started: {function_name}()")
5956
print("📝 Arguments building...")
6057

6158
# Real-time argument streaming
6259
elif isinstance(event.data, ResponseFunctionCallArgumentsDeltaEvent):
6360
if current_active_call_id and current_active_call_id in function_calls:
64-
function_calls[current_active_call_id]['arguments'] += event.data.delta
61+
function_calls[current_active_call_id]["arguments"] += event.data.delta
6562
print(event.data.delta, end="", flush=True)
6663

6764
# Function call completed
6865
elif event.data.type == "response.output_item.done":
69-
if hasattr(event.data.item, 'call_id'):
66+
if hasattr(event.data.item, "call_id"):
7067
call_id = getattr(event.data.item, "call_id", "unknown")
7168
if call_id in function_calls:
7269
function_info = function_calls[call_id]

examples/customer_service/main.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,10 @@ class AirlineAgentContext(BaseModel):
4040
)
4141
async def faq_lookup_tool(question: str) -> str:
4242
question_lower = question.lower()
43-
if any(keyword in question_lower for keyword in ["bag", "baggage", "luggage", "carry-on", "hand luggage", "hand carry"]):
43+
if any(
44+
keyword in question_lower
45+
for keyword in ["bag", "baggage", "luggage", "carry-on", "hand luggage", "hand carry"]
46+
):
4447
return (
4548
"You are allowed to bring one bag on the plane. "
4649
"It must be under 50 pounds and 22 inches x 14 inches x 9 inches."
@@ -52,7 +55,10 @@ async def faq_lookup_tool(question: str) -> str:
5255
"Exit rows are rows 4 and 16. "
5356
"Rows 5-8 are Economy Plus, with extra legroom. "
5457
)
55-
elif any(keyword in question_lower for keyword in ["wifi", "internet", "wireless", "connectivity", "network", "online"]):
58+
elif any(
59+
keyword in question_lower
60+
for keyword in ["wifi", "internet", "wireless", "connectivity", "network", "online"]
61+
):
5662
return "We have free wifi on the plane, join Airline-Wifi"
5763
return "I'm sorry, I don't know the answer to that question."
5864

src/agents/handoffs.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,9 @@ class Handoff(Generic[TContext, TAgent]):
119119
True, as it increases the likelihood of correct JSON input.
120120
"""
121121

122-
is_enabled: bool | Callable[
123-
[RunContextWrapper[Any], AgentBase[Any]], MaybeAwaitable[bool]
124-
] = True
122+
is_enabled: bool | Callable[[RunContextWrapper[Any], AgentBase[Any]], MaybeAwaitable[bool]] = (
123+
True
124+
)
125125
"""Whether the handoff is enabled. Either a bool or a Callable that takes the run context and
126126
agent and returns whether the handoff is enabled. You can use this to dynamically enable/disable
127127
a handoff based on your context/state."""

src/agents/model_settings.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ class MCPToolChoice:
5555
ToolChoice: TypeAlias = Union[Literal["auto", "required", "none"], str, MCPToolChoice, None]
5656

5757

58-
5958
@dataclass
6059
class ModelSettings:
6160
"""Settings to use when calling an LLM.

src/agents/tracing/processors.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ def set_api_key(self, api_key: str):
7070
client.
7171
"""
7272
# Clear the cached property if it exists
73-
if 'api_key' in self.__dict__:
74-
del self.__dict__['api_key']
73+
if "api_key" in self.__dict__:
74+
del self.__dict__["api_key"]
7575

7676
# Update the private attribute
7777
self._api_key = api_key

tests/test_agent_clone_shallow_copy.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
def greet(name: str) -> str:
66
return f"Hello, {name}!"
77

8+
89
def test_agent_clone_shallow_copy():
910
"""Test that clone creates shallow copy with tools.copy() workaround"""
1011
target_agent = Agent(name="Target")
@@ -16,9 +17,7 @@ def test_agent_clone_shallow_copy():
1617
)
1718

1819
cloned = original.clone(
19-
name="Cloned",
20-
tools=original.tools.copy(),
21-
handoffs=original.handoffs.copy()
20+
name="Cloned", tools=original.tools.copy(), handoffs=original.handoffs.copy()
2221
)
2322

2423
# Basic assertions

tests/test_stream_events.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ async def foo() -> str:
1414
await asyncio.sleep(3)
1515
return "success!"
1616

17+
1718
@pytest.mark.asyncio
1819
async def test_stream_events_main():
1920
model = FakeModel()

0 commit comments

Comments
 (0)