Skip to content

Commit e3b983f

Browse files
Merge branch 'scoring_services' of https://github.com/sassoftware/python-sasctl into scoring_services
2 parents 695df3b + 7e95256 commit e3b983f

File tree

9 files changed

+429
-25
lines changed

9 files changed

+429
-25
lines changed

.github/workflows/build-test-deploy.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
LANG: en_US.UTF-8
2222
strategy:
2323
matrix:
24-
python-version: ['3.6', '3.7', '3.8', '3.9', '3.10']
24+
python-version: ['3.8', '3.9', '3.10', '3.11']
2525
os-version: ['ubuntu-20.04', 'windows-latest', 'macos-latest']
2626
# Pinned Ubuntu version to 20.04 since no Python 3.6 builds available on ubuntu-latest (22.04) as of 2022-12-7.
2727
# os-version: [ubuntu-latest, windows-latest, macos-latest]
@@ -45,7 +45,7 @@ jobs:
4545
run: |
4646
# Setup tox & code coverage
4747
pip install --upgrade pip
48-
pip install tox tox-gh-actions pytest pytest-cov scikit-learn
48+
pip install tox tox-gh-actions pytest pytest-cov 'scikit-learn<=1.5.0' 'numpy<2.0.0'
4949
5050
- name: Run Tests
5151
run: |

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,16 @@ Unreleased
55
- Add `model_info` class to better capture model information.
66
- Test `/examples` Jupyter notebooks within normal test suite.
77

8+
v1.10.4 (2024-07-08)
9+
----------
10+
**Improvements**
11+
- Added example Jupyter notebook for OpenAI models.
12+
13+
**Buxfixes**
14+
- Dropped support for Python 3.6 and Python 3.7, as those are no longer officially supported versions.
15+
- Added `dmcas_misc.json` template file for model card generation.
16+
- Updated generation of `ModelProperties.json` to allow for model card generation immediately upon upload.
17+
818
v1.10.3 (2024-04-12)
919
----------
1020
**Bugfixes**

