Skip to content

Commit 94af4e6

Browse files
committed
update RAG
1 parent 69d5f07 commit 94af4e6

2 files changed

Lines changed: 8 additions & 11 deletions

File tree

jac-gpt-fullstack/services/jacServer.impl.jac

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,11 +123,11 @@ HOW TO RESPOND:
123123
124124
Jac documentation RAG USAGE:
125125
- Do not use URLs in queries.
126-
- BREAK DOWN the user's query into individual components AND aspects. Execute SEPARATE search_docs calls for EACH concept AND each aspect independently. For example: if asked "What are nodes and edges", execute separate searches: "nodes definition in Jac", "nodes usage in Jac", "nodes examples in Jac", then "edges definition in Jac", "edges usage in Jac", "edges examples in Jac". Do not combine multiple aspects (definition/usage/examples) into a single search query.
126+
- BREAK DOWN the user's query into individual components AND aspects. Execute SEPARATE search_docs calls for EACH concept AND each aspect independently. For example: if asked "What are nodes and edges", execute separate searches: "nodes definition in Jac", "nodes in Jac", "nodes examples in Jac", then "edges definition in Jac", "edges in Jac", "edges examples in Jac". Do not combine multiple aspects (definition/examples) into a single search query.
127127
- USE SPECIFIC, CONTEXTUAL search queries - NOT just single keywords. Frame queries as questions or descriptive phrases that include context (e.g., "byllm definition" NOT just "byllm", "enums definition" NOT just "enum", "nodes example").
128-
- Include relevant context in search queries to retrieve comprehensive documentation (e.g., "syntax", "usage", "examples", "definition", "how to").
128+
- Include relevant context in search queries to retrieve comprehensive documentation (e.g., "syntax", "examples", "definition", "how to").
129129
- If information cannot be found, retry searches progressively using different phrasing, synonyms, related terminology(eg: enum -> enumerations), and key terms from previously retrieved docs.
130-
- Interpret and apply the documentation rather than copying it verbatim; include comprehensive examples when they are necessary for clarity.
130+
- VERY IMPORTANT: Interpret and apply the documentation rather than copying it verbatim; include comprehensive examples when they are necessary for clarity.
131131
- Never re-run previous searches.
132132
- ONlY run additional searches if any concept, syntax, command, or behavior is not explicitly confirmed/found in the retrieved documentation.
133133

jac-gpt-fullstack/services/rag_engine.jac

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -236,19 +236,16 @@ obj RagEngine {
236236
# Extract documents and prepare query-document pairs
237237
docs_only = [doc for (doc, _) in documents];
238238

239-
# Create query-document pairs for CrossEncoder with metadata context
240-
pairs = [];
241-
for doc in docs_only {
242-
# Use enriched content with metadata for reranking
243-
enriched_content = self.enrich_content_with_metadata(doc);
244-
reranked_query = """Query: ${query}
239+
reranked_query = """Query: ${query}
245240
Evaluate how well this document directly answers the query.
246241
Rank higher if it contains specific, relevant information that satisfies the query intent, such as clear explanations, correct syntax, concrete details, or code examples when appropriate.
247242
Rank lower if it only mentions related concepts, is overly general, or does not meaningfully address the query.
248243
Focus on semantic relevance and answer completeness rather than keyword overlap.""";
249244

250-
pairs.append((reranked_query, enriched_content));
251-
}
245+
pairs = [
246+
(reranked_query, doc.metadata.get('original_content', doc.page_content))
247+
for doc in docs_only
248+
];
252249

253250
# Get reranking scores
254251
scores = self.cross_encoder.predict(

0 commit comments

Comments
 (0)