diff --git a/.DS_Store b/.DS_Store
new file mode 100644
index 0000000..154b1de
Binary files /dev/null and b/.DS_Store differ
diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml
new file mode 100644
index 0000000..919ce1f
--- /dev/null
+++ b/.idea/codeStyles/Project.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/codeStyles/codeStyleConfig.xml b/.idea/codeStyles/codeStyleConfig.xml
new file mode 100644
index 0000000..a55e7a1
--- /dev/null
+++ b/.idea/codeStyles/codeStyleConfig.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..89ee753
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..8ccf390
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/rfp_response_automation.iml b/.idea/rfp_response_automation.iml
new file mode 100644
index 0000000..d6ebd48
--- /dev/null
+++ b/.idea/rfp_response_automation.iml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..35eb1dd
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.oca/custom_code_review_guidelines.txt b/.oca/custom_code_review_guidelines.txt
new file mode 100644
index 0000000..a0a3b63
--- /dev/null
+++ b/.oca/custom_code_review_guidelines.txt
@@ -0,0 +1,24 @@
+# Sample guideline, please follow similar structure for guideline with code samples
+# 1. Suggest using streams instead of simple loops for better readability.
+#
+# *Comment:
+# Category: Minor
+# Issue: Use streams instead of a loop for better readability.
+# Code Block:
+#
+# ```java
+# // Calculate squares of numbers
+# List squares = new ArrayList<>();
+# for (int number : numbers) {
+# squares.add(number * number);
+# }
+# ```
+# Recommendation:
+#
+# ```java
+# // Calculate squares of numbers
+# List squares = Arrays.stream(numbers)
+# .map(n -> n * n) // Map each number to its square
+# .toList();
+# ```
+#
diff --git a/files/graphrag_rerank.py b/files/graphrag_rerank.py
index fd144e8..3730bec 100644
--- a/files/graphrag_rerank.py
+++ b/files/graphrag_rerank.py
@@ -52,6 +52,14 @@ llm_for_rag = ChatOCIGenAI(
auth_profile="DEFAULT",
)
+
+embeddings = OCIGenAIEmbeddings(
+ model_id="cohere.embed-multilingual-v3.0",
+ service_endpoint="https://inference.generativeai.us-chicago-1.oci.oraclecloud.com",
+ compartment_id="ocid1.compartment.oc1..aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
+ auth_profile="DEFAULT",
+)
+
oracle_conn = oracledb.connect(
user=USERNAME,
password=PASSWORD,
@@ -170,13 +178,6 @@ ensure_oracle_text_index(
"IDX_REL_" + GRAPH_NAME + "_RELTYPE"
)
-embeddings = OCIGenAIEmbeddings(
- model_id="cohere.embed-multilingual-v3.0",
- service_endpoint="https://inference.generativeai.us-chicago-1.oci.oraclecloud.com",
- compartment_id="ocid1.compartment.oc1..aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
- auth_profile="DEFAULT",
-)
-
def create_knowledge_graph(chunks):
cursor = oracle_conn.cursor()
@@ -218,19 +219,19 @@ def create_knowledge_graph(chunks):
prompt = f"""
You are extracting structured RFP evidence from technical documentation.
-
+
Given the text below, identify ONLY explicit, verifiable facts.
-
+
Text:
{text}
-
+
Extract triples in ONE of the following formats ONLY:
-
+
1. REQUIREMENT -[HAS_SUBJECT]->
2. REQUIREMENT -[HAS_METRIC]->
3. REQUIREMENT -[HAS_VALUE]->
4. REQUIREMENT -[SUPPORTED_BY]->
-
+
Rules:
- Use REQUIREMENT as the source entity
- Use UPPERCASE relation names
@@ -536,6 +537,8 @@ def save_indexed_docs(docs):
# Main Function
# =========================
def chat():
+ pdf_paths = ['RFP - Financial v2.pdf']
+
already_indexed_docs = load_previously_indexed_docs()
updated_docs = set()
@@ -604,7 +607,7 @@ def chat():
retriever = vectorstore.as_retriever(search_type="similarity", search_kwargs={"k": 50, "fetch_k": 100})
RFP_DECISION_TEMPLATE = """
- You are answering an RFP.
+ You are answering an RFP requirement with risk awareness.
Requirement:
Type: {requirement_type}
@@ -623,6 +626,17 @@ def chat():
- If value differs, answer PARTIAL
- If not found, answer NO
+ Confidence rules:
+ - HIGH: Explicit evidence directly answers the requirement
+ - MEDIUM: Evidence partially matches or requires light interpretation
+ - LOW: Requirement is ambiguous OR evidence is indirect OR missing
+
+ Ambiguity rules:
+ - ambiguity_detected = true if:
+ - The requirement can be interpreted in more than one way
+ - Keywords are vague (e.g. "support", "integration", "capability")
+ - Evidence does not clearly bind to subject + expected value
+
OUTPUT CONSTRAINTS (MANDATORY):
- Return ONLY a valid JSON object
- Do NOT include explanations, comments, markdown, lists, or code fences
@@ -632,6 +646,9 @@ def chat():
JSON schema (return exactly this structure):
{{
"answer": "YES | NO | PARTIAL",
+ "confidence": "HIGH | MEDIUM | LOW",
+ "ambiguity_detected": true,
+ "confidence_reason": "",
"justification": "",
"evidence": [
{{
@@ -756,7 +773,7 @@ except:
print("No Faiss")
RFP_DECISION_TEMPLATE = """
-You are answering an RFP.
+You are answering an RFP requirement with risk awareness.
Requirement:
Type: {requirement_type}
@@ -775,6 +792,17 @@ Decision rules:
- If value differs, answer PARTIAL
- If not found, answer NO
+Confidence rules:
+- HIGH: Explicit evidence directly answers the requirement
+- MEDIUM: Evidence partially matches or requires light interpretation
+- LOW: Requirement is ambiguous OR evidence is indirect OR missing
+
+Ambiguity rules:
+- ambiguity_detected = true if:
+ - The requirement can be interpreted in more than one way
+ - Keywords are vague (e.g. "support", "integration", "capability")
+ - Evidence does not clearly bind to subject + expected value
+
OUTPUT CONSTRAINTS (MANDATORY):
- Return ONLY a valid JSON object
- Do NOT include explanations, comments, markdown, lists, or code fences
@@ -784,6 +812,9 @@ OUTPUT CONSTRAINTS (MANDATORY):
JSON schema (return exactly this structure):
{{
"answer": "YES | NO | PARTIAL",
+ "confidence": "HIGH | MEDIUM | LOW",
+ "ambiguity_detected": true,
+ "confidence_reason": "",
"justification": "",
"evidence": [
{{