<commit_before># encoding: utf-8

require 'httparty'

require_relative 'dialog_response'
require_relative 'dialog_message'
require_relative 'dialog_conversation'

module RecastAI
  class Build
    attr_reader :token, :language

    def initialize(token = nil, language = nil)
      @token = token
      @language = language
    end

    def headers
      { 'Authorization' => "Token #{@token}", 'Content-Type' => 'application/json' }
    end

    def dialog(msg, conversation_id, language = nil)
      raise RecastAI::RecastError.new('Token is missing') unless @token

      language = @language if language.nil?
      body = { message: msg, conversation_id: conversation_id, language: language }
<commit_msg>add optional parameters -memory- and -log_level-, add proxy option<commit_after># encoding: utf-8

require 'httparty'

require_relative 'dialog_response'
require_relative 'dialog_message'
require_relative 'dialog_conversation'

module RecastAI
  class Build
    attr_reader :token, :language

    def initialize(token = nil, language = nil)
      @token = token
      @language = language
    end

    def headers
      { 'Authorization' => "Token #{@token}", 'Content-Type' => 'application/json' }
    end

    def dialog(msg, conversation_id, language = nil, options)
      raise RecastAI::RecastError.new('Token is missing') unless @token

      memory = options[:memory] || {}
      log_level = options[:log_level] || {}
      proxy = options[:proxy] || {}

      language = @language if language.nil?
      body = { message: msg, conversation_id: conversation_id, language: language }

{'fraction_non_alphanumeric': 0.10881801125703565, 'fraction_numerical': 0.0012507817385866166, 'mean_word_length': 3.7337278106508878, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5086789', 'n_tokens_mistral': 456, 'n_tokens_neox': 448, 'n_words': 131}