mirror of
https://github.com/hoshikawa2/rfp_response_automation.git
synced 2026-03-03 16:09:35 +00:00
adjust
This commit is contained in:
7
.idea/codeStyles/Project.xml
generated
Normal file
7
.idea/codeStyles/Project.xml
generated
Normal 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
5
.idea/codeStyles/codeStyleConfig.xml
generated
Normal 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
6
.idea/misc.xml
generated
Normal 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
8
.idea/modules.xml
generated
Normal 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
9
.idea/rfp_response_automation.iml
generated
Normal 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
6
.idea/vcs.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
24
.oca/custom_code_review_guidelines.txt
Normal file
24
.oca/custom_code_review_guidelines.txt
Normal 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>
|
||||
@@ -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]-> <subject>
|
||||
2. REQUIREMENT -[HAS_METRIC]-> <metric name>
|
||||
3. REQUIREMENT -[HAS_VALUE]-> <exact value or limit>
|
||||
4. REQUIREMENT -[SUPPORTED_BY]-> <document section or sentence>
|
||||
|
||||
|
||||
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": "<short reason>",
|
||||
"justification": "<short factual explanation>",
|
||||
"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": "<short reason>",
|
||||
"justification": "<short factual explanation>",
|
||||
"evidence": [
|
||||
{{
|
||||
|
||||
Reference in New Issue
Block a user