Skip to content
This repository was archived by the owner on May 15, 2026. It is now read-only.

Commit 20aa6d1

Browse files
committed
fix: set default temperature to 0.7 for HuggingFace provider
1 parent aac844d commit 20aa6d1

3 files changed

Lines changed: 19 additions & 4 deletions

File tree

pnpm-lock.yaml

Lines changed: 15 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/api/providers/__tests__/huggingface.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ describe("HuggingFaceHandler", () => {
258258
expect(usageChunks[0].cacheWriteTokens).toBeUndefined()
259259
})
260260

261-
it("should pass correct temperature (0.5 default) to streamText", async () => {
261+
it("should pass correct temperature (0.7 default) to streamText", async () => {
262262
async function* mockFullStream() {
263263
yield { type: "text-delta", text: "Test" }
264264
}
@@ -281,7 +281,7 @@ describe("HuggingFaceHandler", () => {
281281

282282
expect(mockStreamText).toHaveBeenCalledWith(
283283
expect.objectContaining({
284-
temperature: 0.5,
284+
temperature: 0.7,
285285
}),
286286
)
287287
})
@@ -389,7 +389,7 @@ describe("HuggingFaceHandler", () => {
389389

390390
expect(mockGenerateText).toHaveBeenCalledWith(
391391
expect.objectContaining({
392-
temperature: 0.5,
392+
temperature: 0.7,
393393
}),
394394
)
395395
})

src/api/providers/huggingface.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import { BaseProvider } from "./base-provider"
2121
import { getHuggingFaceModels, getCachedHuggingFaceModels } from "./fetchers/huggingface"
2222
import type { SingleCompletionHandler, ApiHandlerCreateMessageMetadata } from "../index"
2323

24-
const HUGGINGFACE_DEFAULT_TEMPERATURE = 0.5
24+
const HUGGINGFACE_DEFAULT_TEMPERATURE = 0.7
2525

2626
/**
2727
* HuggingFace provider using the dedicated @ai-sdk/huggingface package.

0 commit comments

Comments
 (0)