Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -429,7 +429,7 @@ def load_main_data_source():
|
|
| 429 |
# Split main content into chunks
|
| 430 |
text_splitter = RecursiveCharacterTextSplitter(
|
| 431 |
chunk_size=2000, # Adjust based on context window
|
| 432 |
-
chunk_overlap=
|
| 433 |
separators=["\n\n", "\n", ".", " "] # Prioritize splitting at logical breaks
|
| 434 |
)
|
| 435 |
main_texts = text_splitter.split_text(main_content)
|
|
@@ -1028,7 +1028,7 @@ def search_knowledge_base(query):
|
|
| 1028 |
return []
|
| 1029 |
|
| 1030 |
# Retrieve the top 5 most relevant documents
|
| 1031 |
-
retrieved_docs = st.session_state["faiss_db"].similarity_search(query, k=
|
| 1032 |
return retrieved_docs
|
| 1033 |
|
| 1034 |
def google_search(query):
|
|
@@ -1144,7 +1144,7 @@ tools = [
|
|
| 1144 |
prompt_message = f"""
|
| 1145 |
** You are a Professional copywriter tasked with creating non-flowery fluid, interconnected marketing content that integrates Trust Builders into various formats for food for the hungry. Your content should be compelling, factual, well-structured, concise, and based on the knowledgebase. Write in an active voice using the first-person perspective ("we"), and avoid the third-person perspective. Creatively interconnect trust-building elements to enhance flow and impact. Avoid using terms like Stability, Development, Competence, Relationship, Benefit, Vision, trust, beacon, beacon of hope, and realm, except where specified.
|
| 1146 |
|
| 1147 |
-
-When 'our,','FH,' or 'food for the hungry' is mentioned, use knowledgebase
|
| 1148 |
|
| 1149 |
###Mandatory Verification Checklist
|
| 1150 |
Before submitting any content, ensure it includes:
|
|
@@ -2032,7 +2032,7 @@ def handle_prompt(prompt):
|
|
| 2032 |
display_typing_indicator()
|
| 2033 |
cleaned_text = ""
|
| 2034 |
base_instructions = (
|
| 2035 |
-
"Strictly Avoid flowery language, typical AI phrases and jargons.
|
| 2036 |
"Strictly dont use trustbucket names in copy headings and content avoid it"
|
| 2037 |
)
|
| 2038 |
|
|
|
|
| 429 |
# Split main content into chunks
|
| 430 |
text_splitter = RecursiveCharacterTextSplitter(
|
| 431 |
chunk_size=2000, # Adjust based on context window
|
| 432 |
+
chunk_overlap=400, # Ensure continuity between chunks
|
| 433 |
separators=["\n\n", "\n", ".", " "] # Prioritize splitting at logical breaks
|
| 434 |
)
|
| 435 |
main_texts = text_splitter.split_text(main_content)
|
|
|
|
| 1028 |
return []
|
| 1029 |
|
| 1030 |
# Retrieve the top 5 most relevant documents
|
| 1031 |
+
retrieved_docs = st.session_state["faiss_db"].similarity_search(query, k=3)
|
| 1032 |
return retrieved_docs
|
| 1033 |
|
| 1034 |
def google_search(query):
|
|
|
|
| 1144 |
prompt_message = f"""
|
| 1145 |
** You are a Professional copywriter tasked with creating non-flowery fluid, interconnected marketing content that integrates Trust Builders into various formats for food for the hungry. Your content should be compelling, factual, well-structured, concise, and based on the knowledgebase. Write in an active voice using the first-person perspective ("we"), and avoid the third-person perspective. Creatively interconnect trust-building elements to enhance flow and impact. Avoid using terms like Stability, Development, Competence, Relationship, Benefit, Vision, trust, beacon, beacon of hope, and realm, except where specified.
|
| 1146 |
|
| 1147 |
+
-When 'our,','FH,' or 'food for the hungry' is mentioned, use knowledgebase first.*
|
| 1148 |
|
| 1149 |
###Mandatory Verification Checklist
|
| 1150 |
Before submitting any content, ensure it includes:
|
|
|
|
| 2032 |
display_typing_indicator()
|
| 2033 |
cleaned_text = ""
|
| 2034 |
base_instructions = (
|
| 2035 |
+
"Strictly Avoid flowery language, typical AI phrases and jargons. When aksed about"
|
| 2036 |
"Strictly dont use trustbucket names in copy headings and content avoid it"
|
| 2037 |
)
|
| 2038 |
|