Skip to content

Commit 5e1d943

Browse files
committed
minor #933 [Fixtures] Remove confidence from output structure (chr-hertel)
This PR was merged into the main branch. Discussion ---------- [Fixtures] Remove confidence from output structure | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | Docs? | no | Issues | | License | MIT I consider this a bit misleading since it makes it easy to confuse it with actual scoring or confidence known from ML or similarity search. LLMs just put a probable number there not an actual confidence in that sense. we could also have a `int $calculationTime` and get a number as response that wouldn't really refer to the actual calculation time the model needed. Commits ------- 23d8a33 Remove confidence from output structure
2 parents c06ad35 + 23d8a33 commit 5e1d943

File tree

3 files changed

+6
-9
lines changed

3 files changed

+6
-9
lines changed

fixtures/StructuredOutput/MathReasoning.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,15 @@
1111

1212
namespace Symfony\AI\Fixtures\StructuredOutput;
1313

14-
use Symfony\AI\Platform\Contract\JsonSchema\Attribute\With;
15-
1614
final class MathReasoning
1715
{
1816
/**
1917
* @param Step[] $steps
2018
*/
2119
public function __construct(
2220
public array $steps,
23-
#[With(minimum: 0, maximum: 100)]
24-
public int $confidence,
2521
public string $finalAnswer,
22+
public float $result,
2623
) {
2724
}
2825
}

src/platform/tests/Contract/JsonSchema/FactoryTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,10 +209,10 @@ public function testBuildPropertiesForMathReasoningClass()
209209
'additionalProperties' => false,
210210
],
211211
],
212-
'confidence' => ['type' => 'integer', 'minimum' => 0, 'maximum' => 100],
213212
'finalAnswer' => ['type' => 'string'],
213+
'result' => ['type' => 'number'],
214214
],
215-
'required' => ['steps', 'confidence', 'finalAnswer'],
215+
'required' => ['steps', 'finalAnswer', 'result'],
216216
'additionalProperties' => false,
217217
];
218218

src/platform/tests/StructuredOutput/PlatformSubscriberTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,8 @@ public function testProcessOutputWithComplexResponseFormat()
128128
"output": "x = -3.75"
129129
}
130130
],
131-
"confidence": 100,
132-
"finalAnswer": "x = -3.75"
131+
"finalAnswer": "x = -3.75",
132+
"result": -3.75
133133
}
134134
JSON));
135135
$deferred = new DeferredResult($converter, new InMemoryRawResult());
@@ -147,8 +147,8 @@ public function testProcessOutputWithComplexResponseFormat()
147147
$this->assertInstanceOf(Step::class, $structure->steps[2]);
148148
$this->assertInstanceOf(Step::class, $structure->steps[3]);
149149
$this->assertInstanceOf(Step::class, $structure->steps[4]);
150-
$this->assertSame(100, $structure->confidence);
151150
$this->assertSame('x = -3.75', $structure->finalAnswer);
151+
$this->assertSame(-3.75, $structure->result);
152152
}
153153

154154
/**

0 commit comments

Comments
 (0)