struct AI::OpenAI::OpenAIChatUsage

Overview

Usage information from OpenAI chat completions API.

Included Modules

Defined in:

ai/openai/chat/convert_openai_chat_usage.cr
ai/openai/chat/openai_chat_api.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(pull : JSON::PullParser) #

[View source]
def self.new(prompt_tokens : Int32 | Nil = nil, completion_tokens : Int32 | Nil = nil, total_tokens : Int32 | Nil = nil, prompt_tokens_details : OpenAIChatPromptTokensDetails | Nil = nil, completion_tokens_details : OpenAIChatCompletionTokensDetails | Nil = nil) #

[View source]
def self.new(prompt_tokens : Int32 | Nil = nil, completion_tokens : Int32 | Nil = nil, total_tokens : Int32 | Nil = nil, prompt_tokens_details : PromptTokensDetails | Nil = nil, completion_tokens_details : CompletionTokensDetails | Nil = nil) #

[View source]
def self.new(*, __pull_for_json_serializable pull : JSON::PullParser) #

[View source]

Instance Method Detail

def completion_tokens : Int32 | Nil #

[View source]
def completion_tokens_details : CompletionTokensDetails | Nil #

[View source]
def prompt_tokens : Int32 | Nil #

[View source]
def prompt_tokens_details : PromptTokensDetails | Nil #

[View source]
def total_tokens : Int32 | Nil #

[View source]