Skip to content

Fix image support specs #9

@swaathi

Description

@swaathi
  ai-chat git:(main)  rs spec/ai/chat/image_support_spec.rb
.FFFF.FF.FF.FF..

Failures:

  1) AI::Chat image support #process_image with a file path converts the file to a base64 data URI
     Failure/Error:
       raise InputClassificationError,
         "String provided is neither a valid URL (must start with http:// or https://) nor an existing file path on disk. Received value: #{obj.inspect}"
     
     AI::Chat::InputClassificationError:
       String provided is neither a valid URL (must start with http:// or https://) nor an existing file path on disk. Received value: "/Users/swaathi/code/work/ai-chat/spec/ai/chat/../../fixtures/images/test1.jpg"
     # ./lib/ai/chat.rb:232:in `classify_obj'
     # ./lib/ai/chat.rb:245:in `process_image'
     # ./spec/ai/chat/image_support_spec.rb:22:in `block (4 levels) in <top (required)>'
     # ./spec/spec_helper.rb:47:in `block (2 levels) in <top (required)>'

  2) AI::Chat image support #process_image with a file-like object converts the file content to a base64 data URI
     Failure/Error: file = File.open(test_image1_path)
     
     Errno::ENOENT:
       No such file or directory @ rb_sysopen - /Users/swaathi/code/work/ai-chat/spec/ai/chat/../../fixtures/images/test1.jpg
     # ./spec/ai/chat/image_support_spec.rb:36:in `initialize'
     # ./spec/ai/chat/image_support_spec.rb:36:in `open'
     # ./spec/ai/chat/image_support_spec.rb:36:in `block (4 levels) in <top (required)>'
     # ./spec/spec_helper.rb:47:in `block (2 levels) in <top (required)>'

  3) AI::Chat image support #process_image with a file-like object handles StringIO objects
     Failure/Error: content = File.binread(test_image1_path)
     
     Errno::ENOENT:
       No such file or directory @ rb_sysopen - /Users/swaathi/code/work/ai-chat/spec/ai/chat/../../fixtures/images/test1.jpg
     # ./spec/ai/chat/image_support_spec.rb:54:in `binread'
     # ./spec/ai/chat/image_support_spec.rb:54:in `block (4 levels) in <top (required)>'
     # ./spec/spec_helper.rb:47:in `block (2 levels) in <top (required)>'

  4) AI::Chat image support #user with a single image formats the message correctly with an image
     Failure/Error:
       raise InputClassificationError,
         "String provided is neither a valid URL (must start with http:// or https://) nor an existing file path on disk. Received value: #{obj.inspect}"
     
     AI::Chat::InputClassificationError:
       String provided is neither a valid URL (must start with http:// or https://) nor an existing file path on disk. Received value: "/Users/swaathi/code/work/ai-chat/spec/ai/chat/../../fixtures/images/test1.jpg"
     # ./lib/ai/chat.rb:232:in `classify_obj'
     # ./lib/ai/chat.rb:245:in `process_image'
     # ./lib/ai/chat.rb:98:in `user'
     # ./spec/ai/chat/image_support_spec.rb:73:in `block (4 levels) in <top (required)>'
     # ./spec/spec_helper.rb:47:in `block (2 levels) in <top (required)>'

  5) AI::Chat image support #user with multiple images formats the message correctly with multiple images
     Failure/Error:
       raise InputClassificationError,
         "String provided is neither a valid URL (must start with http:// or https://) nor an existing file path on disk. Received value: #{obj.inspect}"
     
     AI::Chat::InputClassificationError:
       String provided is neither a valid URL (must start with http:// or https://) nor an existing file path on disk. Received value: "/Users/swaathi/code/work/ai-chat/spec/ai/chat/../../fixtures/images/test1.jpg"
     # ./lib/ai/chat.rb:232:in `classify_obj'
     # ./lib/ai/chat.rb:245:in `process_image'
     # ./lib/ai/chat.rb:87:in `block in user'
     # ./lib/ai/chat.rb:83:in `map'
     # ./lib/ai/chat.rb:83:in `user'
     # ./spec/ai/chat/image_support_spec.rb:104:in `block (4 levels) in <top (required)>'
     # ./spec/spec_helper.rb:47:in `block (2 levels) in <top (required)>'

  6) AI::Chat image support #user with multiple images formats the message correctly with multiple local images
     Failure/Error:
       raise InputClassificationError,
         "String provided is neither a valid URL (must start with http:// or https://) nor an existing file path on disk. Received value: #{obj.inspect}"
     
     AI::Chat::InputClassificationError:
       String provided is neither a valid URL (must start with http:// or https://) nor an existing file path on disk. Received value: "/Users/swaathi/code/work/ai-chat/spec/ai/chat/../../fixtures/images/test1.jpg"
     # ./lib/ai/chat.rb:232:in `classify_obj'
     # ./lib/ai/chat.rb:245:in `process_image'
     # ./lib/ai/chat.rb:87:in `block in user'
     # ./lib/ai/chat.rb:83:in `map'
     # ./lib/ai/chat.rb:83:in `user'
     # ./spec/ai/chat/image_support_spec.rb:125:in `block (4 levels) in <top (required)>'
     # ./spec/spec_helper.rb:47:in `block (2 levels) in <top (required)>'

  7) AI::Chat image support #user with direct array content processes simplified image/text format correctly
     Failure/Error:
       raise InputClassificationError,
         "String provided is neither a valid URL (must start with http:// or https://) nor an existing file path on disk. Received value: #{obj.inspect}"
     
     AI::Chat::InputClassificationError:
       String provided is neither a valid URL (must start with http:// or https://) nor an existing file path on disk. Received value: "/Users/swaathi/code/work/ai-chat/spec/ai/chat/../../fixtures/images/test1.jpg"
     # ./lib/ai/chat.rb:232:in `classify_obj'
     # ./lib/ai/chat.rb:245:in `process_image'
     # ./lib/ai/chat.rb:47:in `block in user'
     # ./lib/ai/chat.rb:41:in `map'
     # ./lib/ai/chat.rb:41:in `user'
     # ./spec/ai/chat/image_support_spec.rb:182:in `block (4 levels) in <top (required)>'
     # ./spec/spec_helper.rb:47:in `block (2 levels) in <top (required)>'

  8) AI::Chat image support #user with direct array content processes multiple local images with simplified format
     Failure/Error:
       raise InputClassificationError,
         "String provided is neither a valid URL (must start with http:// or https://) nor an existing file path on disk. Received value: #{obj.inspect}"
     
     AI::Chat::InputClassificationError:
       String provided is neither a valid URL (must start with http:// or https://) nor an existing file path on disk. Received value: "/Users/swaathi/code/work/ai-chat/spec/ai/chat/../../fixtures/images/test1.jpg"
     # ./lib/ai/chat.rb:232:in `classify_obj'
     # ./lib/ai/chat.rb:245:in `process_image'
     # ./lib/ai/chat.rb:47:in `block in user'
     # ./lib/ai/chat.rb:41:in `map'
     # ./lib/ai/chat.rb:41:in `user'
     # ./spec/ai/chat/image_support_spec.rb:210:in `block (4 levels) in <top (required)>'
     # ./spec/spec_helper.rb:47:in `block (2 levels) in <top (required)>'

  9) AI::Chat image support #classify_obj classifies file paths correctly
     Failure/Error:
       raise InputClassificationError,
         "String provided is neither a valid URL (must start with http:// or https://) nor an existing file path on disk. Received value: #{obj.inspect}"
     
     AI::Chat::InputClassificationError:
       String provided is neither a valid URL (must start with http:// or https://) nor an existing file path on disk. Received value: "/Users/swaathi/code/work/ai-chat/spec/ai/chat/../../fixtures/images/test1.jpg"
     # ./lib/ai/chat.rb:232:in `classify_obj'
     # ./spec/ai/chat/image_support_spec.rb:241:in `block (3 levels) in <top (required)>'
     # ./spec/spec_helper.rb:47:in `block (2 levels) in <top (required)>'

  10) AI::Chat image support #classify_obj classifies file-like objects correctly
      Failure/Error: file = File.open(test_image1_path)
      
      Errno::ENOENT:
        No such file or directory @ rb_sysopen - /Users/swaathi/code/work/ai-chat/spec/ai/chat/../../fixtures/images/test1.jpg
      # ./spec/ai/chat/image_support_spec.rb:246:in `initialize'
      # ./spec/ai/chat/image_support_spec.rb:246:in `open'
      # ./spec/ai/chat/image_support_spec.rb:246:in `block (3 levels) in <top (required)>'
      # ./spec/spec_helper.rb:47:in `block (2 levels) in <top (required)>'

