diff --git a/app/requirements.txt b/app/requirements.txt index 28ff963..30b70a7 100644 --- a/app/requirements.txt +++ b/app/requirements.txt @@ -20,9 +20,9 @@ langchain-cohere==0.3.1 langchain-community==0.3.7 langchain-huggingface==0.1.2 langchain-ollama==0.2.0 -langchain-openai==0.2.8 -langgraph==0.2.48 -llama_index==0.11.23 +langchain-openai==0.2.9 +langgraph==0.2.53 +llama_index==0.12.1 lxml==5.3.0 matplotlib==3.9.2 oci>=2.0.0 diff --git a/app/src/modules/utilities.py b/app/src/modules/utilities.py index 558f819..5ed4ad0 100644 --- a/app/src/modules/utilities.py +++ b/app/src/modules/utilities.py @@ -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 @@ -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) @@ -370,7 +376,6 @@ def get_vs_tables(conn, enabled_embed): return json.dumps(output, indent=4) - ############################################################################### # Oracle Cloud Infrastructure ############################################################################### diff --git a/docs/content/walkthrough/_index.md b/docs/content/walkthrough/_index.md index 2f17a91..e11ef19 100644 --- a/docs/content/walkthrough/_index.md +++ b/docs/content/walkthrough/_index.md @@ -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"; @@ -215,7 +215,7 @@ To configure the On-Premises Embedding Model, navigate back to the _Configuratio To configure Oracle Database 23ai Free, navigate to the _Configuration -> Database_ screen: 1. Enter the Database Username: `WALKTHROUGH` -1. Enter the Database Password for `WALKTHROUGH`: `ORA_41_M_SANDBOX` +1. Enter the Database Password for `WALKTHROUGH`: `OrA_41_M_SANDBOX` 1. Enter the Database Connection String: `//localhost:1521/FREEPDB1` 1. Save @@ -256,7 +256,7 @@ From the command line: 1. Connect to the Oracle Database 23ai Database: ```bash - podman exec -it oaim-db sqlplus 'WALKTHROUGH/ORA_41_M_SANDBOX@FREEPDB1' + podman exec -it oaim-db sqlplus 'WALKTHROUGH/OrA_41_M_SANDBOX@FREEPDB1' ``` 1. Query the Vector Store: