Using Feedback function in trulens.providers.huggingface #2287
Replies: 1 comment
-
|
The hallucination feedback function in There is no official fix or configuration option yet. As a temporary workaround, you could subclass the Huggingface provider and override the constant URL and the relevant method to use the new endpoint. For example: from trulens.providers.huggingface import Huggingface
class PatchedHuggingface(Huggingface):
HUGS_HALLUCINATION_API_URL = "https://router.huggingface.co/hf-inference/models/vectara/hallucination_evaluation_model"
def _hallucination_evaluator_endpoint(self, input: str) -> float:
json = {"inputs": input}
response = self._post_scores(
url=self.HUGS_HALLUCINATION_API_URL, json=json, timeout=30
)
# ... (rest of the method unchanged)
return scoreIf you are comfortable editing source code directly, you can also change the hardcoded URL in the provider module itself, but this is less maintainable. Keep an eye on the repository for updates or fixes. If you need this urgently, consider patching as above until an official update is released. To reply, just mention @dosu. How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I want to use the function hallucination in Hugging Face.
But I face the error:
ERROR:trulens.providers.huggingface.endpoint:API error: {'error': 'https://api-inference.huggingface.co/ is no longer supported. Please use https://router.huggingface.co/hf-inference instead.'}.
WARNING:trulens.feedback.computer:feedback_name=Hallucination Score, record=662c3a5e-e02f-40d3-b17f-317aa3326044, span_group=None had an error during computation:
Please help me.
I am using TruLens 2.4.1
And install Hugging face: pip install trulens-providers-huggingface
Beta Was this translation helpful? Give feedback.
All reactions