Skip to content

Commit c4bd6cc

Browse files
authored
Publish 13.5.3 on PyPI (#326)
* Sync sources with main repository * Release metadata
1 parent 43780f6 commit c4bd6cc

File tree

11 files changed

+213
-33
lines changed

11 files changed

+213
-33
lines changed

HISTORY.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@ Changelog
22
==========
33

44

5+
13.5.3 (2025-05-15)
6+
---------------------
7+
8+
* Initial release for DSS 13.5.3
9+
510
13.5.2 (2025-05-12)
611
---------------------
712

dataikuapi/dss/admin.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -637,10 +637,10 @@ def get_client_as(self):
637637
if self.client.api_key is not None:
638638
return DSSClient(self.client.host, self.client.api_key, extra_headers={"X-DKU-ProxyUser": self.login}, no_check_certificate=not self.client._session.verify, client_certificate=self.client._session.cert)
639639
elif self.client.internal_ticket is not None:
640-
verify = self.client._session.verify
641-
no_check_certificate = verify if isinstance(verify, str) else not verify
642-
return DSSClient(self.client.host, internal_ticket = self.client.internal_ticket,
643-
extra_headers={"X-DKU-ProxyUser": self.login}, no_check_certificate=no_check_certificate, client_certificate=self.client._session.cert)
640+
client_as = DSSClient(self.client.host, internal_ticket = self.client.internal_ticket,
641+
extra_headers={"X-DKU-ProxyUser": self.login}, client_certificate=self.client._session.cert)
642+
client_as._session.verify = self.client._session.verify
643+
return client_as
644644
else:
645645
raise ValueError("Don't know how to proxy this client")
646646

dataikuapi/dss/knowledgebank.py

Lines changed: 105 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from .utils import DSSTaggableObjectListItem
1+
from .utils import DSSTaggableObjectListItem, DSSTaggableObjectSettings
22

33
class DSSKnowledgeBankListItem(DSSTaggableObjectListItem):
44
"""
@@ -64,7 +64,11 @@ class DSSKnowledgeBank(object):
6464
def __init__(self, client, project_key, id):
6565
self.client = client
6666
self.project_key = project_key
67-
self.id = id
67+
self._id = id
68+
69+
@property
70+
def id(self):
71+
return self._id
6872

6973
def as_core_knowledge_bank(self):
7074
"""
@@ -73,4 +77,102 @@ def as_core_knowledge_bank(self):
7377
:rtype: :class:`dataiku.KnowledgeBank`
7478
"""
7579
import dataiku
76-
return dataiku.KnowledgeBank("%s.%s" % (self.project_key, self.id))
80+
return dataiku.KnowledgeBank("%s.%s" % (self.project_key, self.id))
81+
82+
def get_settings(self):
83+
"""
84+
Get the knowledge bank's definition
85+
86+
:return: a handle on the knowledge bank definition
87+
:rtype: :class:`dataikuapi.dss.knowledgebank.DSSKnowledgeBankSettings`
88+
"""
89+
settings = self.client._perform_json(
90+
"GET", "/projects/%s/knowledge-banks/%s" % (self.project_key, self.id))
91+
return DSSKnowledgeBankSettings(self.client, settings)
92+
93+
def delete(self):
94+
"""
95+
Delete the knowledge bank
96+
"""
97+
return self.client._perform_empty("DELETE", "/projects/%s/knowledge-banks/%s" % (self.project_key, self.id))
98+
99+
def build(self, job_type="NON_RECURSIVE_FORCED_BUILD", wait=True):
100+
"""
101+
Start a new job to build this knowledge bank and wait for it to complete.
102+
Raises if the job failed.
103+
104+
.. code-block:: python
105+
106+
job = knowledge_bank.build()
107+
print("Job %s done" % job.id)
108+
109+
:param job_type: the job type. One of RECURSIVE_BUILD, NON_RECURSIVE_FORCED_BUILD or RECURSIVE_FORCED_BUILD
110+
:param bool wait: whether to wait for the job completion before returning the job handle, defaults to True
111+
:returns: the :class:`dataikuapi.dss.job.DSSJob` job handle corresponding to the built job
112+
:rtype: :class:`dataikuapi.dss.job.DSSJob`
113+
"""
114+
project = self.client.get_project(self.project_key)
115+
jd = project.new_job(job_type)
116+
jd.with_output(self._id, object_type="RETRIEVABLE_KNOWLEDGE")
117+
if wait:
118+
return jd.start_and_wait()
119+
else:
120+
return jd.start()
121+
122+
class DSSKnowledgeBankSettings(DSSTaggableObjectSettings):
123+
"""
124+
Settings for a knowledge bank
125+
126+
.. important::
127+
128+
Do not instantiate directly, use :meth:`dataikuapi.dss.knowledgebank.DSSKnowledgeBank.get_settings` instead
129+
130+
"""
131+
def __init__(self, client, settings):
132+
super(DSSKnowledgeBankSettings, self).__init__(settings)
133+
self._client = client
134+
self._settings = settings
135+
136+
@property
137+
def project_key(self):
138+
"""
139+
Returns the project key of the knowledge bank
140+
141+
:rtype: str
142+
"""
143+
return self._settings['projectKey']
144+
145+
@property
146+
def id(self):
147+
"""
148+
Returns the identifier of the knowledge bank
149+
150+
:rtype: str
151+
"""
152+
return self._settings['id']
153+
154+
@property
155+
def vector_store_type(self):
156+
"""
157+
Returns the type of storage backing the vector store (could be CHROMA, PINECONE, ELASTICSEARCH, AZURE_AI_SEARCH, VERTEX_AI_GCS_BASED, FAISS, QDRANT_LOCAL)
158+
159+
:rtype: str
160+
"""
161+
return self._settings['vectorStoreType']
162+
163+
def get_raw(self):
164+
"""
165+
Returns the raw settings of the knowledge bank
166+
167+
:return: the raw settings of the knowledge bank
168+
:rtype: dict
169+
"""
170+
return self._settings
171+
172+
def save(self):
173+
"""
174+
Saves the settings on the knowledge bank
175+
"""
176+
self._client._perform_json(
177+
"PUT", "/projects/%s/knowledge-banks/%s" % (self.project_key, self.id),
178+
body=self._settings)

dataikuapi/dss/langchain/embeddings.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@
1212
except ModuleNotFoundError:
1313
from langchain.embeddings.base import Embeddings
1414
from langchain_core.callbacks import BaseCallbackHandler, LLMManagerMixin
15-
from dataiku.llm.tracing import SpanBuilder
16-
from dataikuapi.dss.llm_tracing import new_trace
15+
from dataikuapi.dss.llm_tracing import new_trace, SpanBuilder
1716

1817
from dataikuapi.dss.langchain.utils import must_use_deprecated_pydantic_config
1918

dataikuapi/dss/project.py

Lines changed: 44 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -990,7 +990,7 @@ def list_saved_models(self):
990990
List the saved models in this project
991991
992992
:returns: the list of the saved models, each one as a python dict
993-
:rtype: list
993+
:rtype: list[DSSSavedModel]
994994
"""
995995
return self.client._perform_json(
996996
"GET", "/projects/%s/savedmodels/" % self.project_key)
@@ -1329,7 +1329,7 @@ def start_job(self, definition):
13291329
* the type of job (RECURSIVE_BUILD, NON_RECURSIVE_FORCED_BUILD, RECURSIVE_FORCED_BUILD,\
13301330
RECURSIVE_MISSING_ONLY_BUILD)
13311331
* a list of outputs to build from the available types: (DATASET, MANAGED_FOLDER, SAVED_MODEL,\
1332-
STREAMING_ENDPOINT)
1332+
STREAMING_ENDPOINT, KNOWLEDGE_BANK)
13331333
* (Optional) a refreshHiveMetastore field (True or False) to specify whether to re-synchronize the Hive\
13341334
metastore for recomputed HDFS datasets.
13351335
* (Optional) a autoUpdateSchemaBeforeEachRecipeRun field (True or False) to specify whether to auto update\
@@ -1350,7 +1350,7 @@ def start_job_and_wait(self, definition, no_fail=False):
13501350
* the type of job (RECURSIVE_BUILD, NON_RECURSIVE_FORCED_BUILD, RECURSIVE_FORCED_BUILD,\
13511351
RECURSIVE_MISSING_ONLY_BUILD)
13521352
* a list of outputs to build from the available types: (DATASET, MANAGED_FOLDER, SAVED_MODEL,\
1353-
STREAMING_ENDPOINT)
1353+
STREAMING_ENDPOINT, KNOWLEDGE_BANK)
13541354
* (Optional) a refreshHiveMetastore field (True or False) to specify whether to re-synchronize the Hive\
13551355
metastore for recomputed HDFS datasets.
13561356
* (Optional) a autoUpdateSchemaBeforeEachRecipeRun field (True or False) to specify whether to auto update\
@@ -1799,6 +1799,14 @@ def preload_bundle(self, bundle_id):
17991799
"/projects/%s/bundles/imported/%s/actions/preload" % (
18001800
self.project_key, bundle_id))
18011801

