While looking at the OpenAiGeneration metadata class and the OpenAiRateLimit class, we found a point of concern for NPE.

  • For the OpenAiGenerationMetadata.From() method, we verified this because the internal block uses id and usage.
  • For OpenAiRateLimit classes, @Nullable Annotation has been added because null can be inserted into the long type from outside.

Comment From: markpollack

For the OpenAiReateLimit class, these values should always come back from the openai request in the headers.

https://platform.openai.com/docs/guides/rate-limits/rate-limits-in-headers

I think it is incorrect to give a developer hints that it will be null, they should always be present.

Comment From: markpollack

Though I can see the fact that this may change beyond our control and using @nullable is a half way approach, but then perhaps we need to use Optional<> that makes for lots of verbosity.

Comment From: markpollack

When we review the overall organization of response objects multiple AI models (not just openai) we will revisit this.

Comment From: markpollack

I closing this as these fields sent by openai won't be null.