Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding suffix to tracker decorator #169

Merged
merged 2 commits into from
Dec 3, 2024
Merged

Conversation

ThibaultLSDC
Copy link
Collaborator

No description provided.

@ThibaultLSDC
Copy link
Collaborator Author

updating the decorator behavior would be tedious, and not as convenient as i wanted it to be, ie it would need the partial decorator:

@partial(tracker, suffix='main')
def get_action(...

which is a one liner but still uses fancy stuff

on the other hand the current approach is more lines but more simple:

with set_tracker('main') as main_tracker:
    # do llm stuff
    with set_tracker('sub_agent') as sub_tracker:
        # do other llm stuff
stats = main_tracker.get_stats()
stats.update(sub_tracker.get_stats())

more stuff to keep track of but also so much easier to implement and the decorator still works for one level scope :)

@ThibaultLSDC ThibaultLSDC requested a review from recursix December 3, 2024 16:36
Copy link
Collaborator

@recursix recursix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very simple.

Does the main_tracker cost report sub_tracker + other_usager or it just report Other_usage i.e. everything tracked under sub_tracker is not seen by the main tracker?

@ThibaultLSDC
Copy link
Collaborator Author

main_tracker trasks everything inside its scope following this test

def test_imbricate_trackers():

@ThibaultLSDC ThibaultLSDC merged commit e411f7d into main Dec 3, 2024
6 checks passed
@ThibaultLSDC ThibaultLSDC deleted the tlsdc/tracker_update branch December 3, 2024 20:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants