From 0d7c8fc2b8aad5e0ea3e0d52b145130742f52dd4 Mon Sep 17 00:00:00 2001 From: lfallman Date: Tue, 7 May 2024 11:23:44 +0200 Subject: [PATCH] set temperature to 0.01 for better llm compatibility --- src/ragas/llms/base.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/ragas/llms/base.py b/src/ragas/llms/base.py index 8b00ffd8ea..ccea5e78e8 100644 --- a/src/ragas/llms/base.py +++ b/src/ragas/llms/base.py @@ -51,33 +51,35 @@ def set_run_config(self, run_config: RunConfig): def get_temperature(self, n: int) -> float: """Return the temperature to use for completion based on n.""" - return 0.3 if n > 1 else 1e-8 + return 0.3 if n > 1 else 0.01 @abstractmethod def generate_text( self, prompt: PromptValue, n: int = 1, - temperature: float = 1e-8, + temperature: float = 0.01, stop: t.Optional[t.List[str]] = None, callbacks: Callbacks = None, - ) -> LLMResult: ... + ) -> LLMResult: + ... @abstractmethod async def agenerate_text( self, prompt: PromptValue, n: int = 1, - temperature: float = 1e-8, + temperature: float = 0.01, stop: t.Optional[t.List[str]] = None, callbacks: Callbacks = None, - ) -> LLMResult: ... + ) -> LLMResult: + ... async def generate( self, prompt: PromptValue, n: int = 1, - temperature: float = 1e-8, + temperature: float = 0.01, stop: t.Optional[t.List[str]] = None, callbacks: Callbacks = None, is_async: bool = True, @@ -128,7 +130,7 @@ def generate_text( self, prompt: PromptValue, n: int = 1, - temperature: float = 1e-8, + temperature: float = 0.01, stop: t.Optional[t.List[str]] = None, callbacks: Callbacks = None, ) -> LLMResult: @@ -158,7 +160,7 @@ async def agenerate_text( self, prompt: PromptValue, n: int = 1, - temperature: float = 1e-8, + temperature: float = 0.01, stop: t.Optional[t.List[str]] = None, callbacks: Callbacks = None, ) -> LLMResult: