khoj/src/khoj
Debanjum c53c3db96b Track, return cost and usage metrics in chat api response
- Track input, output token usage and cost for interactions
  via chat api with openai, anthropic and google chat models

- Get usage metadata from OpenAI using stream_options
- Handle openai proxies that do not support passing usage in response

- Add new usage, end response  events returned by chat api.
  - This can be optionally consumed by clients at a later point
  - Update streaming clients to mark message as completed after new
    end response event, not after end llm response event
- Ensure usage data from final response generation step is included
  - Pass usage data after llm response complete. This allows gathering
    token usage and cost for the final response generation step across
    streaming and non-streaming modes
2024-11-20 12:17:58 -08:00
..
app Fix static file folder path for the pypi build 2024-08-06 13:24:26 +05:30
database Fix database connections leakage (#980) 2024-11-17 19:15:05 +01:00
interface Delete unused favicon ico in old web app directory 2024-11-17 02:08:20 -08:00
migrations Support customization of the OpenAI base url in admin settings (#725) 2024-04-27 18:24:35 +05:30
processor Track, return cost and usage metrics in chat api response 2024-11-20 12:17:58 -08:00
routers Track, return cost and usage metrics in chat api response 2024-11-20 12:17:58 -08:00
search_filter Extract date filters quoted with non-ascii quotes in query 2024-10-10 04:45:00 -07:00
search_type Do not CRUD on entries, files & conversations in DB for null user 2024-11-11 12:20:07 -08:00
utils Track, return cost and usage metrics in chat api response 2024-11-20 12:17:58 -08:00
__init__.py Use the src/ layout to fix packaging Khoj for PyPi 2023-02-14 15:19:06 -06:00
configure.py And a connections clean up decorator to all scheduled tasks 2024-11-18 17:19:36 -08:00
main.py Do not start server when importing the main.py file, unless gunicorn 2024-11-14 17:36:51 -08:00
manage.py Move the django app into the src/khoj folder for better organization and functionality 2023-11-21 10:56:04 -08:00