MAJOR=4
MINOR=3
DEVNAME=tty3
  D   ˆl–Ãa¾”ªi?u8 ¸Û71hß�þ^qÅœp,Æ2©WÿŸÈƒ[Ç_�uÐb&=LyZËcõÁË f    # Copyright (C) 2012-2026 Zammad Foundation, https://zammad-foundation.org/

require 'rails_helper'

RSpec.describe AI::Provider::Completion::ToolCall do
  def tool_call(arguments)
    described_class.new(id: 'call_1', name: 'get_weather', arguments:)
  end

  describe '#initialize' do
    it 'keeps an object as the arguments', :aggregate_failures do
      call = tool_call({ 'city' => 'Vienna' })

      expect(call).to have_attributes(id: 'call_1', name: 'get_weather', arguments: { 'city' => 'Vienna' }, raw_arguments: nil)
      expect(call).not_to be_invalid
    end

    it 'reads the arguments from the JSON text the model wrote' do
      expect(tool_call('{"city": "Vienna"}').arguments).to eq('city' => 'Vienna')
    end

    [nil, '', ' '].each do |arguments|
      it "takes #{arguments.inspect} for no arguments" do
        expect(tool_call(arguments)).to have_attributes(arguments: {}, invalid?: false)
      end
    end

    {
      'broken JSON'         => '{"city": "Vie',
      'JSON that is a list' => '["Vienna"]',
      'JSON that is a text' => '"Vienna"',
    }.each do |label, arguments|
      it "marks #{label} as invalid and keeps it as sent" do
        expect(tool_call(arguments)).to have_attributes(invalid?: true, arguments: nil, raw_arguments: arguments)
      end
    end

    it 'marks arguments that are neither an object nor a text as invalid' do
      expect(tool_call(['Vienna'])).to have_attributes(invalid?: true, raw_arguments: '["Vienna"]')
    end

    [nil, ''].each do |id|
      it "rejects the id #{id.inspect}" do
        expect { described_class.new(id:, name: 'get_weather', arguments: {}) }
          .to raise_error(ArgumentError, 'tool call requires an id')
      end
    end
  end

  describe '#to_h' do
    it 'returns the id, the name and the arguments' do
      expect(tool_call({ 'city' => 'Vienna' }).to_h).to eq(id: 'call_1', name: 'get_weather', arguments: { 'city' => 'Vienna' })
    end

    it 'returns the arguments as sent for an invalid call' do
      expect(tool_call('{"city": "Vie').to_h).to eq(id: 'call_1', name: 'get_weather', raw_arguments: '{"city": "Vie')
    end
  end
end
  
   Î239ÍÁË  ï    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html><head>
<title>403 Forbidden</title>
</head><body>
<h1>Forbidden</h1>
<p>You don't have permission to access this resource.</p>
</body></html>
  @   ˆl–ß=¿JÕ!®Å	@ãb¸&ÔÅ£�þBübY¹ÊÓ"i¦�üÿÊƒq·^É_ˆI|¥�+y,ÃÍ ²    //
// SPDX-License-Identifier: BSD-3-Clause
// Copyright (c) Contributors to the OpenEXR Project.
//

#ifndef INCLUDED_IMF_RGBA_YCA_H
#define INCLUDED_IMF_RGBA_YCA_H

//-----------------------------------------------------------------------------
//
//	Conversion between RGBA (red, green, blue alpha)
//	and YCA (luminance, subsampled chroma, alpha) data:
//
//	Luminance, Y, is computed as a weighted sum of R, G, and B:
//
//		Y = yw.x * R + yw.y * G + yw.z * B
//
//	Function computeYw() computes a set of RGB-to-Y weights, yw,
//	from a set of primary and white point chromaticities.
//
//	Chroma, C, consists of two components, RY and BY:
//
//		RY = (R - Y) / Y
//		BY = (B - Y) / Y
//
//	For efficiency, the x and y subsampling rates for chroma are
//	hardwired to 2, and the chroma subsampling and reconstruction
//	filters are fixed 27-pixel wide windowed sinc functions.
//
//	Starting with an image that has RGBA data for all pixels,
//
//		RGBA RGBA RGBA RGBA ... RGBA RGBA
//		RGBA RGBA RGBA RGBA ... RGBA RGBA
//		RGBA RGBA RGBA RGBA ... RGBA RGBA
//		RGBA RGBA RGBA RGBA ... RGBA RGBA
//		...
//		RGBA RGBA RGBA RGBA ... RGBA RGBA
//		RGBA RGBA RGBA RGBA ... RGBA RGBA
//
//	function RGBAtoYCA() converts the pixels to YCA format:
//
//		YCA  YCA  YCA  YCA  ... YCA  YCA
//		YCA  YCA  YCA  YCA  ... YCA  YCA
//		YCA  YCA  YCA  YCA  ... YCA  YCA
//		YCA  YCA  YCA  YCA  ... YCA  YCA
//		...
//		YCA  YCA  YCA  YCA  ... YCA  YCA
//		YCA  YCA  YCA  YCA  ... YCA  YCA
//