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

Compatibility Implementation for Ragas.io with WatsonxLLM Parameters Handling #5

Merged

Conversation

JulioSanchezD
Copy link
Contributor

Issue:
Ragas.io uses the LangchainWrapper to leverage an LLM for its evaluation tasks. However, when calling the invoke method, it adds text generation parameters outside of the ‘params’ dictionary, which necessitates modifications to ensure compatibility and proper parameter handling.

Added Methods:

  1. _validate_chat_params: Validates and adjusts the ‘temperature’ parameter in the ‘params’ dictionary to ensure it meets the required conditions. Only the ‘temperature’ parameter is currently validated. More cases can be added as needed.
  2. _override_chat_params: Overrides the class parameters with those provided in the invoke method. Updates ‘params’ with matching keys from kwargs and removes those keys from kwargs. It includes the merge from the params dictionary in the invoke method too. This ensures that the parameters sent from ragas are correctly integrated into and handled WatsonxLLM within the existing parameter structure.
  3. test_watsonxllm_invoke_with_params_4: Implemented the CI test for this implementation

julioe-sanchezd and others added 4 commits July 16, 2024 11:21
…nsure only valid parameters are fed into WatsonxLLM and to add the capability to receive parameters outside the params dictionary, which is how ragas invokes the generate method.
@MateuszOssGit
Copy link
Collaborator

@JulioSanchezD I have made some changes to be backward compatibility.
Also there is no need to check the value of the "temperature" parameter. It is validated by the backend

@MateuszOssGit MateuszOssGit merged commit 0c81f32 into langchain-ai:main Jul 22, 2024
12 checks passed
Copy link
Collaborator

@Mateusz-Switala Mateusz-Switala left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants