From f80b06293bd1fa81accc677746ad67814e28e53a Mon Sep 17 00:00:00 2001
From: Yi Ding <yi.s.ding@gmail.com>
Date: Tue, 8 Aug 2023 17:28:56 -0700
Subject: [PATCH] changed default temp to 0.1

---
 .changeset/gorgeous-planets-chew.md |  5 +++++
 packages/core/src/llm/LLM.ts        | 10 +++++-----
 2 files changed, 10 insertions(+), 5 deletions(-)
 create mode 100644 .changeset/gorgeous-planets-chew.md

diff --git a/.changeset/gorgeous-planets-chew.md b/.changeset/gorgeous-planets-chew.md
new file mode 100644
index 000000000..9b6dabd44
--- /dev/null
+++ b/.changeset/gorgeous-planets-chew.md
@@ -0,0 +1,5 @@
+---
+"llamaindex": patch
+---
+
+Breaking: changed default temp to 0.1 matching new Python change by @logan-markewich
diff --git a/packages/core/src/llm/LLM.ts b/packages/core/src/llm/LLM.ts
index 5374002e8..08e5342c9 100644
--- a/packages/core/src/llm/LLM.ts
+++ b/packages/core/src/llm/LLM.ts
@@ -93,7 +93,7 @@ export class OpenAI implements LLM {
 
   constructor(init?: Partial<OpenAI> & { azure?: AzureOpenAIConfig }) {
     this.model = init?.model ?? "gpt-3.5-turbo";
-    this.temperature = init?.temperature ?? 0;
+    this.temperature = init?.temperature ?? 0.1;
     this.topP = init?.topP ?? 1;
     this.maxTokens = init?.maxTokens ?? undefined;
 
@@ -268,9 +268,9 @@ export class LlamaDeuce implements LLM {
     this.chatStrategy =
       init?.chatStrategy ??
       (this.model.endsWith("4bit")
-        ? DeuceChatStrategy.REPLICATE4BIT
-        : DeuceChatStrategy.METAWBOS); // With BOS and EOS seems to work best
-    this.temperature = init?.temperature ?? 0.01; // minimum temperature is 0.01 for Replicate endpoint
+        ? DeuceChatStrategy.REPLICATE4BIT // With the newer A16Z/Replicate models they do the system message themselves.
+        : DeuceChatStrategy.METAWBOS); // With BOS and EOS seems to work best, although they all have problems past a certain point
+    this.temperature = init?.temperature ?? 0.1; // minimum temperature is 0.01 for Replicate endpoint
     this.topP = init?.topP ?? 1;
     this.maxTokens =
       init?.maxTokens ??
@@ -448,7 +448,7 @@ export class Anthropic implements LLM {
 
   constructor(init?: Partial<Anthropic>) {
     this.model = init?.model ?? "claude-2";
-    this.temperature = init?.temperature ?? 0;
+    this.temperature = init?.temperature ?? 0.1;
     this.topP = init?.topP ?? 0.999; // Per Ben Mann
     this.maxTokens = init?.maxTokens ?? undefined;
 
-- 
GitLab