Spaces:
Sleeping
Sleeping
Update functions.py
Browse files- functions.py +1 -14
functions.py
CHANGED
@@ -401,20 +401,7 @@ def create_helpfulness_checker(llm):
|
|
401 |
return helpfulness_grader
|
402 |
|
403 |
|
404 |
-
|
405 |
-
input_data = {"documents": documents,"question": question, }
|
406 |
-
try:
|
407 |
-
result = retrieval_grader.invoke(input_data)
|
408 |
-
return result
|
409 |
-
except Exception as e:
|
410 |
-
print(f"Error parsing result: {e}")
|
411 |
-
return {"score": "no"} # Default to "no" if there is an error
|
412 |
-
|
413 |
-
# Example usage
|
414 |
-
question = "What are the types of agent memory?"
|
415 |
-
documents = "Agents can have various types of memory, such as short-term memory and long-term memory."
|
416 |
-
grade = grade_document_relevance(documents,question )
|
417 |
-
print(grade) # Expected output: {'value': 'yes'}
|
418 |
|
419 |
|
420 |
def create_hallucination_checker(llm):
|
|
|
401 |
return helpfulness_grader
|
402 |
|
403 |
|
404 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
405 |
|
406 |
|
407 |
def create_hallucination_checker(llm):
|