Skip to content
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(spans): Global config for AI model costs #3579

Merged
merged 4 commits into from
May 13, 2024
Merged

Conversation

jjbayer
Copy link
Member

@jjbayer jjbayer commented May 10, 2024

See #3554.

#skip-changelog

@jjbayer jjbayer marked this pull request as ready for review May 10, 2024 14:17
@jjbayer jjbayer requested a review from a team as a code owner May 10, 2024 14:17
@jjbayer jjbayer requested review from Dav1dde and colin-sentry May 10, 2024 14:17
@@ -46,6 +46,9 @@ pub struct GlobalConfig {
/// applying.
#[serde(skip_serializing_if = "is_ok_and_empty")]
pub metric_extraction: ErrorBoundary<MetricExtractionGroups>,

/// Configuration for AI span measurements.
pub ai_model_costs: ErrorBoundary<ai::ModelCosts>,
Copy link
Member Author

Choose a reason for hiding this comment

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

Will add a skip_serializing_if here.

Copy link
Member

Choose a reason for hiding this comment

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

👍

#[serde(rename_all = "camelCase")]
pub struct ModelCost {
model_id: LazyGlob,
for_completion: bool,
Copy link
Member

Choose a reason for hiding this comment

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

Maybe this makes sense as an enum, but not familiar enough with AI terminology:

enum Usage {
    Completion,
    NotCompletionButTheDefaultUsecase,
    // MaybeSomeFutureUsecase,
}

@colin-sentry wdyt?

Copy link
Member

Choose a reason for hiding this comment

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

the SDKs only send the static prompt_tokens, completion_tokens, and total_tokens, so it's probably fine to keep as a boolean

@@ -46,6 +46,9 @@ pub struct GlobalConfig {
/// applying.
#[serde(skip_serializing_if = "is_ok_and_empty")]
pub metric_extraction: ErrorBoundary<MetricExtractionGroups>,

/// Configuration for AI span measurements.
pub ai_model_costs: ErrorBoundary<ai::ModelCosts>,
Copy link
Member

Choose a reason for hiding this comment

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

👍

@jjbayer jjbayer enabled auto-merge (squash) May 13, 2024 13:25
@jjbayer jjbayer merged commit ab2d38d into master May 13, 2024
22 checks passed
@jjbayer jjbayer deleted the feat/global-config-ai branch May 13, 2024 14:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants