Skip to content

Commit 1fbe857

Browse files
authored
Merge branch 'main' into ODSC-65658/llamaindex_docs
2 parents b965c8b + baf4f75 commit 1fbe857

File tree

37 files changed

+610
-493
lines changed

37 files changed

+610
-493
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,8 @@ celerybeat-schedule
8686
*.sage.py
8787

8888
# dotenv
89-
.env
89+
.env*
90+
run_ads.sh
9091

9192
# virtualenv
9293
.venv

README-development.md

Lines changed: 121 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,41 @@
1+
<!-- TOC -->
12
# Summary
23

34
The Oracle Accelerated Data Science (ADS) SDK used by data scientists and analysts for
45
data exploration and experimental machine learning to democratize machine learning and
5-
analytics by providing easy-to-use, performant, and user friendly tools that
6+
analytics by providing easy-to-use,
7+
performant, and user friendly tools that
68
brings together the best of data science practices.
79

810
The ADS SDK helps you connect to different data sources, perform exploratory data analysis,
911
data visualization, feature engineering, model training, model evaluation, and
1012
model interpretation. ADS also allows you to connect to the model catalog to save and load
1113
models to and from the catalog.
1214

15+
- [Summary](#summary)
16+
- [Documentation](#documentation)
17+
- [Get Support](#get-support)
18+
- [Getting started](#getting-started)
19+
- [Step 1: Create a conda environment](#step-1-create-a-conda-environment)
20+
- [Step 2: Activate your environment](#step-2-activate-your-environment)
21+
- [Step 3: Clone ADS and install dependencies](#step-3-clone-ads-and-install-dependencies)
22+
- [Step 4: Setup configuration files](#step-4-setup-configuration-files)
23+
- [Step 5: Versioning and generation the wheel](#step-5-versioning-and-generation-the-wheel)
24+
- [Running tests](#running-tests)
25+
- [Running default setup tests](#running-default-setup-tests)
26+
- [Running all unit tests](#running-all-unit-tests)
27+
- [Running integration tests](#running-integration-tests)
28+
- [Running opctl integration tests](#running-opctl-integration-tests)
29+
- [Local Setup of AQUA API JupyterLab Server](#local-setup-of-aqua-api-jupyterlab-server)
30+
- [Step 1: Requirements](#step-1-requirements)
31+
- [Step 2: Create local .env files](#step-2-create-local-env-files)
32+
- [Step 3: Add the run\_ads.sh script in the ADS Repository](#step-3-add-the-run_adssh-script-in-the-ads-repository)
33+
- [Step 4: Run the JupyterLab Server](#step-4-run-the-jupyterlab-server)
34+
- [Step 5: Run the unit tests for the AQUA API](#step-5-run-the-unit-tests-for-the-aqua-api)
35+
- [Security](#security)
36+
- [License](#license)
37+
38+
1339
## Documentation
1440

1541
- [ads-documentation](https://docs.oracle.com/en-us/iaas/tools/ads-sdk/latest/index.html)
@@ -137,6 +163,100 @@ To build development container, see the [Build Development Container Image](http
137163
python3 -m pytest tests/integration/opctl
138164
```
139165

166+
## Local Setup of AQUA API JupyterLab Server
167+
These are the steps to run the AQUA (AI Quick Actions) API Server for development and testing purposes. The source code for the AQUA API Server is [here](https://github.com/oracle/accelerated-data-science/tree/21ba00b95aef8581991fee6c7d558e2f2b1680ac/ads/aqua) within this repository.
168+
169+
### Step 1: Requirements
170+
+ Complete the [Getting Started](#getting-started) Section above, create a conda environment with python >3.9 or 3.10
171+
+ install any Rest API Client in your IDE (Thunder Client on [vscode](https://marketplace.visualstudio.com/items?itemName=rangav.vscode-thunder-client) or Postman)
172+
+ Activate the conda environment from the Getting Started Section and run
173+
174+
```
175+
pip install -r test-requirements.txt
176+
```
177+
178+
### Step 2: Create local .env files
179+
Running the local JuypterLab server requires setting OCI authentication, proxy, and OCI namespace parameters. Adapt this .env file with your specific OCI profile and OCIDs to set these variables.
180+
181+
```
182+
CONDA_BUCKET_NS="your_conda_bucket"
183+
http_proxy=""
184+
https_proxy=""
185+
HTTP_PROXY=""
186+
HTTPS_PROXY=""
187+
OCI_ODSC_SERVICE_ENDPOINT="your_service_endpoint"
188+
AQUA_SERVICE_MODELS_BUCKET="service-managed-models"
189+
AQUA_TELEMETRY_BUCKET_NS=""
190+
PROJECT_COMPARTMENT_OCID="ocid1.compartment.oc1.<your_ocid>"
191+
OCI_CONFIG_PROFILE="your_oci_profile_name"
192+
OCI_IAM_TYPE="security_token" # no modification needed if using token-based auth
193+
TENANCY_OCID="ocid1.tenancy.oc1.<your_ocid>"
194+
AQUA_JOB_SUBNET_ID="ocid1.subnet.oc1.<your_ocid>"
195+
ODSC_MODEL_COMPARTMENT_OCID="ocid1.compartment.oc1.<your_ocid>"
196+
PROJECT_OCID="ocid1.datascienceproject.oc1.<your_ocid>"
197+
```
198+
199+
### Step 3: Add the run_ads.sh script in the ADS Repository
200+
+ add the shell script below and .env file from step 2 to your local directory of the cloned ADS Repository
201+
+ Run ```chmox +x run_ads.sh``` after you create this script.
202+
```
203+
#!/bin/bash
204+
205+
#### Check if a CLI command is provided
206+
if [ "$#" -lt 1 ]; then
207+
echo "Usage: $0 <cli command>"
208+
exit 1
209+
fi
210+
211+
#### Load environment variables from .env file
212+
if [ -f .env ]; then
213+
export $(grep -v '^#' .env.int | xargs)
214+
else
215+
echo "Error: .env.int file not found!"
216+
exit 1
217+
fi
218+
219+
# Execute the CLI command
220+
"$@"
221+
```
222+
223+
### Step 4: Run the JupyterLab Server
224+
We can start the JupyterLab server using the following command
225+
226+
```
227+
./run_ads.sh jupyter lab --no-browser --ServerApp.disable_check_xsrf=True
228+
```
229+
+ run ```pkill jupyter-lab``` to kill the JupyterLab server and re-run server to reflect changes made locally to the AQUA API
230+
+ to test if server is running via CLI, run this in terminal
231+
232+
```
233+
./run_ads.sh ads aqua model list
234+
```
235+
236+
To make calls to the API, use the link http://localhost:8888/aqua/insert_handler_here with a REST API Client like Thunder Client/ Postman.
237+
238+
Examples of handlers
239+
```
240+
GET http://localhost:8888/aqua/model # calling the model_handler.py
241+
242+
GET http://localhost:8888/aqua/deployments # calling the deployment_handler.py
243+
```
244+
Handlers can be found [here](https://github.com/oracle/accelerated-data-science/tree/21ba00b95aef8581991fee6c7d558e2f2b1680ac/ads/aqua/extension).
245+
246+
### Step 5: Run the unit tests for the AQUA API
247+
All the unit tests can be found [here](https://github.com/oracle/accelerated-data-science/tree/main/tests/unitary/with_extras/aqua).
248+
The following commands detail how the unit tests can be run.
249+
```
250+
# Run all tests in AQUA project
251+
python -m pytest -q tests/unitary/with_extras/aqua/test_deployment.py
252+
253+
# Run all tests specific to a module within in AQUA project (ex. test_deployment.py, test_model.py, etc.)
254+
python -m pytest -q tests/unitary/with_extras/aqua/test_deployment.py
255+
256+
# Run specific test method within the module (replace test_get_deployment_default_params with targeted test method)
257+
python -m pytest tests/unitary/with_extras/aqua/test_deployment.py -k "test_get_deployment_default_params"
258+
```
259+
140260
## Security
141261

142262
Consult the [security guide](./SECURITY.md) for our responsible security

ads/aqua/common/enums.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env python
2-
# Copyright (c) 2024 Oracle and/or its affiliates.
2+
# Copyright (c) 2024, 2025 Oracle and/or its affiliates.
33
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
44

55
"""
@@ -8,23 +8,23 @@
88
This module contains the set of enums used in AQUA.
99
"""
1010

11-
from ads.common.extended_enum import ExtendedEnumMeta
11+
from ads.common.extended_enum import ExtendedEnum
1212

1313

14-
class DataScienceResource(str, metaclass=ExtendedEnumMeta):
14+
class DataScienceResource(ExtendedEnum):
1515
MODEL_DEPLOYMENT = "datasciencemodeldeployment"
1616
MODEL = "datasciencemodel"
1717

1818

19-
class Resource(str, metaclass=ExtendedEnumMeta):
19+
class Resource(ExtendedEnum):
2020
JOB = "jobs"
2121
JOBRUN = "jobruns"
2222
MODEL = "models"
2323
MODEL_DEPLOYMENT = "modeldeployments"
2424
MODEL_VERSION_SET = "model-version-sets"
2525

2626

27-
class Tags(str, metaclass=ExtendedEnumMeta):
27+
class Tags(ExtendedEnum):
2828
TASK = "task"
2929
LICENSE = "license"
3030
ORGANIZATION = "organization"
@@ -42,41 +42,41 @@ class Tags(str, metaclass=ExtendedEnumMeta):
4242
MODEL_ARTIFACT_FILE = "model_file"
4343

4444

45-
class InferenceContainerType(str, metaclass=ExtendedEnumMeta):
45+
class InferenceContainerType(ExtendedEnum):
4646
CONTAINER_TYPE_VLLM = "vllm"
4747
CONTAINER_TYPE_TGI = "tgi"
4848
CONTAINER_TYPE_LLAMA_CPP = "llama-cpp"
4949

5050

51-
class InferenceContainerTypeFamily(str, metaclass=ExtendedEnumMeta):
51+
class InferenceContainerTypeFamily(ExtendedEnum):
5252
AQUA_VLLM_CONTAINER_FAMILY = "odsc-vllm-serving"
5353
AQUA_TGI_CONTAINER_FAMILY = "odsc-tgi-serving"
5454
AQUA_LLAMA_CPP_CONTAINER_FAMILY = "odsc-llama-cpp-serving"
5555

5656

57-
class CustomInferenceContainerTypeFamily(str, metaclass=ExtendedEnumMeta):
57+
class CustomInferenceContainerTypeFamily(ExtendedEnum):
5858
AQUA_TEI_CONTAINER_FAMILY = "odsc-tei-serving"
5959

6060

61-
class InferenceContainerParamType(str, metaclass=ExtendedEnumMeta):
61+
class InferenceContainerParamType(ExtendedEnum):
6262
PARAM_TYPE_VLLM = "VLLM_PARAMS"
6363
PARAM_TYPE_TGI = "TGI_PARAMS"
6464
PARAM_TYPE_LLAMA_CPP = "LLAMA_CPP_PARAMS"
6565

6666

67-
class EvaluationContainerTypeFamily(str, metaclass=ExtendedEnumMeta):
67+
class EvaluationContainerTypeFamily(ExtendedEnum):
6868
AQUA_EVALUATION_CONTAINER_FAMILY = "odsc-llm-evaluate"
6969

7070

71-
class FineTuningContainerTypeFamily(str, metaclass=ExtendedEnumMeta):
71+
class FineTuningContainerTypeFamily(ExtendedEnum):
7272
AQUA_FINETUNING_CONTAINER_FAMILY = "odsc-llm-fine-tuning"
7373

7474

75-
class HuggingFaceTags(str, metaclass=ExtendedEnumMeta):
75+
class HuggingFaceTags(ExtendedEnum):
7676
TEXT_GENERATION_INFERENCE = "text-generation-inference"
7777

7878

79-
class RqsAdditionalDetails(str, metaclass=ExtendedEnumMeta):
79+
class RqsAdditionalDetails(ExtendedEnum):
8080
METADATA = "metadata"
8181
CREATED_BY = "createdBy"
8282
DESCRIPTION = "description"
@@ -86,7 +86,7 @@ class RqsAdditionalDetails(str, metaclass=ExtendedEnumMeta):
8686
VERSION_LABEL = "versionLabel"
8787

8888

89-
class TextEmbeddingInferenceContainerParams(str, metaclass=ExtendedEnumMeta):
89+
class TextEmbeddingInferenceContainerParams(ExtendedEnum):
9090
"""Contains a subset of params that are required for enabling model deployment in OCI Data Science. More options
9191
are available at https://huggingface.co/docs/text-embeddings-inference/en/cli_arguments"""
9292

ads/aqua/common/errors.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#!/usr/bin/env python
2-
# -*- coding: utf-8 -*-
3-
# Copyright (c) 2024 Oracle and/or its affiliates.
2+
# Copyright (c) 2024, 2025 Oracle and/or its affiliates.
43
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
54

65
"""
@@ -10,10 +9,10 @@
109
This module contains the set of Aqua exceptions.
1110
"""
1211

13-
from ads.common.extended_enum import ExtendedEnumMeta
12+
from ads.common.extended_enum import ExtendedEnum
1413

1514

16-
class ExitCode(str, metaclass=ExtendedEnumMeta):
15+
class ExitCode(ExtendedEnum):
1716
SUCCESS = 0
1817
COMMON_ERROR = 1
1918
INVALID_CONFIG = 10

ads/aqua/common/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565
from ads.aqua.data import AquaResourceIdentifier
6666
from ads.common.auth import AuthState, default_signer
6767
from ads.common.decorator.threaded import threaded
68-
from ads.common.extended_enum import ExtendedEnumMeta
68+
from ads.common.extended_enum import ExtendedEnum
6969
from ads.common.object_storage_details import ObjectStorageDetails
7070
from ads.common.oci_resource import SEARCH_TYPE, OCIResource
7171
from ads.common.utils import copy_file, get_console_link, upload_to_os
@@ -80,7 +80,7 @@
8080
logger = logging.getLogger("ads.aqua")
8181

8282

83-
class LifecycleStatus(str, metaclass=ExtendedEnumMeta):
83+
class LifecycleStatus(ExtendedEnum):
8484
UNKNOWN = ""
8585

8686
@property

ads/aqua/evaluation/constants.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#!/usr/bin/env python
2-
# -*- coding: utf-8 -*-
3-
# Copyright (c) 2024 Oracle and/or its affiliates.
2+
# Copyright (c) 2024, 2025 Oracle and/or its affiliates.
43
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
54

65
"""
@@ -9,17 +8,18 @@
98
109
This module contains constants/enums used in Aqua Evaluation.
1110
"""
11+
1212
from oci.data_science.models import JobRun
1313

14-
from ads.common.extended_enum import ExtendedEnumMeta
14+
from ads.common.extended_enum import ExtendedEnum
1515

1616
EVAL_TERMINATION_STATE = [
1717
JobRun.LIFECYCLE_STATE_SUCCEEDED,
1818
JobRun.LIFECYCLE_STATE_FAILED,
1919
]
2020

2121

22-
class EvaluationCustomMetadata(str, metaclass=ExtendedEnumMeta):
22+
class EvaluationCustomMetadata(ExtendedEnum):
2323
EVALUATION_SOURCE = "evaluation_source"
2424
EVALUATION_JOB_ID = "evaluation_job_id"
2525
EVALUATION_JOB_RUN_ID = "evaluation_job_run_id"
@@ -28,11 +28,11 @@ class EvaluationCustomMetadata(str, metaclass=ExtendedEnumMeta):
2828
EVALUATION_ERROR = "aqua_evaluate_error"
2929

3030

31-
class EvaluationConfig(str, metaclass=ExtendedEnumMeta):
31+
class EvaluationConfig(ExtendedEnum):
3232
PARAMS = "model_params"
3333

3434

35-
class EvaluationReportJson(str, metaclass=ExtendedEnumMeta):
35+
class EvaluationReportJson(ExtendedEnum):
3636
"""Contains evaluation report.json fields name."""
3737

3838
METRIC_SUMMARY_RESULT = "metric_summary_result"
@@ -43,7 +43,7 @@ class EvaluationReportJson(str, metaclass=ExtendedEnumMeta):
4343
DATASET = "dataset"
4444

4545

46-
class EvaluationMetricResult(str, metaclass=ExtendedEnumMeta):
46+
class EvaluationMetricResult(ExtendedEnum):
4747
"""Contains metric result's fields name in report.json."""
4848

4949
SHORT_NAME = "key"

ads/aqua/evaluation/errors.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
#!/usr/bin/env python
2-
# -*- coding: utf-8 -*-
3-
# Copyright (c) 2024 Oracle and/or its affiliates.
2+
# Copyright (c) 2024, 2025 Oracle and/or its affiliates.
43
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
54
"""
65
aqua.evaluation.errors
@@ -9,10 +8,10 @@
98
This module contains errors in Aqua Evaluation.
109
"""
1110

12-
from ads.common.extended_enum import ExtendedEnumMeta
11+
from ads.common.extended_enum import ExtendedEnum
1312

1413

15-
class EvaluationJobExitCode(str, metaclass=ExtendedEnumMeta):
14+
class EvaluationJobExitCode(ExtendedEnum):
1615
SUCCESS = 0
1716
COMMON_ERROR = 1
1817

ads/aqua/extension/models/ws_models.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
11
#!/usr/bin/env python
2-
# -*- coding: utf-8 -*--
32

4-
# Copyright (c) 2024 Oracle and/or its affiliates.
3+
# Copyright (c) 2024, 2025 Oracle and/or its affiliates.
54
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
65

76
from dataclasses import dataclass
87
from typing import List, Optional
98

10-
from ads.aqua.evaluation.entities import AquaEvaluationSummary, AquaEvaluationDetail
11-
from ads.aqua.model.entities import AquaModelSummary, AquaModel
9+
from ads.aqua.evaluation.entities import AquaEvaluationDetail, AquaEvaluationSummary
10+
from ads.aqua.model.entities import AquaModel, AquaModelSummary
1211
from ads.aqua.modeldeployment.entities import AquaDeployment, AquaDeploymentDetail
13-
from ads.common.extended_enum import ExtendedEnumMeta
12+
from ads.common.extended_enum import ExtendedEnum
1413
from ads.common.serializer import DataClassSerializable
1514

1615

17-
class RequestResponseType(str, metaclass=ExtendedEnumMeta):
16+
class RequestResponseType(ExtendedEnum):
1817
ListEvaluations = "ListEvaluations"
1918
EvaluationDetails = "EvaluationDetails"
2019
ListDeployments = "ListDeployments"

0 commit comments

Comments
 (0)