Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions backend/score.py
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,7 @@ async def magic_trek_chat_bot(
print(messages)
print(len(messages))
print(f"document_names = {document_names}")
print(f"filter_properties = {filter_properties}")
logging.info(f"requireGrounding = {requireGrounding}")
logging.info(f"IAN-TEST called at {datetime.now()}")
qa_rag_start_time = time.time()
Expand Down
19 changes: 17 additions & 2 deletions backend/src/QA_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -397,22 +397,37 @@ def initialize_neo4j_vector(graph, chat_mode_settings):

def create_retriever(neo_db, document_names, chat_mode_settings,search_k, score_threshold,ef_ratio, filter_properties=None):
if document_names and chat_mode_settings["document_filter"]:
# Combine filter_properties with fileName filter
base_filter = {'fileName': {'$in': document_names}}
if filter_properties:
base_filter.update(filter_properties)

retriever = neo_db.as_retriever(
search_type="similarity_score_threshold",
search_kwargs={
'top_k': search_k,
'effective_search_ratio': ef_ratio,
'score_threshold': score_threshold,
'filter': {'fileName': {'$in': document_names}}
'filter': base_filter
}
)
logging.info(f"Successfully created retriever with search_k={search_k}, score_threshold={score_threshold} for documents {document_names}")
else:
# note from ian changed the way this is written slightly to match how the upstream team is doing it, passing filter_properties or None to search_kwargs literal.

search_kwargs = {
'k': search_k,
'score_threshold': score_threshold
}
if filter_properties is not None:
search_kwargs['filter'] = filter_properties

retriever = neo_db.as_retriever(
search_type="similarity_score_threshold",
search_kwargs={'top_k': search_k,'effective_search_ratio': ef_ratio, 'score_threshold': score_threshold, "filter_properties": filter_properties if filter_properties is not None else None }
# search_kwargs={'top_k': search_k,'effective_search_ratio': ef_ratio, 'score_threshold': score_threshold, "filter_properties": filter_properties if filter_properties is not None else None }
search_kwargs=search_kwargs
)
print(f"search_kwargs = {search_kwargs}")
logging.info(f"Successfully created retriever with search_k={search_k}, score_threshold={score_threshold}")
return retriever

Expand Down
27 changes: 22 additions & 5 deletions deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,20 @@

# Variables - Replace with your actual values

AWS_REGION="us-east-1"
AWS_ENV="dev"
AWS_ACCOUNT_ID="288761770129" # 288 is graphbuilder-dev

# uncomment htis for 'dev' (labs llm-graphbuilder)
# AWS_REGION="us-east-1"
# AWS_ENV="dev"
# AWS_ACCOUNT_ID="288761770129" # 288 is graphbuilder-dev

# uncomment this for 'metrix-demo-dev' (metrix-demo-dev)
AWS_REGION="us-east-2"
AWS_ENV="metrix-demo-dev"
AWS_ACCOUNT_ID="860839672899"

ECR_REPOSITORY="graphbuilder-docker-repo-$AWS_ENV"
ENV_FILE="./${AWS_ENV}.env"
echo "Using ENV_FILE $ENV_FILE"
TAG="latest" # You can change this if you need a specific tag

folder_name=$(basename "$PWD")
Expand All @@ -14,9 +24,16 @@ echo "Using AWS_PROFILE $AWS_PROFILE"
echo "Using AWS_ENV $AWS_ENV"
echo "Using ECR_REPOSITORY $ECR_REPOSITORY"

# 1. Build Docker images using Docker Compose
# 1. Load environment variables from .env file
echo "Loading environment variables from $ENV_FILE..."
set -a # automatically export all variables
source $ENV_FILE
set +a # turn off automatic export

# 2. Build Docker images using Docker Compose
echo "Building Docker images..."
docker-compose build --no-cache --progress=plain
# docker-compose build --no-cache --progress=plain
docker-compose build

# 2. Authenticate Docker to AWS ECR
echo "Authenticating to AWS ECR..."
Expand Down