Sha256: af7d5cb1bb3bd118fe508401554976ebfb7e264a1d7496a475efeb6baf85a965

Contents?: true

Size: 1.18 KB

Versions: 2

Compression:

Stored size: 1.18 KB

Contents

module Foobara
  module Ai
    module OpenAiApi
      module Types
        class Completion < Foobara::Model
          class Message < Foobara::Model
            attributes do
              role :string, one_of: %w[assistant user system]
              content :string
            end
          end

          class Choice < Foobara::Model
            attributes do
              index :integer
              message Message
              logprobs :duck # what is this? null in documentation
              finish_reason :string, one_of: %w[stop] # what are the real values here?
            end
          end

          class Usage < Foobara::Model
            attributes do
              prompt_tokens :integer
              completion_tokens :integer
              total_tokens :integer
            end
          end

          attributes do
            id :string
            # TODO: create sugar of equals for specifying an exact value
            object :string, one_of: ["chat.completion"]
            created :datetime
            model :string
            system_fingerprint :string, :allow_nil
            choices [Choice]
            usage Usage
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
foobara-open-ai-api-0.0.2 src/foobara/ai/open_ai_api/types/completion.rb
foobara-open-ai-api-0.0.1 src/open_ai_api/types/completion.rb