Skip to content

Commit

Permalink
⚡ react/components: Set temperature to 0 to force cache use on genera…
Browse files Browse the repository at this point in the history
…tion react components (#121)
  • Loading branch information
lowczarc authored Dec 20, 2023
1 parent 9115fae commit 164feb2
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/components/TextGenerated.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export function TextGenerated({
setText(undefined);

if (status === "authenticated" && prompt) {
const newGeneration = generate(prompt);
const newGeneration = generate(prompt, { temperature: 0 });

setCurrentStream(newGeneration);

Expand Down
1 change: 1 addition & 0 deletions lib/components/TextSummary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export function TextSummary({
if (status === "authenticated" && prompt) {
const newGeneration = generate(prompt, {
systemPrompt: "Summarize what the text the user provided",
temperature: 0,
});

setCurrentStream(newGeneration);
Expand Down
1 change: 1 addition & 0 deletions lib/components/TextTranslated.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export function TextTranslated({
if (status === "authenticated" && text) {
generate(text, {
systemPrompt: `Translate the text the user provided to this language: "${language}". Just say the translated text. Do not write anything else, do not write any explanation. Only write in the target language (${language})`,
temperature: 0,
}).then(setTranslation);
}
}, [status, generate, text]);
Expand Down

0 comments on commit 164feb2

Please sign in to comment.