Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Providers/DeepSeek/Handlers/Structured.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ protected function sendRequest(Request $request): array
[
'model' => $request->model(),
'messages' => (new MessageMap($request->messages(), $request->systemPrompts()))(),
'max_completion_tokens' => $request->maxTokens(),
'max_tokens' => $request->maxTokens(),
],
Arr::whereNotNull([
'temperature' => $request->temperature(),
Expand Down
18 changes: 18 additions & 0 deletions tests/Providers/DeepSeek/StructuredTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,21 @@
return true;
});
});

it('sends the max tokens as max_tokens, the parameter DeepSeek reads', function (): void {
FixtureResponse::fakeResponseSequence('v1/chat/completions', 'deepseek/structured');

Prism::structured()
->using(Provider::DeepSeek, 'deepseek-chat')
->withSchema(new ObjectSchema('output', 'the output object', [new StringSchema('weather', 'The weather forecast')], ['weather']))
->withPrompt('What is the weather?')
->withMaxTokens(100)
->asStructured();

Http::assertSent(function (Request $request): bool {
expect($request->data()['max_tokens'])->toBe(100);
expect($request->data())->not->toHaveKey('max_completion_tokens');

return true;
});
});