Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Catch exception when RAG not set. #50

Merged
merged 1 commit into from
Nov 21, 2024
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
35 changes: 20 additions & 15 deletions app/src/modules/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,19 +235,24 @@ def init_vs(db_conn, embedding_function, store_table, distance_metric):

def get_vs_table(model, chunk_size, chunk_overlap, distance_metric, embed_alias=None):
"""Return the concatenated VS Table name and comment"""
chunk_overlap_ceil = math.ceil(chunk_overlap)
table_string = f"{model}_{chunk_size}_{chunk_overlap_ceil}_{distance_metric}"
if embed_alias:
table_string = f"{embed_alias}_{table_string}"
store_table = re.sub(r"\W", "_", table_string.upper())
store_comment = (
f'{{"alias": "{embed_alias}",'
f'"model": "{model}",'
f'"chunk_size": {chunk_size},'
f'"chunk_overlap": {chunk_overlap_ceil},'
f'"distance_metric": "{distance_metric}"}}'
)
logger.info("Vector Store Table: %s; Comment: %s", store_table, store_comment)
store_table = None
store_comment = None
try:
chunk_overlap_ceil = math.ceil(chunk_overlap)
table_string = f"{model}_{chunk_size}_{chunk_overlap_ceil}_{distance_metric}"
if embed_alias:
table_string = f"{embed_alias}_{table_string}"
store_table = re.sub(r"\W", "_", table_string.upper())
store_comment = (
f'{{"alias": "{embed_alias}",'
f'"model": "{model}",'
f'"chunk_size": {chunk_size},'
f'"chunk_overlap": {chunk_overlap_ceil},'
f'"distance_metric": "{distance_metric}"}}'
)
logger.info("Vector Store Table: %s; Comment: %s", store_table, store_comment)
except TypeError:
logger.fatal("Not all required values provided to get Vector Store Table name.")
return store_table, store_comment


Expand Down Expand Up @@ -332,7 +337,8 @@ def json_to_doc(file: str):
# Build the Index
logger.info("Creating index on: %s", store_table)
try:
LangchainVS.create_index(db_conn, vectorstore)
params = {"idx_name": f"{store_table}_HNSW_IDX", "idx_type": "HNSW"}
LangchainVS.create_index(db_conn, vectorstore, params)
except Exception as ex:
logger.error("Unable to create vector index: %s", ex)

Expand Down Expand Up @@ -370,7 +376,6 @@ def get_vs_tables(conn, enabled_embed):

return json.dumps(output, indent=4)


###############################################################################
# Oracle Cloud Infrastructure
###############################################################################
Expand Down
2 changes: 1 addition & 1 deletion docs/content/walkthrough/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ To start Oracle Database 23ai Free:

alter session set container=FREEPDB1;

CREATE USER "WALKTHROUGH" IDENTIFIED BY ORA_41_M_SANDBOX
CREATE USER "WALKTHROUGH" IDENTIFIED BY OrA_41_M_SANDBOX
DEFAULT TABLESPACE "USERS"
TEMPORARY TABLESPACE "TEMP";
GRANT "DB_DEVELOPER_ROLE" TO "WALKTHROUGH";
Expand Down