Finished in 0.0076 seconds (files took 0.45877 seconds to load)
16 examples, 10 failures

Failed examples:

rspec ./spec/ai/chat/image_support_spec.rb:21 # AI::Chat image support #process_image with a file path converts the file to a base64 data URI
rspec ./spec/ai/chat/image_support_spec.rb:35 # AI::Chat image support #process_image with a file-like object converts the file content to a base64 data URI
rspec ./spec/ai/chat/image_support_spec.rb:53 # AI::Chat image support #process_image with a file-like object handles StringIO objects
rspec ./spec/ai/chat/image_support_spec.rb:72 # AI::Chat image support #user with a single image formats the message correctly with an image
rspec ./spec/ai/chat/image_support_spec.rb:103 # AI::Chat image support #user with multiple images formats the message correctly with multiple images
rspec ./spec/ai/chat/image_support_spec.rb:124 # AI::Chat image support #user with multiple images formats the message correctly with multiple local images
rspec ./spec/ai/chat/image_support_spec.rb:175 # AI::Chat image support #user with direct array content processes simplified image/text format correctly
rspec ./spec/ai/chat/image_support_spec.rb:202 # AI::Chat image support #user with direct array content processes multiple local images with simplified format
rspec ./spec/ai/chat/image_support_spec.rb:240 # AI::Chat image support #classify_obj classifies file paths correctly
rspec ./spec/ai/chat/image_support_spec.rb:245 # AI::Chat image support #classify_obj classifies file-like objects correctly

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions