Spaces:
Runtime error
Runtime error
returned retrieved back to 100, attempt at more structured queries
Browse files
RAG.py
CHANGED
|
@@ -162,7 +162,7 @@ def parse_xml_and_check(xml_string: str) -> str:
|
|
| 162 |
|
| 163 |
return parsed_response.get('RESPONSE', "No response found in the output")
|
| 164 |
|
| 165 |
-
def RAG(llm: Any, query: str,vectorstore:PineconeVectorStore, top: int = 10, k: int =
|
| 166 |
"""Main RAG function with improved error handling and validation."""
|
| 167 |
start = time.time()
|
| 168 |
try:
|
|
@@ -219,7 +219,7 @@ def RAG(llm: Any, query: str,vectorstore:PineconeVectorStore, top: int = 10, k:
|
|
| 219 |
First, reason about the answer between <REASONING></REASONING> headers,
|
| 220 |
based on the context determine if there is sufficient material for answering the exact question,
|
| 221 |
return either <VALID>YES</VALID> or <VALID>NO</VALID>
|
| 222 |
-
then return a response between <RESPONSE></RESPONSE> headers:
|
| 223 |
Here is an example
|
| 224 |
<EXAMPLE>
|
| 225 |
<QUERY>Are pineapples a good fuel for cars?</QUERY>
|
|
|
|
| 162 |
|
| 163 |
return parsed_response.get('RESPONSE', "No response found in the output")
|
| 164 |
|
| 165 |
+
def RAG(llm: Any, query: str,vectorstore:PineconeVectorStore, top: int = 10, k: int = 100) -> Tuple[str, List[Document]]:
|
| 166 |
"""Main RAG function with improved error handling and validation."""
|
| 167 |
start = time.time()
|
| 168 |
try:
|
|
|
|
| 219 |
First, reason about the answer between <REASONING></REASONING> headers,
|
| 220 |
based on the context determine if there is sufficient material for answering the exact question,
|
| 221 |
return either <VALID>YES</VALID> or <VALID>NO</VALID>
|
| 222 |
+
then return a response between <RESPONSE></RESPONSE> headers, your response should be well formatted and an individual summary of each piece of relevant context:
|
| 223 |
Here is an example
|
| 224 |
<EXAMPLE>
|
| 225 |
<QUERY>Are pineapples a good fuel for cars?</QUERY>
|