1802+
def delete_imported_bundle(self, bundle_id):
1803+
"""
1804+
Deletes a bundle that has been imported on the Automation node
1805+
1806+
:param str bundle_id: The identifier of the bundle
1807+
"""
1808+
return self.client._perform_json("DELETE", "/projects/%s/bundles/imported/%s" % (self.project_key, bundle_id))
1809+
18021810
########################################################
18031811
# Testing with DSS test scenarios report
18041812
########################################################
@@ -2392,7 +2400,7 @@ def list_knowledge_banks(self, as_type="listitems"):
23922400
:param str as_type: How to return the list. Supported values are "listitems" and "objects".
23932401
:returns: The list of knowledge banks. If "as_type" is "listitems", each one as a :class:`dataikuapi.dss.knowledgebank.DSSKnowledgeBankListItem`.
23942402
If "as_type" is "objects", each one as a :class:`dataikuapi.dss.knowledgebank.DSSKnowledgeBank`
2395-
:rtype: list
2403+
:rtype: list[DSSKnowledgeBank]
23962404
"""
23972405
kbs = self.client._perform_json("GET", "/projects/%s/knowledge-banks" % (self.project_key))
23982406
if as_type == "listitems":
@@ -2411,6 +2419,36 @@ def get_knowledge_bank(self, id):
24112419
"""
24122420
return DSSKnowledgeBank(self.client, self.project_key, id)
24132421

