Skip to content

Commit

Permalink
chore(): use the ten_env logging module uniformly
Browse files Browse the repository at this point in the history
  • Loading branch information
sunshinexcode committed Dec 26, 2024
1 parent df670b3 commit bc47d09
Show file tree
Hide file tree
Showing 7 changed files with 4 additions and 63 deletions.
13 changes: 0 additions & 13 deletions agents/ten_packages/extension/llama_index_chat_engine/log.py

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
MAX_CHUNK_SIZE_BYTES = 1024


def _text_to_base64_chunks(text: str, msg_id: str) -> list:
def _text_to_base64_chunks(ten_env: TenEnv, text: str, msg_id: str) -> list:
# Ensure msg_id does not exceed 50 characters
if len(msg_id) > 36:
raise ValueError("msg_id cannot exceed 36 characters.")
Expand Down Expand Up @@ -85,7 +85,7 @@ def _text_to_base64_chunks(text: str, msg_id: str) -> list:
estimated_chunk_size -= 100 # Reduce content size gradually
count += 1

# logger.debug(f"chunk estimate guess: {count}")
# ten_env.log_debug(f"chunk estimate guess: {count}")

# Add the current chunk to the list
chunks.append(formatted_chunk)
Expand Down Expand Up @@ -215,7 +215,7 @@ def on_data(self, ten_env: TenEnv, data: Data) -> None:
}

try:
chunks = _text_to_base64_chunks(json.dumps(base_msg_data), message_id)
chunks = _text_to_base64_chunks(ten_env, json.dumps(base_msg_data), message_id)
for chunk in chunks:
asyncio.run_coroutine_threadsafe(self._queue_message(chunk), self.loop)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ async def _complete_with_history(self, ts: datetime, buff: bytearray):

i = 0
async for line in response.aiter_lines():
# logger.info(f"-> line {line}")
# ten_env.log_info(f"-> line {line}")
# if self._need_interrupt(ts):
# ten_env.log_warn(f"trace-id: {trace_id}, interrupted")
# if self.transcript:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ ten_package("openai_chatgpt_python") {
"__init__.py",
"addon.py",
"extension.py",
"log.py",
"manifest.json",
"property.json",
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,3 @@
#
#
from . import addon
from .log import logger

logger.info("openai_chatgpt_python extension loaded")
22 changes: 0 additions & 22 deletions agents/ten_packages/extension/openai_chatgpt_python/log.py

This file was deleted.

20 changes: 0 additions & 20 deletions agents/ten_packages/extension/vision_tool_python/log.py

This file was deleted.

0 comments on commit bc47d09

Please sign in to comment.