Skip to content

Commit

Permalink
merge all token tracker (#111)
Browse files Browse the repository at this point in the history
  • Loading branch information
TengHu authored Dec 30, 2023
1 parent 111ad3a commit 07290db
Show file tree
Hide file tree
Showing 7 changed files with 4 additions and 135 deletions.
2 changes: 1 addition & 1 deletion actionweaver/llms/azure/chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@

from actionweaver.actions.action import Action, ActionHandlers
from actionweaver.llms.azure.functions import Functions
from actionweaver.llms.azure.tokens import TokenUsageTracker
from actionweaver.telemetry import traceable
from actionweaver.utils import DEFAULT_ACTION_SCOPE
from actionweaver.utils.stream import get_first_element_and_iterator, merge_dicts
from actionweaver.utils.tokens import TokenUsageTracker

# TODO: support AsyncAzureOpenAI

Expand Down
46 changes: 0 additions & 46 deletions actionweaver/llms/general/tokens.py

This file was deleted.

6 changes: 2 additions & 4 deletions actionweaver/llms/openai/functions/chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@

from actionweaver.actions.action import Action, ActionHandlers
from actionweaver.llms.openai.functions.functions import Functions
from actionweaver.llms.openai.functions.tokens import TokenUsageTracker
from actionweaver.utils import DEFAULT_ACTION_SCOPE
from actionweaver.utils.stream import get_first_element_and_iterator, merge_dicts
from actionweaver.utils.tokens import TokenUsageTracker


class OpenAIChatCompletionException(Exception):
Expand All @@ -27,9 +27,7 @@ class OpenAIChatCompletion:
def __init__(self, model, token_usage_tracker=None, logger=None):
self.model = model
self.logger = logger or logging.getLogger(__name__)
self.token_usage_tracker = token_usage_tracker or TokenUsageTracker(
logger=logger
)
self.token_usage_tracker = token_usage_tracker or TokenUsageTracker()
self.client = OpenAI()

print(
Expand Down
46 changes: 0 additions & 46 deletions actionweaver/llms/openai/functions/tokens.py

This file was deleted.

2 changes: 1 addition & 1 deletion actionweaver/llms/openai/tools/chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
)

from actionweaver.actions.action import Action, ActionHandlers
from actionweaver.llms.openai.tools.tokens import TokenUsageTracker
from actionweaver.llms.openai.tools.tools import Tools
from actionweaver.telemetry import traceable
from actionweaver.utils import DEFAULT_ACTION_SCOPE
from actionweaver.utils.stream import get_first_element_and_iterator, merge_dicts
from actionweaver.utils.tokens import TokenUsageTracker


class OpenAIChatCompletionException(Exception):
Expand Down
35 changes: 0 additions & 35 deletions actionweaver/llms/openai/tools/tokens.py

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import collections
import logging
import time
from typing import Dict


Expand Down

0 comments on commit 07290db

Please sign in to comment.