2422+
def create_knowledge_bank(self, name, vector_store_type, embedding_llm_id, settings=None):
2423+
"""
2424+
Create a new knowledge bank in the project, and return a handle to interact with it
2425+
2426+
:param str name: The name for the new knowledge bank. This does not need to be unique
2427+
2428+
:param str vector_store_type: The vector store type to use for this knowledge bank. Valid values are:
2429+
2430+
* CHROMA
2431+
* PINECONE
2432+
* ELASTICSEARCH
2433+
* AZURE_AI_SEARCH
2434+
* VERTEX_AI_GCS_BASED
2435+
* FAISS *(not recommended)*
2436+
* QDRANT_LOCAL *(not recommended)*
2437+
2438+
:param str embedding_llm_id: The id of the embedding LLM. It has to have the TEXT_EMBEDDING_EXTRACTION purpose.
2439+
2440+
:param Optional[dict] settings: Additional settings for the knowledge bank.
2441+
2442+
:returns: a :class:`dataikuapi.dss.knowledgebank.DSSKnowledgeBank` handle to interact with the newly-created knowledge bank
2443+
"""
2444+
if settings is None:
2445+
settings = {}
2446+
settings['name'] = name
2447+
settings['vectorStoreType'] = vector_store_type
2448+
settings['embeddingLLMId'] = embedding_llm_id
2449+
2450+
kb = self.client._perform_json("POST", "/projects/%s/knowledge-banks/" % self.project_key, body=settings)
2451+
return DSSKnowledgeBank(self.client, self.project_key, kb["id"])
24142452

