Skip to content

Commit

Permalink
Use maxTemperature in session creation sample code
Browse files Browse the repository at this point in the history
See also #53.
  • Loading branch information
lozy219 authored Oct 29, 2024
1 parent fa45f9d commit 944f131
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,10 +185,14 @@ const customSession = await ai.languageModel.create({

const capabilities = await ai.languageModel.capabilities();
const slightlyHighTemperatureSession = await ai.languageModel.create({
temperature: Math.max(capabilities.defaultTemperature * 1.2, 1.0),
temperature: Math.max(
capabilities.defaultTemperature * 1.2,
capabilities.maxTemperature
),
topK: 10
});

// capabilities also contains maxTemperature, defaultTopK, and maxTopK.
// capabilities also contains defaultTopK and maxTopK.
```

### Session persistence and cloning
Expand Down

0 comments on commit 944f131

Please sign in to comment.