Sha256: 572053f5b553bf4e75f6b3e8727ec18f9c5469a5fc9f57bcb521c8fe47f0f48b

Contents?: true

Size: 1.29 KB

Versions: 1

Compression:

Stored size: 1.29 KB

Contents

# frozen_string_literal: true

require_relative "base"

require "roseflow/openai/chat_message"

module Roseflow
  module OpenAI
    module Operations
      # Chat operation.
      #
      # Given a list of messages comprising a conversation, the model will
      # return a response.
      #
      # See https://platform.openai.com/docs/api-reference/chat for more
      # information.
      #
      # Many of the attributes are actually optional for the API, but we
      # provide defaults to them. This may change in the future.
      class Chat < Base
        attribute :messages, Types::Array.of(ChatMessage)
        attribute? :functions, Types::Array.of(Types::Hash)
        attribute? :function_call, Types::OpenAI::StringOrObject
        attribute :temperature, Types::Float.default(1.0)
        attribute :top_p, Types::Float.default(1.0)
        attribute :n, Types::Integer.default(1)
        attribute :stream, Types::Bool.default(false)
        attribute? :stop, Types::OpenAI::StringOrArray
        attribute? :max_tokens, Types::Integer
        attribute :presence_penalty, Types::Number.default(0)
        attribute :frequency_penalty, Types::Number.default(0)
        attribute? :user, Types::String

        attribute :path, Types::String.default("/v1/chat/completions")
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
roseflow-openai-0.2.0 lib/roseflow/openai/operations/chat.rb