24152453
########################################################
24162454
# Agent Tools
@@ -3206,7 +3244,8 @@ def with_output(self, name, object_type=None, object_project_key=None, partition
32063244
Adds an item to build in this job
32073245
32083246
:param name: name of the output object
3209-
:param object_type: type of object to build from: DATASET, MANAGED_FOLDER, SAVED_MODEL, STREAMING_ENDPOINT
3247+
:param object_type: type of object to build from: DATASET, MANAGED_FOLDER, SAVED_MODEL, STREAMING_ENDPOINT,\
3248+
KNOWLEDGE_BANK
32103249
(defaults to **None**)
32113250
:param object_project_key: PROJECT_KEY for the project that contains the object to build (defaults to **None**)
32123251
:param partition: specify partition to build (defaults to **None**)

dataikuapi/dss/recipe.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ def run(self, job_type="NON_RECURSIVE_FORCED_BUILD", partitions=None, wait=True,
140140
identifiers, and a partition identifier is a pipe-separated list of values for the partitioning
141141
dimensions
142142
:param boolean no_fail: if True, does not raise if the job failed
143-
:param boolean wait: if True, the method waits for the job complettion. If False, the method returns immediately
143+
:param boolean wait: if True, the method waits for the job completion. If False, the method returns immediately
144144
145145
:return: a job handle corresponding to the recipe run
146146
:rtype: :class:`dataikuapi.dss.job.DSSJob`
@@ -158,7 +158,8 @@ def run(self, job_type="NON_RECURSIVE_FORCED_BUILD", partitions=None, wait=True,
158158
"COMPUTABLE_FOLDER": "MANAGED_FOLDER",
159159
"COMPUTABLE_SAVED_MODEL": "SAVED_MODEL",
160160
"COMPUTABLE_STREAMING_ENDPOINT": "STREAMING_ENDPOINT",
161-
"COMPUTABLE_MODEL_EVALUATION_STORE": "MODEL_EVALUATION_STORE"
161+
"COMPUTABLE_MODEL_EVALUATION_STORE": "MODEL_EVALUATION_STORE",
162+
"COMPUTABLE_RETRIEVABLE_KNOWLEDGE": "RETRIEVABLE_KNOWLEDGE"
162163
}
163164
if first_output["type"] in object_type_map:
164165
jd = project.new_job(job_type)

dataikuapi/dssclient.py

Lines changed: 39 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def __init__(self, host, api_key=None, internal_ticket=None, extra_headers=None,
4747
api_key (str, optional): API key for authentication. Can be managed in DSS project page or global settings.
4848
internal_ticket (str, optional): Internal ticket for authentication.
4949
extra_headers (dict, optional): Additional HTTP headers to include in requests.
50-
no_check_certificate (bool or str, optional): If True, disables SSL certificate verification.
50+
no_check_certificate (bool, optional): If True, disables SSL certificate verification.
5151
Defaults to False.
5252
client_certificate (str or tuple, optional): Path to client certificate file or tuple of (cert, key) paths.
5353
**kwargs: Additional keyword arguments. Note: 'insecure_tls' is deprecated in favor of no_check_certificate.
@@ -66,8 +66,8 @@ def __init__(self, host, api_key=None, internal_ticket=None, extra_headers=None,
6666
self.internal_ticket = internal_ticket
6767
self.host = host
6868
self._session = Session()
69-
if no_check_certificate: # either True or a string in case of encrypted rpc
70-
self._session.verify = no_check_certificate if isinstance(no_check_certificate, str) else False
69+
if no_check_certificate:
70+
self._session.verify = False
7171
if client_certificate:
7272
self._session.cert = client_certificate
7373

@@ -527,21 +527,22 @@ def start_fetch_external_groups(self, user_source_type):
527527
future_resp = self._perform_json("GET", "/admin/external-groups", params={'userSourceType': user_source_type})
528528
return DSSFuture.from_resp(self, future_resp)
529529

530-
def start_fetch_external_users(self, user_source_type, login=None, group_name=None):
530+
def start_fetch_external_users(self, user_source_type, login=None, email=None, group_name=None):
531531
"""
532532
Fetch users from external source filtered by login or group name:
533-
- if login is provided, will search for a user with an exact match in the external source (e.g. before login remapping)
533+
- if login or email is provided, will search for a user with an exact match in the external source (e.g. before login remapping)
534534
- else,
535535
- if group_name is provided, will search for members of the group in the external source
536536
- else will search for all users
537537
538538
:param user_source_type: 'LDAP', 'AZURE_AD' or 'CUSTOM'
539539
:param login: optional - the login of the user in the external source
540+
:param email: optional - the email of the user in the external source
540541
:param group_name: optional - the group name of the group in the external source
541542
:rtype: :class:`dataikuapi.dss.future.DSSFuture`
542543
:return: a DSSFuture containing a list of ExternalUser
543544
"""
544-
future_resp = self._perform_json("GET", "/admin/external-users", params={'userSourceType': user_source_type, 'login': login, 'groupName': group_name})
545+
future_resp = self._perform_json("GET", "/admin/external-users", params={'userSourceType': user_source_type, 'login': login, 'email': email, 'groupName': group_name})
545546
return DSSFuture.from_resp(self, future_resp)
546547

547548
def start_provision_users(self, user_source_type, users):
@@ -710,6 +711,38 @@ def get_code_env(self, env_lang, env_name):
710711
"""
711712
return DSSCodeEnv(self, env_lang, env_name)
712713

714+
def create_internal_code_env(self, internal_env_type, python_interpreter=None, code_env_version=None):
715+
"""
716+
Create a Python internal code environment, and return a handle to interact with it.
717+
718+
Note: this call requires an API key with `Create code envs` or `Manage all code envs` permission
719+
720+
Example:
721+
722+
.. code-block:: python
723+
724+
env_handle = client.create_internal_code_env(internal_env_type="RAG_CODE_ENV", python_interpreter="PYTHON310")
725+
726+
:param str internal_env_type: the internal env type, can be `DEEP_HUB_IMAGE_CLASSIFICATION_CODE_ENV`, `DEEP_HUB_IMAGE_OBJECT_DETECTION_CODE_ENV`, `PROXY_MODELS_CODE_ENV`, `DATABRICKS_UTILS_CODE_ENV`, `PII_DETECTION_CODE_ENV`, `HUGGINGFACE_LOCAL_CODE_ENV` or `RAG_CODE_ENV`.
727+
:param str python_interpreter: Python interpreter version, can be `PYTHON39`, `PYTHON310`, `PYTHON311` or `PYTHON312`. If None, DSS will try to select a supported & available interpreter.
728+
:param str code_env_version: Version of the code env. Reserved for future use.
729+
:returns: A :class:`dataikuapi.dss.admin.DSSCodeEnv` code env handle
730+
"""
731+
request_params = {
732+
'dssInternalCodeEnvType': internal_env_type,
733+
'pythonInterpreter': python_interpreter,
734+
'codeEnvVersion': code_env_version,
735+
}
736+
737+
response = self._perform_json("POST", "/admin/code-envs/internal-env/create", params=request_params)
738+
739+
if response is None:
740+
raise Exception('Env creation returned no data')
741+
if response.get('messages', {}).get('error', False):
742+
raise Exception('Env creation failed : %s' % (json.dumps(response.get('messages', {}).get('messages', {}))))
743+
744+
return DSSCodeEnv(self, "python", response["envName"])
745+
713746
def create_code_env(self, env_lang, env_name, deployment_mode, params=None):
714747
"""
715748
Create a code env, and return a handle to interact with it

dataikuapi/fmclient.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def __init__(
8484
api_key_secret (str): The API key secret for authentication
8585
tenant_id (str, optional): The tenant ID. Defaults to "main"
8686
extra_headers (dict, optional): Additional HTTP headers to include in all requests
87-
no_check_certificate (bool or str, optional): If True, disables SSL certificate verification.
87+
no_check_certificate (bool, optional): If True, disables SSL certificate verification.
8888
Defaults to False.
8989
client_certificate (str or tuple, optional): Path to client certificate file or tuple of
9090
(cert, key) paths for client certificate authentication

dataikuapi/govern/admin.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,10 @@ def get_client_as(self):
5151
if self.client.api_key is not None:
5252
return GovernClient(self.client.host, self.client.api_key, extra_headers={"X-DKU-ProxyUser": self.login}, no_check_certificate=not self.client._session.verify, client_certificate=self.client._session.cert)
5353
elif self.client.internal_ticket is not None:
54-
verify = self.client._session.verify
55-
no_check_certificate = verify if isinstance(verify, str) else not verify
56-
return GovernClient(self.client.host, internal_ticket=self.client.internal_ticket,
57-
extra_headers={"X-DKU-ProxyUser": self.login}, no_check_certificate=no_check_certificate, client_certificate=self.client._session.cert)
54+
client_as = GovernClient(self.client.host, internal_ticket=self.client.internal_ticket,
55+
extra_headers={"X-DKU-ProxyUser": self.login}, client_certificate=self.client._session.cert)
56+
client_as._session.verify = self.client._session.verify
57+
return client_as
5858
else:
5959
raise ValueError("Don't know how to proxy this client")
6060

0 commit comments

Comments
 (0)