Skip to content

Conversation

@KeremTurgutlu
Copy link
Contributor

@KeremTurgutlu KeremTurgutlu commented Nov 14, 2025

This PR adds sqlite based usage and cost monitoring.

Important Notes

Litellm PR is not a blocker for this PR, once litellm team merges it, the following formula will give the total AI cost even with stream=True:

def total_cost(self:Usage, sc=0.01): return self.response_cost + sc * ifnone(self.web_search_requests, 0)

Fixes: #49

@KeremTurgutlu KeremTurgutlu marked this pull request as ready for review November 14, 2025 15:33
@jph00
Copy link
Contributor

jph00 commented Nov 15, 2025

Currently this make fastlite a strict dependency AFAICT, but doesn't add it to settings.ini. I don't think we should make it a dep, since most people won't need this.

Probably just moving it to a separate module would suffice?

BTW, are we using cachy? If so, why are all the outputs changing? (And if not - we should be! :) )

@KeremTurgutlu
Copy link
Contributor Author

KeremTurgutlu commented Nov 15, 2025

Currently this make fastlite a strict dependency AFAICT, but doesn't add it to settings.ini. I don't think we should make it a dep, since most people won't need this.
Probably just moving it to a separate module would suffice?

Sounds good

BTW, are we using cachy? If so, why are all the outputs changing? (And if not - we should be! :) )

Yes, cachy is enabled. I just reverted my changes, re-ran the notebook and there are still changes but no new entries in cachy json file. Diffs are mainly from non-existing output (maybe those message outputs were left empty and weren't run in a previous commit), and in some cases they are from new line characters (maybe related to a rendering change).

Running the nb multiple times actually still produce few new line diffs for me. So, it appears to be not a problem with cachy but rather a flakiness with how things are rendered. Will have a deeper look at it.

image image

Copy link
Contributor

@jph00 jph00 left a comment

Choose a reason for hiding this comment

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

Looks like we're nearly there! :)

@KeremTurgutlu KeremTurgutlu requested review from jph00 and ncoop57 and removed request for RensDimmendaal November 20, 2025 10:32
@jph00
Copy link
Contributor

jph00 commented Nov 21, 2025

Thanks! :)

@jph00 jph00 merged commit 2e663ed into main Nov 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Usage and cost logging

5 participants