Skip to content

Commit 3c65b3b

Browse files
committed
formatting
1 parent 671a94f commit 3c65b3b

File tree

8 files changed

+86
-201
lines changed

8 files changed

+86
-201
lines changed

agentops/client/client.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ class Client:
4040
config: Config
4141
_initialized: bool
4242
_init_trace_context: Optional[TraceContext] = None # Stores the context of the auto-started trace
43-
_legacy_session_for_init_trace: Optional[Session] = (
44-
None # Stores the legacy Session wrapper for the auto-started trace
45-
)
43+
_legacy_session_for_init_trace: Optional[
44+
Session
45+
] = None # Stores the legacy Session wrapper for the auto-started trace
4646

4747
__instance = None # Class variable for singleton pattern
4848

agentops/instrumentation/agentic/google_adk/patch.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -304,16 +304,16 @@ def _extract_llm_attributes(llm_request_dict: dict, llm_response: Any) -> dict:
304304
elif "function_call" in part:
305305
# This is a function call in the response
306306
func_call = part["function_call"]
307-
attributes[MessageAttributes.COMPLETION_TOOL_CALL_NAME.format(i=0, j=tool_call_index)] = (
308-
func_call.get("name", "")
309-
)
310-
attributes[MessageAttributes.COMPLETION_TOOL_CALL_ARGUMENTS.format(i=0, j=tool_call_index)] = (
311-
json.dumps(func_call.get("args", {}))
312-
)
307+
attributes[
308+
MessageAttributes.COMPLETION_TOOL_CALL_NAME.format(i=0, j=tool_call_index)
309+
] = func_call.get("name", "")
310+
attributes[
311+
MessageAttributes.COMPLETION_TOOL_CALL_ARGUMENTS.format(i=0, j=tool_call_index)
312+
] = json.dumps(func_call.get("args", {}))
313313
if "id" in func_call:
314-
attributes[MessageAttributes.COMPLETION_TOOL_CALL_ID.format(i=0, j=tool_call_index)] = (
315-
func_call["id"]
316-
)
314+
attributes[
315+
MessageAttributes.COMPLETION_TOOL_CALL_ID.format(i=0, j=tool_call_index)
316+
] = func_call["id"]
317317
tool_call_index += 1
318318

319319
if text_parts:

agentops/instrumentation/agentic/openai_agents/attributes/completion.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,9 @@ def get_raw_response_attributes(response: Dict[str, Any]) -> Dict[str, Any]:
115115
result[MessageAttributes.COMPLETION_TOOL_CALL_NAME.format(i=j, j=k)] = function.get(
116116
"name", ""
117117
)
118-
result[MessageAttributes.COMPLETION_TOOL_CALL_ARGUMENTS.format(i=j, j=k)] = (
119-
function.get("arguments", "")
120-
)
118+
result[
119+
MessageAttributes.COMPLETION_TOOL_CALL_ARGUMENTS.format(i=j, j=k)
120+
] = function.get("arguments", "")
121121

122122
return result
123123

agentops/instrumentation/agentic/smolagents/attributes/model.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -102,13 +102,13 @@ def get_model_attributes(
102102
if hasattr(return_value, "tool_calls") and return_value.tool_calls:
103103
for j, tool_call in enumerate(return_value.tool_calls):
104104
if hasattr(tool_call, "function"):
105-
attributes[MessageAttributes.COMPLETION_TOOL_CALL_NAME.format(i=0, j=j)] = (
106-
tool_call.function.name
107-
)
105+
attributes[
106+
MessageAttributes.COMPLETION_TOOL_CALL_NAME.format(i=0, j=j)
107+
] = tool_call.function.name
108108
if hasattr(tool_call.function, "arguments"):
109-
attributes[MessageAttributes.COMPLETION_TOOL_CALL_ARGUMENTS.format(i=0, j=j)] = (
110-
tool_call.function.arguments
111-
)
109+
attributes[
110+
MessageAttributes.COMPLETION_TOOL_CALL_ARGUMENTS.format(i=0, j=j)
111+
] = tool_call.function.arguments
112112
if hasattr(tool_call, "id"):
113113
attributes[MessageAttributes.COMPLETION_TOOL_CALL_ID.format(i=0, j=j)] = tool_call.id
114114

agentops/instrumentation/common/attributes.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,8 @@ class IndexedAttribute(Protocol):
9898
formatting of attribute keys based on the indices.
9999
"""
100100

101-
def format(self, *, i: int, j: Optional[int] = None) -> str: ...
101+
def format(self, *, i: int, j: Optional[int] = None) -> str:
102+
...
102103

103104

104105
IndexedAttributeMap = Dict[IndexedAttribute, str] # target_attribute_key: source_attribute

tests/unit/instrumentation/openai_core/test_instrumentor.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,9 @@ def test_instrument_method_wraps_response_api(self, instrumentor):
107107
instrumentor_obj._custom_wrap()
108108

109109
# Verify wrap_function_wrapper was called for Response API methods
110-
assert (
111-
mock_wfw.call_count >= 2
112-
), f"Expected at least 2 calls to wrap_function_wrapper, got {mock_wfw.call_count}"
110+
assert mock_wfw.call_count >= 2, (
111+
f"Expected at least 2 calls to wrap_function_wrapper, got {mock_wfw.call_count}"
112+
)
113113

114114
# Find Response API calls
115115
response_api_calls = []

tests/unit/sdk/instrumentation_tester.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,7 @@ def reset_trace_globals():
4545

4646
class HasAttributesViaProperty(Protocol):
4747
@property
48-
def attributes(self) -> Attributes:
49-
...
48+
def attributes(self) -> Attributes: ...
5049

5150

5251
class HasAttributesViaAttr(Protocol):

0 commit comments

Comments
 (0)