Skip to content

Commit c1a034f

Browse files
authored
support annotation (#7)
* support annotation
1 parent 2ee9d35 commit c1a034f

14 files changed

+918
-0
lines changed

cozeloop/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
from .client import Client
1414
from ._client import (
1515
new_client,
16+
set_default_client,
1617
workspace_id,
1718
close,
1819
get_prompt,

cozeloop/_client.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,18 @@ def flush(self):
258258
self._trace_provider.flush()
259259

260260

261+
def set_default_client(client: Client):
262+
global _default_client
263+
with _client_lock:
264+
if _default_client:
265+
temp_client = _default_client
266+
_default_client = client
267+
if temp_client != client:
268+
temp_client.close()
269+
else:
270+
_default_client = client
271+
272+
261273
def get_default_client() -> Client:
262274
global _default_client
263275
if _default_client is None:

cozeloop/decorator/__init__.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
2+
# SPDX-License-Identifier: MIT
3+
4+
from cozeloop.decorator.decorator import CozeLoopDecorator
5+
6+
coze_loop_decorator= CozeLoopDecorator()
7+
observe = coze_loop_decorator.observe

0 commit comments

Comments
 (0)