FIX: keep parity of shape for image command (#275)
Function calling will start hallucinating if you reshape results. Previously we were morphing from: `{ prompts: ["prompt 1", "prompt 2"] }` to `{ prompts: { prompt: "prompt 1", seed: 222}, { ... ` This meant that over a few call sequences function_call starts hallucinating an incorrect shape. This change grounds us even on GPT-3.5
This commit is contained in:
parent
6f708726e4
commit
0b62c0fa02
|
@ -129,10 +129,7 @@ module DiscourseAi::AiBot::Commands
|
||||||
[/grid]
|
[/grid]
|
||||||
RAW
|
RAW
|
||||||
|
|
||||||
{
|
{ prompts: uploads.map { |item| item[:prompt] }, seeds: uploads.map { |item| item[:seed] } }
|
||||||
prompts: uploads.map { |item| { prompt: item[:prompt], seed: item[:seed] } },
|
|
||||||
displayed_to_user: true,
|
|
||||||
}
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -34,13 +34,7 @@ RSpec.describe DiscourseAi::AiBot::Commands::ImageCommand do
|
||||||
|
|
||||||
info = image.process(prompts: prompts).to_json
|
info = image.process(prompts: prompts).to_json
|
||||||
|
|
||||||
expect(JSON.parse(info)).to eq(
|
expect(JSON.parse(info)).to eq("prompts" => ["a pink cow", "a red cow"], "seeds" => [99, 99])
|
||||||
"prompts" => [
|
|
||||||
{ "prompt" => "a pink cow", "seed" => 99 },
|
|
||||||
{ "prompt" => "a red cow", "seed" => 99 },
|
|
||||||
],
|
|
||||||
"displayed_to_user" => true,
|
|
||||||
)
|
|
||||||
expect(image.custom_raw).to include("upload://")
|
expect(image.custom_raw).to include("upload://")
|
||||||
expect(image.custom_raw).to include("[grid]")
|
expect(image.custom_raw).to include("[grid]")
|
||||||
expect(image.custom_raw).to include("a pink cow")
|
expect(image.custom_raw).to include("a pink cow")
|
||||||
|
|
Loading…
Reference in New Issue