Skip to content

Commit 3dd1243

Browse files
committed
llc set coze2.0 runtime info
1 parent 4ff8a5c commit 3dd1243

5 files changed

Lines changed: 16 additions & 6 deletions

File tree

CHANGLOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
## [0.1.20] - 2025-11-10
1+
## [0.1.21] - 2025-12-23
2+
### Added
3+
- langchain callback set coze2.0 runtime info
4+
5+
## [0.1.20] - 2025-12-08
26
### Added
37
- langchain callback support langchain V1
48
- langchain callback support set tag and name

cozeloop/integration/langchain/trace_callback.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
from __future__ import annotations
55
import json
6+
import os
67
import time
78
import traceback
89
from typing import List, Dict, Union, Any, Optional, Callable, Protocol
@@ -324,8 +325,12 @@ def _new_flow_span(self, node_name: str, span_type: str, **kwargs: Any) -> Span:
324325
flow_span = _trace_callback_client.start_span(span_name, span_type, child_of=parent_span)
325326
run_id = str(kwargs['run_id'])
326327
self.run_map[run_id] = Run(run_id, flow_span, span_type)
327-
# set default tags
328-
flow_span.set_runtime(RuntimeInfo())
328+
# set runtime
329+
runtime_info = RuntimeInfo()
330+
scene = os.getenv('COZELOOP_SCENE')
331+
if scene:
332+
runtime_info.scene = scene
333+
flow_span.set_runtime(runtime_info)
329334
# set extra tags
330335
flow_span.set_tags(self._tags) # global tags
331336
try:

cozeloop/internal/trace/span.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,8 @@ def set_start_time_first_resp(self, start_time_first_resp: int):
368368

369369
def set_runtime(self, runtime: Runtime) -> None:
370370
r = runtime
371-
r.scene = V_SCENE_CUSTOM
371+
if r.scene is None or r.scene == "":
372+
r.scene = V_SCENE_CUSTOM
372373
with self.lock:
373374
if self.system_tag_map is None:
374375
self.system_tag_map = {}

cozeloop/internal/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
22
# SPDX-License-Identifier: MIT
33

4-
VERSION = 'v0.1.20'
4+
VERSION = 'v0.1.21'

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "cozeloop"
3-
version = "0.1.20"
3+
version = "0.1.21"
44
description = "coze loop sdk"
55
authors = ["JiangQi715 <jiangqi.rrt@bytedance.com>"]
66
license = "MIT"

0 commit comments

Comments
 (0)