Skip to content

Improve handling of unprovided usage statistics #158

@JasonTheAdams

Description

@JasonTheAdams

The TokenUsage DTO right now has a couple of limitations to it:

  1. It can't be null in the GenerativeAiResult DTO, so it's assumed to always be supplied
  2. The individual properties of TokenUsage are all non-nullable, so they must also be supplied

The work around for this has been to do something like new TokenUsage(0, 0, 0) to indicate the values weren't provided. This is confusing and makes it hard to distinguish between statistics not being provided versus actual values. This will become even more important if we add additional properties in the future that only some providers support.

I recommend making the properties nullable as well as the TokenUsage instance nullable in GenerativeAiResult.

Metadata

Metadata

Assignees

No one assigned

    Labels

    [Priority] LowNot essential work but deemed nice to have

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions