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

NVIDIA reranker undefined build_model method #5934

Closed
brian-ogrady opened this issue Jan 25, 2025 · 2 comments · Fixed by #5957
Closed

NVIDIA reranker undefined build_model method #5934

brian-ogrady opened this issue Jan 25, 2025 · 2 comments · Fixed by #5957
Labels
bug Something isn't working

Comments

@brian-ogrady
Copy link
Contributor

Bug Description

The NVIDIA reranker into a flow and it will produce an error related to the undefined build_model method.

Reproduction

Simply drop the NVIDIA reranker into a flow and it will produce an error related to the undefined build_model method.

Expected behavior

NVIDIA reranker will cause an error in the flow.

Who can help?

No response

Operating System

Mac OS 15.1.1

Langflow Version

1.1

Python Version

3.10

Screenshot

No response

Flow File

No response

@brian-ogrady brian-ogrady added the bug Something isn't working label Jan 25, 2025
Copy link

dosubot bot commented Jan 25, 2025

Hey @brian-ogrady! I'm here to help you with bugs, questions, and becoming a contributor. Let's tackle this NVIDIA reranker issue together while we wait for a human maintainer.

To resolve the error related to the undefined build_model method when using the NVIDIA reranker, ensure that the build_model method is correctly defined in your NVIDIAModelComponent class. The method should be defined as follows:

def build_model(self) -> LanguageModel:  # type: ignore[type-var]
    try:
        from langchain_nvidia_ai_endpoints import ChatNVIDIA
    except ImportError as e:
        msg = "Please install langchain-nvidia-ai-endpoints to use the NVIDIA model."
        raise ImportError(msg) from e
    api_key = self.api_key
    temperature = self.temperature
    model_name: str = self.model_name
    max_tokens = self.max_tokens
    seed = self.seed
    return ChatNVIDIA(
        max_tokens=max_tokens or None,
        model=model_name,
        base_url=self.base_url,
        api_key=api_key,
        temperature=temperature or 0.1,
        seed=seed,
    )

Ensure that the langchain-nvidia-ai-endpoints package is installed, as the method imports ChatNVIDIA from this package. You can install it using:

pip install langchain-nvidia-ai-endpoints

If the method is still reported as undefined, verify that there are no typos or issues in the class definition or method calls [1].

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other

@brian-ogrady
Copy link
Contributor Author

Related PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant