Spaces:
Sleeping
Sleeping
Update functions.py
Browse files- functions.py +3 -3
functions.py
CHANGED
|
@@ -401,7 +401,7 @@ def create_helpfulness_checker(llm):
|
|
| 401 |
return helpfulness_grader
|
| 402 |
|
| 403 |
|
| 404 |
-
def grade_document_relevance(question: str, document: str):
|
| 405 |
input_data = {"documents": documents,"question": question, }
|
| 406 |
try:
|
| 407 |
result = retrieval_grader.invoke(input_data)
|
|
@@ -504,7 +504,7 @@ def create_question_rewriter(llm):
|
|
| 504 |
return question_rewriter
|
| 505 |
|
| 506 |
|
| 507 |
-
def transform_query(state):
|
| 508 |
"""
|
| 509 |
Transform the query to produce a better question.
|
| 510 |
|
|
@@ -553,7 +553,7 @@ def format_google_results(google_results):
|
|
| 553 |
return formatted_documents
|
| 554 |
|
| 555 |
|
| 556 |
-
def grade_generation_v_documents_and_question(state):
|
| 557 |
"""
|
| 558 |
Determines whether the generation is grounded in the document and answers the question.
|
| 559 |
"""
|
|
|
|
| 401 |
return helpfulness_grader
|
| 402 |
|
| 403 |
|
| 404 |
+
def grade_document_relevance(question: str, document: str, retrieval_grader):
|
| 405 |
input_data = {"documents": documents,"question": question, }
|
| 406 |
try:
|
| 407 |
result = retrieval_grader.invoke(input_data)
|
|
|
|
| 504 |
return question_rewriter
|
| 505 |
|
| 506 |
|
| 507 |
+
def transform_query(state, question_rewriter):
|
| 508 |
"""
|
| 509 |
Transform the query to produce a better question.
|
| 510 |
|
|
|
|
| 553 |
return formatted_documents
|
| 554 |
|
| 555 |
|
| 556 |
+
def grade_generation_v_documents_and_question(state,hallucination_grader,answer_grader ):
|
| 557 |
"""
|
| 558 |
Determines whether the generation is grounded in the document and answers the question.
|
| 559 |
"""
|