Spaces:
Sleeping
Sleeping
Update rag_engine.py
Browse files- rag_engine.py +3 -3
rag_engine.py
CHANGED
@@ -404,7 +404,7 @@ def answer_with_llm(query, context=None, word_limit=100):
|
|
404 |
llm_model = st.secrets["LLM_MODEL"]
|
405 |
except KeyError:
|
406 |
print("❌ Error: LLM model not found in secrets")
|
407 |
-
return "I apologize, but I
|
408 |
|
409 |
response = openai.chat.completions.create(
|
410 |
model=llm_model,
|
@@ -426,7 +426,7 @@ def answer_with_llm(query, context=None, word_limit=100):
|
|
426 |
return answer
|
427 |
except Exception as e:
|
428 |
print(f"❌ LLM API error: {str(e)}")
|
429 |
-
return "I apologize, but I
|
430 |
|
431 |
def format_citations(sources):
|
432 |
"""
|
@@ -458,7 +458,7 @@ def cached_process_query(query, top_k=5, word_limit=100):
|
|
458 |
"""
|
459 |
Process a user query with caching to avoid redundant computation.
|
460 |
|
461 |
-
This function is cached with a
|
462 |
queries within this time period will return cached results rather than
|
463 |
reprocessing, improving responsiveness.
|
464 |
|
|
|
404 |
llm_model = st.secrets["LLM_MODEL"]
|
405 |
except KeyError:
|
406 |
print("❌ Error: LLM model not found in secrets")
|
407 |
+
return "I apologize, but I am unable to answer at the moment."
|
408 |
|
409 |
response = openai.chat.completions.create(
|
410 |
model=llm_model,
|
|
|
426 |
return answer
|
427 |
except Exception as e:
|
428 |
print(f"❌ LLM API error: {str(e)}")
|
429 |
+
return "I apologize, but I am unable to answer at the moment."
|
430 |
|
431 |
def format_citations(sources):
|
432 |
"""
|
|
|
458 |
"""
|
459 |
Process a user query with caching to avoid redundant computation.
|
460 |
|
461 |
+
This function is cached with a Time-To-Live (TTL) of 1 hour, meaning identical
|
462 |
queries within this time period will return cached results rather than
|
463 |
reprocessing, improving responsiveness.
|
464 |
|