This commit is contained in:
2026-01-10 07:50:18 -03:00
parent fe049b0555
commit 2e3f74d8dd
9 changed files with 110 additions and 14 deletions

BIN
.DS_Store vendored Normal file

Binary file not shown.

7
.idea/codeStyles/Project.xml generated Normal file
View File

@@ -0,0 +1,7 @@
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<ScalaCodeStyleSettings>
<option name="MULTILINE_STRING_CLOSING_QUOTES_ON_NEW_LINE" value="true" />
</ScalaCodeStyleSettings>
</code_scheme>
</component>

5
.idea/codeStyles/codeStyleConfig.xml generated Normal file
View File

@@ -0,0 +1,5 @@
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
</state>
</component>

6
.idea/misc.xml generated Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_24" default="true" project-jdk-name="24" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

8
.idea/modules.xml generated Normal file
View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/rfp_response_automation.iml" filepath="$PROJECT_DIR$/.idea/rfp_response_automation.iml" />
</modules>
</component>
</project>

9
.idea/rfp_response_automation.iml generated Normal file
View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

6
.idea/vcs.xml generated Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>

View File

@@ -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.
# <example>
# *Comment:
# Category: Minor
# Issue: Use streams instead of a loop for better readability.
# Code Block:
#
# ```java
# // Calculate squares of numbers
# List<Integer> squares = new ArrayList<>();
# for (int number : numbers) {
# squares.add(number * number);
# }
# ```
# Recommendation:
#
# ```java
# // Calculate squares of numbers
# List<Integer> squares = Arrays.stream(numbers)
# .map(n -> n * n) // Map each number to its square
# .toList();
# ```
# </example>

View File

@@ -52,6 +52,14 @@ llm_for_rag = ChatOCIGenAI(
auth_profile="DEFAULT", 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( oracle_conn = oracledb.connect(
user=USERNAME, user=USERNAME,
password=PASSWORD, password=PASSWORD,
@@ -170,13 +178,6 @@ ensure_oracle_text_index(
"IDX_REL_" + GRAPH_NAME + "_RELTYPE" "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): def create_knowledge_graph(chunks):
cursor = oracle_conn.cursor() cursor = oracle_conn.cursor()
@@ -536,6 +537,8 @@ def save_indexed_docs(docs):
# Main Function # Main Function
# ========================= # =========================
def chat(): def chat():
pdf_paths = ['RFP - Financial v2.pdf']
already_indexed_docs = load_previously_indexed_docs() already_indexed_docs = load_previously_indexed_docs()
updated_docs = set() updated_docs = set()
@@ -604,7 +607,7 @@ def chat():
retriever = vectorstore.as_retriever(search_type="similarity", search_kwargs={"k": 50, "fetch_k": 100}) retriever = vectorstore.as_retriever(search_type="similarity", search_kwargs={"k": 50, "fetch_k": 100})
RFP_DECISION_TEMPLATE = """ RFP_DECISION_TEMPLATE = """
You are answering an RFP. You are answering an RFP requirement with risk awareness.
Requirement: Requirement:
Type: {requirement_type} Type: {requirement_type}
@@ -623,6 +626,17 @@ def chat():
- If value differs, answer PARTIAL - If value differs, answer PARTIAL
- If not found, answer NO - 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): OUTPUT CONSTRAINTS (MANDATORY):
- Return ONLY a valid JSON object - Return ONLY a valid JSON object
- Do NOT include explanations, comments, markdown, lists, or code fences - Do NOT include explanations, comments, markdown, lists, or code fences
@@ -632,6 +646,9 @@ def chat():
JSON schema (return exactly this structure): JSON schema (return exactly this structure):
{{ {{
"answer": "YES | NO | PARTIAL", "answer": "YES | NO | PARTIAL",
"confidence": "HIGH | MEDIUM | LOW",
"ambiguity_detected": true,
"confidence_reason": "<short reason>",
"justification": "<short factual explanation>", "justification": "<short factual explanation>",
"evidence": [ "evidence": [
{{ {{
@@ -756,7 +773,7 @@ except:
print("No Faiss") print("No Faiss")
RFP_DECISION_TEMPLATE = """ RFP_DECISION_TEMPLATE = """
You are answering an RFP. You are answering an RFP requirement with risk awareness.
Requirement: Requirement:
Type: {requirement_type} Type: {requirement_type}
@@ -775,6 +792,17 @@ Decision rules:
- If value differs, answer PARTIAL - If value differs, answer PARTIAL
- If not found, answer NO - 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): OUTPUT CONSTRAINTS (MANDATORY):
- Return ONLY a valid JSON object - Return ONLY a valid JSON object
- Do NOT include explanations, comments, markdown, lists, or code fences - Do NOT include explanations, comments, markdown, lists, or code fences
@@ -784,6 +812,9 @@ OUTPUT CONSTRAINTS (MANDATORY):
JSON schema (return exactly this structure): JSON schema (return exactly this structure):
{{ {{
"answer": "YES | NO | PARTIAL", "answer": "YES | NO | PARTIAL",
"confidence": "HIGH | MEDIUM | LOW",
"ambiguity_detected": true,
"confidence_reason": "<short reason>",
"justification": "<short factual explanation>", "justification": "<short factual explanation>",
"evidence": [ "evidence": [
{{ {{