-
Notifications
You must be signed in to change notification settings - Fork 7
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
feat: display token usage #77
Conversation
…0241212 merge upstream 20241212
* display token usage * adjust sidebar style * save session id as user name for client authorization * prompt users to provide openai api key if server community daily token limit reached * minor changes --------- Co-authored-by: fengsh <[email protected]>
Hi @fengsh27, many thanks for the PR! The chat is functional for me, but I don't see the actual tokens in the sidebar (they stay at 0). I built the Where is the sqlite database built in those use cases? Is it the Minor detail: I think it makes no sense to display the OncoKB radio button in the generic version of the |
Yes, it is supposed to display token usage for user-provided key, let me check what is wrong. The sqlite database is managed by biochatter-server. For OncoKB in generic app, it makes sense to disable it, I'll submit a fix for it, it won't take much efforts. |
@slobentanzer , I've submitted a fix in biochatter-server, which fixed an error in get_embedding_function. The error was introduced in upgrading langchain_community.openai to langchain_openai, in which the server ENV |
If the location is necessary for the functionality, wouldn't it make sense to set a reasonable default that works also in the context of running the server in docker compose, and only expect the user to set the variable if they want to override the default? |
Yes, the DATA_DIR is not necessary. Currently, it worked well without setting it as it already has default value "./data", see the following code in token_usage_database.py:
|
@slobentanzer, Could you please check if the fix in PR in biochatter-server resolves the issue that client-provided key does not work? |
@fengsh27 apologies for the delay, was working on another PR. I have now tested with the new server fix, it shows the tokens correctly. |
Server is merged and bumped to |
Thanks. It seems I forgot to disable OncoKB for generic app. I'll fix it with a separate PR. |
@slobentanzer I've made a submission to disable OncoKB feature for generic app |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fengsh27 thank you, looks good! Good to merge from my end.
Abstract
This submission is to display the token usage. If it reaches server daily token limit (ERROR_BIOSERVER_EXCEEDS_TOKEN_LIMIT), we will restrict further usage and encourage users to provide their OpenAI API key for access.
This PR also fixed #48