-
Notifications
You must be signed in to change notification settings - Fork 258
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Send metadata with llm response (#413)
* Added metadata field which sends usage details with LLM response * structure tool version bump * Reverted prompt version manager change * Minor refactor * Updated logs * Minor improvement * Renamed function * Added token cost calculation * Updated SDK and adapters version * Fixed security hotspot * Tool version bump * SDK and Adapters version bump * SDK and Adapters version bump in backend * Minor Fixes Fixed missing module issues Remove numpy usage and replaced with logic Addressed review comments
- Loading branch information
1 parent
3605310
commit 3ad95cb
Showing
28 changed files
with
1,024 additions
and
558 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
backend/usage/migrations/0003_usage_cost_in_dollars_usage_llm_usage_reason_and_more.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# Generated by Django 4.2.1 on 2024-06-27 08:08 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("usage", "0002_alter_usage_adapter_instance_id_and_more"), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name="usage", | ||
name="cost_in_dollars", | ||
field=models.FloatField( | ||
db_comment="Total number of tokens used", default=0.0 | ||
), | ||
preserve_default=False, | ||
), | ||
migrations.AddField( | ||
model_name="usage", | ||
name="llm_usage_reason", | ||
field=models.CharField( | ||
blank=True, | ||
choices=[ | ||
("extraction", "Extraction"), | ||
("challenge", "Challenge"), | ||
("summarize", "Summarize"), | ||
], | ||
db_comment="Reason for LLM usage. Empty if usage_type is 'embedding'. ", | ||
max_length=255, | ||
null=True, | ||
), | ||
), | ||
migrations.AlterField( | ||
model_name="usage", | ||
name="usage_type", | ||
field=models.CharField( | ||
choices=[("llm", "LLM Usage"), ("embedding", "Embedding Usage")], | ||
db_comment="Type of usage, either 'llm' or 'embedding'", | ||
max_length=255, | ||
), | ||
), | ||
migrations.AddIndex( | ||
model_name="usage", | ||
index=models.Index(fields=["run_id"], name="token_usage_run_id_cd3578_idx"), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.