examples/README.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ Tasks and Services
3737
- [Modeling with Python & SAS AutoML](#modeling-with-python--sas-automl)
3838
- [Making direct REST API calls](#making-direct-rest-api-calls)
3939

40+
- [Register an Azure OpenAI GPT model using REST API calls](#register-an-azure-openai-gpt-model-using-rest-api-calls)
41+
4042
---
4143
Register binary classification models
4244
-------------------------------------
@@ -94,11 +96,11 @@ Generates a requirements.json file which includes the minimal number of dependen
9496

9597
Create and update custom model KPIs
9698
-----------------------------------
97-
Filename: [pzmm_custom_kpis.ipynb](pzmm_custom_kpis.ipynb)
99+
Filename: [pzmm_custom_kpis.ipynb](pzmm_custom_kpi_model_parameters.ipynb)
98100

99101
Level: Intermediate
100102

101-
Create and update custom model parameters and kpis on SAS Model Manager
103+
Create and update custom model parameters and kpis on SAS Model Manager.
102104

103105

104106
Register a SAS classification model
@@ -206,3 +208,11 @@ Level: Advanced
206208
Demonstrates using `sasctl` to make REST calls over HTTP(S) directly to the SAS microservices.
207209

208210
Use if you need to customize behavior or use functionality not yet exposed through higher-level `sasctl` functions.
211+
212+
Register an Azure OpenAI GPT Model Using REST API Calls
213+
--------------------------
214+
Filename: [register_Azure_OpenAI_model_using_REST_calls.ipynb](register_Azure_OpenAI_model_using_REST_calls.ipynb)
215+
216+
Level: Intermediate
217+
218+
Leverages a GPT-3.5-Turbo model from Azure OpenAI in SAS® Model Manager and SAS® Intelligent Decisioning.

examples/register_Azure_OpenAI_model_using_REST_calls.ipynb

Lines changed: 387 additions & 0 deletions
Large diffs are not rendered by default.

src/sasctl/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# Copyright © 2019, SAS Institute Inc., Cary, NC, USA. All Rights Reserved.
55
# SPDX-License-Identifier: Apache-2.0
66

7-
__version__ = "1.10.3"
7+
__version__ = "1.10.4"
88
__author__ = "SAS"
99
__credits__ = [
1010
"Yi Jian Ching",

src/sasctl/pzmm/write_json_files.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -355,17 +355,17 @@ def write_model_properties_json(
355355
)
356356

357357
if not target_values:
358-
model_function = model_function if model_function else "Prediction"
358+
model_function = model_function if model_function else "prediction"
359359
target_level = "Interval"
360360
target_event = ""
361361
event_prob_var = ""
362362
elif isinstance(target_values, list) and len(target_values) == 2:
363-
model_function = model_function if model_function else "Classification"
363+
model_function = model_function if model_function else "classification"
364364
target_level = "Binary"
365365
target_event = str(target_values[0])
366366
event_prob_var = f"P_{target_values[0]}"
367367
elif isinstance(target_values, list) and len(target_values) > 2:
368-
model_function = model_function if model_function else "Classification"
368+
model_function = model_function if model_function else "classification"
369369
target_level = "Nominal"
370370
target_event = ""
371371
event_prob_var = ""
@@ -2410,7 +2410,7 @@ def upload_training_data(
24102410
"either delete/rename the old table or give a new name to the current table."
24112411
)
24122412

2413-
return server + "/" + caslib + "/" + train_data_name
2413+
return server + "/" + caslib + "/" + train_data_name.upper()
24142414

24152415
@staticmethod
24162416
def generate_outcome_average(
@@ -2730,7 +2730,7 @@ def generate_variable_importance(
27302730
@classmethod
27312731
def generate_misc(cls, model_files: Union[str, Path, dict]):
27322732
"""
2733-
Generates the dmcas_relativeimportance.json file, which is used to determine variable importance
2733+
Generates the dmcas_misc.json file, which is used to determine variable importance
27342734
27352735
Parameters
27362736
----------

tests/conftest.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -633,12 +633,12 @@ def pytest_runtest_makereport(item, call):
633633
# The id of the test is deteremined by its parameterization. We just want to know if the test was
634634
# for Viya 3.5 or 2020.01, 2022.09, etc. Try to check the parameter assigned to known fixtures like
635635
# `session`. If that fails, we'll just use the id generated by pytest.
636-
if "session" in item.callspec.params:
637-
key = item.callspec.params["session"]
638-
elif "cas_session" in item.callspec.params:
639-
key = item.callspec.params["cas_session"]
640-
else:
641-
key = item.callspec.id
636+
# if "session" in item.callspec.params:
637+
# key = item.callspec.params["session"]
638+
# elif "cas_session" in item.callspec.params:
639+
# key = item.callspec.params["cas_session"]
640+
# else:
641+
key = item.callspec.id
642642

643643
# Track that this test was the last test to fail for this Viya version
644644
parent._previousfailed[key] = item

tests/unit/test_write_json_files.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,15 +262,15 @@ def test_write_model_properties_json():
262262
target_values=None,
263263
)
264264
assert "ModelProperties.json" in prop_dict
265-
assert json.loads(prop_dict["ModelProperties.json"])["function"] == "Prediction"
265+
assert json.loads(prop_dict["ModelProperties.json"])["function"] == "prediction"
266266
assert json.loads(prop_dict["ModelProperties.json"])["targetLevel"] == "Interval"
267267
assert json.loads(prop_dict["ModelProperties.json"])["targetEvent"] == ""
268268
assert json.loads(prop_dict["ModelProperties.json"])["eventProbVar"] == ""
269269

270270
prop_dict = jf.write_model_properties_json(
271271
model_name="Test_Model", target_variable="BAD", target_values=[1, 0]
272272
)
273-
assert json.loads(prop_dict["ModelProperties.json"])["function"] == "Classification"
273+
assert json.loads(prop_dict["ModelProperties.json"])["function"] == "classification"
274274
assert json.loads(prop_dict["ModelProperties.json"])["targetLevel"] == "Binary"
275275
assert json.loads(prop_dict["ModelProperties.json"])["targetEvent"] == "1"
276276
assert json.loads(prop_dict["ModelProperties.json"])["eventProbVar"] == "P_1"

tox.ini

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,14 @@
1212

1313

1414
[tox]
15-
envlist = py{36,37,38,39,310,311}-tests-{clean,unit,integration}
15+
envlist = py{38,39,310,311}-tests-{clean,unit,integration}
1616

1717
# Allow execution even if all Python versions are not present
1818
skip_missing_interpreters = {env:TOX_SKIP_MISSING_INTERPRETERS:True}
1919

2020
# Required by tox-gh-actions GH action. Maps GH Python runtime to tox envlist.
2121
[gh-actions]
2222
python =
23-
3.6: py36
24-
3.7: py37
2523
3.8: py38
2624
3.9: py39
2725
3.10: py310
@@ -32,8 +30,6 @@ skip_install =
3230
clean: true
3331

3432
basepython =
35-
py36: python3.6
36-
py37: python3.7
3733
py38: python3.8
3834
py39: python3.9
3935
py310: python3.10
@@ -45,12 +41,13 @@ deps =
4541
tests: pytest-cov
4642
tests: betamax >= 0.8.1
4743
tests: betamax_serializers >= 0.2.0
48-
tests: scikit-learn
44+
tests: scikit-learn < 1.5.0
4945
tests: pandas < 2.0.0
46+
tests: numpy < 2.0.0
5047
tests: cython # required to install pandas from source
5148
tests: swat >= 1.8
5249
tests: kerberos ; platform_system != "Windows" and platform_system != "Darwin"
53-
tests: xgboost == 0.82
50+
tests: xgboost == 1.7.3
5451
tests: urllib3 < 2.0.0
5552
tests: nbconvert
5653
tests: nbformat

0 commit comments

Comments
 (0)