-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from ajaynomics/ajaynomics/feb-2024-model-updates
fixes from implementation of feb-2024
- Loading branch information
Showing
6 changed files
with
65 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
class Cloudflare::AI::Results::ImageToText < Cloudflare::AI::Result | ||
# Empty seam kept for consistency with other result objects that have more complexity. | ||
def description | ||
result&.dig(:description) # nil if no shape | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,6 @@ | |
|
||
module Cloudflare | ||
module AI | ||
VERSION = "0.9.1" | ||
VERSION = "0.9.2" | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
require "test_helper" | ||
|
||
class Cloudflare::AI::Results::ImageToTextTest < Minitest::Test | ||
def setup | ||
@result = Cloudflare::AI::Results::ImageToText.new(successful_response_json) | ||
end | ||
|
||
def test_successful_result | ||
assert @result.success? | ||
refute @result.failure? | ||
|
||
assert_equal successful_response_json["result"]["description"], @result.description | ||
end | ||
|
||
def test_to_json | ||
assert_equal successful_response_json.to_json, @result.to_json | ||
end | ||
|
||
private | ||
|
||
def successful_response_json | ||
{ | ||
result: {description: "a cute cat"}, | ||
success: true, | ||
errors: [], | ||
messages: [] | ||
}.deep_stringify_keys | ||
end | ||
end |