Skip to content

Commit 2413423

Browse files
pohneanSBrandeis
andauthored
Featherless provider: max_tokens (#1474)
This PR fixes the parameters that are passed into the featherless api, in particular the max_token. --------- Co-authored-by: Simon Brandeis <33657802+SBrandeis@users.noreply.github.com> Co-authored-by: SBrandeis <simon@huggingface.co>
1 parent f181045 commit 2413423

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

packages/inference/src/providers/featherless-ai.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import type {
77
import { InferenceOutputError } from "../lib/InferenceOutputError.js";
88
import type { BodyParams } from "../types.js";
99
import { BaseConversationalTask, BaseTextGenerationTask } from "./providerHelper.js";
10+
import { omit } from "../utils/omit.js";
1011

1112
interface FeatherlessAITextCompletionOutput extends Omit<ChatCompletionOutput, "choices"> {
1213
choices: Array<{
@@ -33,9 +34,14 @@ export class FeatherlessAITextGenerationTask extends BaseTextGenerationTask {
3334

3435
override preparePayload(params: BodyParams<TextGenerationInput>): Record<string, unknown> {
3536
return {
36-
...params.args,
37-
...params.args.parameters,
3837
model: params.model,
38+
...omit(params.args, ["inputs", "parameters"]),
39+
...(params.args.parameters
40+
? {
41+
max_tokens: params.args.parameters.max_new_tokens,
42+
...omit(params.args.parameters, "max_new_tokens"),
43+
}
44+
: undefined),
3945
prompt: params.args.inputs,
4046
};
4147
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy