-
Notifications
You must be signed in to change notification settings - Fork 168
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #477 from shekharchavan1990/oda_rag_poc
Oda rag poc
- Loading branch information
Showing
69 changed files
with
4,197 additions
and
0 deletions.
There are no files selected for viewing
467 changes: 467 additions & 0 deletions
467
LLM/oda_examples/oda-oci-data-science-oracledb-23ai-llm/Embedding Model Deployment.ipynb
Large diffs are not rendered by default.
Oops, something went wrong.
433 changes: 433 additions & 0 deletions
433
LLM/oda_examples/oda-oci-data-science-oracledb-23ai-llm/Langchain Model Deployment.ipynb
Large diffs are not rendered by default.
Oops, something went wrong.
163 changes: 163 additions & 0 deletions
163
LLM/oda_examples/oda-oci-data-science-oracledb-23ai-llm/Load Documents.ipynb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,163 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"id": "193f1d45-bb87-4602-9ebe-35c4e98f7f66", | ||
"metadata": {}, | ||
"source": [ | ||
"### OCI Data Science - Useful Tips\n", | ||
"<details>\n", | ||
"<summary><font size=\"2\">Check for Public Internet Access</font></summary>\n", | ||
"\n", | ||
"```python\n", | ||
"import requests\n", | ||
"response = requests.get(\"https://oracle.com\")\n", | ||
"assert response.status_code==200, \"Internet connection failed\"\n", | ||
"```\n", | ||
"</details>\n", | ||
"<details>\n", | ||
"<summary><font size=\"2\">Helpful Documentation </font></summary>\n", | ||
"<ul><li><a href=\"https://docs.cloud.oracle.com/en-us/iaas/data-science/using/data-science.htm\">Data Science Service Documentation</a></li>\n", | ||
"<li><a href=\"https://docs.cloud.oracle.com/iaas/tools/ads-sdk/latest/index.html\">ADS documentation</a></li>\n", | ||
"</ul>\n", | ||
"</details>\n", | ||
"<details>\n", | ||
"<summary><font size=\"2\">Typical Cell Imports and Settings for ADS</font></summary>\n", | ||
"\n", | ||
"```python\n", | ||
"%load_ext autoreload\n", | ||
"%autoreload 2\n", | ||
"%matplotlib inline\n", | ||
"\n", | ||
"import warnings\n", | ||
"warnings.filterwarnings('ignore')\n", | ||
"\n", | ||
"import logging\n", | ||
"logging.basicConfig(format='%(levelname)s:%(message)s', level=logging.ERROR)\n", | ||
"\n", | ||
"import ads\n", | ||
"from ads.dataset.factory import DatasetFactory\n", | ||
"from ads.automl.provider import OracleAutoMLProvider\n", | ||
"from ads.automl.driver import AutoML\n", | ||
"from ads.evaluations.evaluator import ADSEvaluator\n", | ||
"from ads.common.data import ADSData\n", | ||
"from ads.explanations.explainer import ADSExplainer\n", | ||
"from ads.explanations.mlx_global_explainer import MLXGlobalExplainer\n", | ||
"from ads.explanations.mlx_local_explainer import MLXLocalExplainer\n", | ||
"from ads.catalog.model import ModelCatalog\n", | ||
"from ads.common.model_artifact import ModelArtifact\n", | ||
"```\n", | ||
"</details>\n", | ||
"<details>\n", | ||
"<summary><font size=\"2\">Useful Environment Variables</font></summary>\n", | ||
"\n", | ||
"```python\n", | ||
"import os\n", | ||
"print(os.environ[\"NB_SESSION_COMPARTMENT_OCID\"])\n", | ||
"print(os.environ[\"PROJECT_OCID\"])\n", | ||
"print(os.environ[\"USER_OCID\"])\n", | ||
"print(os.environ[\"TENANCY_OCID\"])\n", | ||
"print(os.environ[\"NB_REGION\"])\n", | ||
"```\n", | ||
"</details>" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 2, | ||
"id": "7f46ded9-ff40-455d-9722-4e2a07ad738b", | ||
"metadata": { | ||
"tags": [] | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"from create_save_embeddings import load_documents" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 4, | ||
"id": "e857ddf5-74ef-446b-a581-98fa612f6816", | ||
"metadata": { | ||
"tags": [] | ||
}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"application/vnd.jupyter.widget-view+json": { | ||
"model_id": "d4b43e87df1f4f4884ceb3c3968b738a", | ||
"version_major": 2, | ||
"version_minor": 0 | ||
}, | ||
"text/plain": [ | ||
"loop1: 0%| | 0/4 [00:00<?, ?it/s]" | ||
] | ||
}, | ||
"metadata": {}, | ||
"output_type": "display_data" | ||
}, | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"WARNING:ads.common:In the future model input will be serialized by `cloudpickle` by default. Currently, model input are serialized into a dictionary containing serialized input data and original data type information.Set `model_input_serializer=\"cloudpickle\"` to use cloudpickle model input serializer.\n" | ||
] | ||
} | ||
], | ||
"source": [ | ||
"from ads.model.generic_model import GenericModel\n", | ||
"import ads\n", | ||
"\n", | ||
"ads.set_auth(\"resource_principal\")\n", | ||
"\n", | ||
"embedding_model = GenericModel.from_model_deployment(\n", | ||
" \"ocid1.datasciencemodeldeployment.oc1.<ocid>\"\n", | ||
")\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "702e1e22-cca2-4b82-a1ac-570e1d0f2e2f", | ||
"metadata": { | ||
"tags": [], | ||
"pycharm": { | ||
"is_executing": true | ||
} | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"load_documents(embed_model)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "926009ba-9fec-4ede-87c4-ea2282bc5857", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python [conda env:root] *", | ||
"language": "python", | ||
"name": "conda-root-py" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.8.19" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |
Oops, something went wrong.