8000 [R-231] `generate_text` in `LangchainLLMWrapper` ignores the value of the temperature parameter · Issue #886 · explodinggradients/ragas · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
[R-231] generate_text in LangchainLLMWrapper ignores the value of the temperature parameter #886
Closed
@HerrIvan

Description

@HerrIvan

[x] I have checked the documentation and related resources and couldn't resolve my bug.

Describe the bug
The method generate_text in LangchainLLMWrapper doesn't take into account the temperature parameter.

Ragas version: '0.1.dev368+g8a5ff9f'
Python version: indifferent

Code to Reproduce

    async def agenerate_text(
        self,
        prompt: PromptValue,
        n: int = 1,
        temperature: float = 1e-8,
        stop: t.Optional[t.List[str]] = None,
        callbacks: Callbacks = None,
    ) -> LLMResult:
        temperature = self.get_temperature(n=n)  # <- this function sets a temperature value regardless of the one passed as a parameter

Error trace
This "bug" won't throw any exception but the code won't work as expected.

Expected behavior
Take the given temperature value into account if explicitly provided. Now, since the temperature has a default value already in the signature, it is not straightforward to know whether the param has been defined, or it implicitly has taken the default value. Therefore the signature should be slightly modified (at the "typing" level).

Additional context
Since agenerate_text is a concrete implementation of an abstract method in BaseRagasLLM, probably the abstract class signature would need to be updated too. I don't see in the repo any place where removing the default value in the signature would cause any problem.

I will open myself a PR with a solution proposal.

R-231

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinglinearCreated by Linear-GitHub Sync

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0