Open zainhoda opened 9 months ago
Hi I am new to contributing for open source and would like to contribute to this project.
It would be nice to be able to log metrics on times response and token consumption and other related stuff
@pedro-geraghty-sw are you going to work on it?. I thought of fixing this issue.
@pedro-geraghty-sw are you gonna work on it?. I thought of fixing this issue.
Go ahead
Thoughts:
Thoughts:
- The log function should take the same severity levels as the building logging module as an optional kwarg. Default is INFO?
- If we're smart, it could also support structured logging eg structlog.
Agreed. Also, I think it would be good for generate_sql
to start with a uuid as a trace_id that gets passed into all the constituent functions so that logs for the same generate_sql
request can easily be connected
You can assign this ticket to me. Thank You
@justbee007 What is the status on this?
I can make a PR for this today, as I need it for one of my projects very urgently.
I have made similar logging solutions for framework before, so should not be that difficult. I can tag you in, @justbee007, if you wish to contribute to the PR.
cc: @zainhoda
@andreped Yes Please you can make a PR and tag me in. We can work on this together.
@andreped Yes Please you can make a PR and tag me in. We can work on this together.
Drafted a PR: https://github.com/vanna-ai/vanna/pull/234
Feel free to suggest improvements. I already hinted at some potential suggestions in the PR comments.
I think it would be good for
generate_sql
to start with a uuid as a trace_id that gets passed into all the constituent functions so that logs for the samegenerate_sql
request can easily be connected
@zainhoda If you hint me in the right direction in the PR with an example, I can make an attempt. Feel free to review the PR :]
Was this PR merged and released?
Was this PR merged and released?
@talrejanikhil No, but I believe @zainhoda implemented a different solution. Not sure though.
Instead of using hardcoded print statements, there should be a logging function in the base class. That logging function in particular should be called before submitting the prompt so that you can log what the fully constructed prompt looks like.
By default, the log function in the base class should just be a print statement. If a user wants to send logs to a specific destination, they can just override the log function.