Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set temperature to 0.01 for better llm compatibility #939

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions src/ragas/llms/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down