Gourisankar Padihary
commited on
Commit
·
c8aa52c
1
Parent(s):
e384879
validation llm
Browse files
generator/extract_attributes.py
CHANGED
@@ -2,9 +2,6 @@ from generator.create_prompt import create_prompt
|
|
2 |
from generator.initialize_llm import initialize_validation_llm
|
3 |
from generator.document_utils import Document, apply_sentence_keys_documents, apply_sentence_keys_response
|
4 |
|
5 |
-
# Initialize the LLM
|
6 |
-
llm = initialize_validation_llm()
|
7 |
-
|
8 |
# Function to extract attributes
|
9 |
def extract_attributes(question, relevant_docs, response):
|
10 |
# Format documents into a string by accessing the `page_content` attribute of each Document
|
@@ -24,7 +21,10 @@ def extract_attributes(question, relevant_docs, response):
|
|
24 |
|
25 |
attribute_prompt = create_prompt(formatted_documents, question, formatted_responses)
|
26 |
|
|
|
|
|
|
|
27 |
# Instead of using BaseMessage, pass the formatted prompt directly to invoke
|
28 |
-
result =
|
29 |
|
30 |
return result, total_sentences
|
|
|
2 |
from generator.initialize_llm import initialize_validation_llm
|
3 |
from generator.document_utils import Document, apply_sentence_keys_documents, apply_sentence_keys_response
|
4 |
|
|
|
|
|
|
|
5 |
# Function to extract attributes
|
6 |
def extract_attributes(question, relevant_docs, response):
|
7 |
# Format documents into a string by accessing the `page_content` attribute of each Document
|
|
|
21 |
|
22 |
attribute_prompt = create_prompt(formatted_documents, question, formatted_responses)
|
23 |
|
24 |
+
# Initialize the LLM
|
25 |
+
llm_val = initialize_validation_llm()
|
26 |
+
|
27 |
# Instead of using BaseMessage, pass the formatted prompt directly to invoke
|
28 |
+
result = llm_val.invoke(attribute_prompt)
|
29 |
|
30 |
return result, total_sentences
|