Skip to content

Commit d65b0a5

Browse files
committed
feat: update code
1 parent e1299a4 commit d65b0a5

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

veadk/tracing/telemetry/attributes/extractors/llm_attributes_extractors.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,9 @@ def llm_gen_ai_is_streaming(params: LLMAttributesParams) -> ExtractorResponse:
514514
ExtractorResponse: Response containing None
515515
"""
516516
is_streaming = bool(
517-
params.invocation_context.run_config and params.invocation_context.run_config.streaming_mode != StreamingMode.NONE)
517+
params.invocation_context.run_config
518+
and params.invocation_context.run_config.streaming_mode != StreamingMode.NONE
519+
)
518520

519521
return ExtractorResponse(content=is_streaming)
520522

@@ -807,6 +809,7 @@ def llm_gen_ai_request_functions(params: LLMAttributesParams) -> ExtractorRespon
807809

808810
return ExtractorResponse(content=functions)
809811

812+
810813
def llm_server_address(params: LLMAttributesParams) -> ExtractorResponse:
811814
"""Extract the LLM server address (model API base URL).
812815
@@ -820,7 +823,10 @@ def llm_server_address(params: LLMAttributesParams) -> ExtractorResponse:
820823
Returns:
821824
ExtractorResponse: Response containing the server address or 'unknown'
822825
"""
823-
return ExtractorResponse(content=getattr(params.invocation_context.agent, "model_api_base", None) or "unknown")
826+
return ExtractorResponse(
827+
content=getattr(params.invocation_context.agent, "model_api_base", None)
828+
or "unknown"
829+
)
824830

825831

826832
LLM_ATTRIBUTES = {

veadk/tracing/telemetry/exporters/apmplus_exporter.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
import os
1615
import time
1716
from dataclasses import dataclass
1817
from typing import Any
@@ -36,7 +35,6 @@
3635
from typing_extensions import override
3736

3837
from veadk.config import settings
39-
from veadk.consts import DEFAULT_MODEL_AGENT_API_BASE
4038
from veadk.tracing.telemetry.exporters.base_exporter import BaseExporter
4139
from veadk.utils.logger import get_logger
4240

@@ -300,15 +298,19 @@ def record_call_llm(
300298
llm_response: Response object with content and usage metadata
301299
"""
302300
is_streaming = bool(
303-
invocation_context.run_config and invocation_context.run_config.streaming_mode != StreamingMode.NONE)
304-
server_address = getattr(invocation_context.agent, "model_api_base", None) or "unknown"
301+
invocation_context.run_config
302+
and invocation_context.run_config.streaming_mode != StreamingMode.NONE
303+
)
304+
server_address = (
305+
getattr(invocation_context.agent, "model_api_base", None) or "unknown"
306+
)
305307
attributes = {
306308
"gen_ai_system": "volcengine",
307309
"gen_ai_response_model": llm_request.model,
308310
"gen_ai_operation_name": "chat",
309311
"gen_ai_operation_type": "llm",
310312
"stream": is_streaming,
311-
"server_address": server_address,
313+
"server_address": server_address,
312314
} # required by Volcengine APMPlus
313315

314316
if llm_response.usage_metadata:

0 commit comments

Comments
 (0)