Skip to content

Commit 9111fdf

Browse files
0Falli0lfallman
andauthored
set temperature to 0.01 for better llm compatibility (#939)
#938 Change Temperature from 1e-8 to 0.01 for better llm Compatibility. Co-authored-by: lfallman <[email protected]>
1 parent 4f29e76 commit 9111fdf

File tree

1 file changed

+9
-13
lines changed

1 file changed

+9
-13
lines changed

src/ragas/llms/base.py

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -70,39 +70,35 @@ def set_run_config(self, run_config: RunConfig):
7070

7171
def get_temperature(self, n: int) -> float:
7272
"""Return the temperature to use for completion based on n."""
73-
return 0.3 if n > 1 else 1e-8
74-
75-
def is_finished(self, response: LLMResult) -> bool:
76-
logger.warning(
77-
f"is_finished not implemented for {self.__class__.__name__}. Will default to True."
78-
)
79-
return True
73+
return 0.3 if n > 1 else 0.01
8074

8175
@abstractmethod
8276
def generate_text(
8377
self,
8478
prompt: PromptValue,
8579
n: int = 1,
86-
temperature: float = 1e-8,
80+
temperature: float = 0.01,
8781
stop: t.Optional[t.List[str]] = None,
8882
callbacks: Callbacks = None,
89-
) -> LLMResult: ...
83+
) -> LLMResult:
84+
...
9085

9186
@abstractmethod
9287
async def agenerate_text(
9388
self,
9489
prompt: PromptValue,
9590
n: int = 1,
96-
temperature: t.Optional[float] = None,
91+
temperature: t.Optional[float] = 0.01,
9792
stop: t.Optional[t.List[str]] = None,
9893
callbacks: Callbacks = None,
99-
) -> LLMResult: ...
94+
) -> LLMResult:
95+
...
10096

10197
async def generate(
10298
self,
10399
prompt: PromptValue,
104100
n: int = 1,
105-
temperature: t.Optional[float] = None,
101+
temperature: t.Optional[float] = 0.01,
106102
stop: t.Optional[t.List[str]] = None,
107103
callbacks: Callbacks = None,
108104
) -> LLMResult:
@@ -207,7 +203,7 @@ def generate_text(
207203
self,
208204
prompt: PromptValue,
209205
n: int = 1,
210-
temperature: t.Optional[float] = None,
206+
temperature: t.Optional[float] = 0.01,
211207
stop: t.Optional[t.List[str]] = None,
212208
callbacks: Callbacks = None,
213209
) -> LLMResult:

0 commit comments

Comments
 (0)