Skip to content

Commit

Permalink
changed rag input from summary to full text
Browse files Browse the repository at this point in the history
  • Loading branch information
karthiksoman committed Sep 24, 2024
1 parent e8eb5db commit 12a21f7
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 199 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
code/notebook/.ipynb_checkpoints/
code/__pycache__/
code/.ipynb_checkpoints/
.virtual_documents/
.gpt_config.env
.DS_Store
manuscript/
# lambda-pipeline
Expand Down
191 changes: 0 additions & 191 deletions code/notebook/.ipynb_checkpoints/pinecone_retrieval-checkpoint.ipynb

This file was deleted.

12 changes: 6 additions & 6 deletions code/notebook/pinecone_retrieval.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
"execution_count": 51,
"execution_count": 1,
"id": "d9a114f4-c03a-49bf-a519-89db2c5bb3f1",
"metadata": {},
"outputs": [],
Expand All @@ -23,7 +23,7 @@
},
{
"cell_type": "code",
"execution_count": 52,
"execution_count": 2,
"id": "2dc22ebd-63d5-4b4c-a2dc-eabb627dae82",
"metadata": {},
"outputs": [],
Expand All @@ -37,7 +37,7 @@
},
{
"cell_type": "code",
"execution_count": 53,
"execution_count": 3,
"id": "a1db1e41-63a4-4b80-9e72-ccdef603d73f",
"metadata": {},
"outputs": [],
Expand All @@ -55,7 +55,7 @@
},
{
"cell_type": "code",
"execution_count": 54,
"execution_count": 4,
"id": "cadb5fb8-2ed1-4cbe-a124-c0dfba19594b",
"metadata": {},
"outputs": [],
Expand All @@ -69,7 +69,7 @@
},
{
"cell_type": "code",
"execution_count": 56,
"execution_count": 5,
"id": "ba3dd1db-8385-4e36-abcc-79aae7cafcd0",
"metadata": {},
"outputs": [],
Expand All @@ -83,7 +83,7 @@
},
{
"cell_type": "code",
"execution_count": 66,
"execution_count": 6,
"id": "2988ef50-0906-40f0-9228-ba56e671f22e",
"metadata": {},
"outputs": [],
Expand Down
5 changes: 3 additions & 2 deletions lambda-pipeline/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def get_model_response(input_text, temperature: float = 0.7):
logging.error(f"Failed to get model response: {str(e)}")
return None

def get_rag_context(query, top_k=5):
def get_rag_context(query, top_k=2):
try:
embed_model = OpenAIEmbedding(
model='text-embedding-ada-002',
Expand All @@ -47,7 +47,8 @@ def get_rag_context(query, top_k=5):
top_k=top_k,
include_metadata=True
)
extracted_context_summary = list(map(lambda x: json.loads(x.metadata['_node_content'])['metadata']['section_summary'], retrieved_doc.matches))
# extracted_context_summary = list(map(lambda x: json.loads(x.metadata['_node_content'])['metadata']['section_summary'], retrieved_doc.matches))
extracted_context_summary = list(map(lambda x: json.loads(x.metadata['_node_content'])['metadata']['text'], retrieved_doc.matches))
provenance = list(map(lambda x: x.metadata['c_document_id'], retrieved_doc.matches))
context = ''
for i in range(top_k):
Expand Down

0 comments on commit 12a21f7

Please sign in to comment.