Skip to content

Commit

Permalink
Merge branch 'main' into cdb-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
corradodebari committed Dec 10, 2024
2 parents f5a37fa + c6911aa commit 360129f
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 21 deletions.
6 changes: 3 additions & 3 deletions app/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
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
6 changes: 3 additions & 3 deletions 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 Expand Up @@ -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

Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 360129f

Please sign in to comment.