kobai-sdk 0.2.8rc6__tar.gz → 0.2.8rc8__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of kobai-sdk might be problematic. Click here for more details.
- {kobai_sdk-0.2.8rc6 → kobai_sdk-0.2.8rc8}/PKG-INFO +1 -1
- {kobai_sdk-0.2.8rc6 → kobai_sdk-0.2.8rc8}/kobai/ai_rag.py +15 -25
- {kobai_sdk-0.2.8rc6 → kobai_sdk-0.2.8rc8}/kobai/tenant_client.py +9 -5
- {kobai_sdk-0.2.8rc6 → kobai_sdk-0.2.8rc8}/kobai_sdk.egg-info/PKG-INFO +1 -1
- {kobai_sdk-0.2.8rc6 → kobai_sdk-0.2.8rc8}/pyproject.toml +1 -1
- {kobai_sdk-0.2.8rc6 → kobai_sdk-0.2.8rc8}/LICENSE +0 -0
- {kobai_sdk-0.2.8rc6 → kobai_sdk-0.2.8rc8}/MANIFEST.in +0 -0
- {kobai_sdk-0.2.8rc6 → kobai_sdk-0.2.8rc8}/README.md +0 -0
- {kobai_sdk-0.2.8rc6 → kobai_sdk-0.2.8rc8}/kobai/__init__.py +0 -0
- {kobai_sdk-0.2.8rc6 → kobai_sdk-0.2.8rc8}/kobai/ai_query.py +0 -0
- {kobai_sdk-0.2.8rc6 → kobai_sdk-0.2.8rc8}/kobai/databricks_client.py +0 -0
- {kobai_sdk-0.2.8rc6 → kobai_sdk-0.2.8rc8}/kobai/demo_tenant_client.py +0 -0
- {kobai_sdk-0.2.8rc6 → kobai_sdk-0.2.8rc8}/kobai/spark_client.py +0 -0
- {kobai_sdk-0.2.8rc6 → kobai_sdk-0.2.8rc8}/kobai/tenant_api.py +0 -0
- {kobai_sdk-0.2.8rc6 → kobai_sdk-0.2.8rc8}/kobai_sdk.egg-info/SOURCES.txt +0 -0
- {kobai_sdk-0.2.8rc6 → kobai_sdk-0.2.8rc8}/kobai_sdk.egg-info/dependency_links.txt +0 -0
- {kobai_sdk-0.2.8rc6 → kobai_sdk-0.2.8rc8}/kobai_sdk.egg-info/requires.txt +0 -0
- {kobai_sdk-0.2.8rc6 → kobai_sdk-0.2.8rc8}/kobai_sdk.egg-info/top_level.txt +0 -0
- {kobai_sdk-0.2.8rc6 → kobai_sdk-0.2.8rc8}/setup.cfg +0 -0
|
@@ -25,28 +25,28 @@ class AIContext:
|
|
|
25
25
|
|
|
26
26
|
def ai_run_question_remote(tc: AIContext, question_id, dynamic_filters: dict = None):
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
"""
|
|
29
|
+
Returns JSON formatted result of Kobai question.
|
|
30
30
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
Parameters:
|
|
32
|
+
question_id (int): Numeric identifier of Kobai question.
|
|
33
|
+
"""
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
uri = '/data-svcs/api/query/' + str(question_id) + '/execute?' #'/data-svcs/api/query/4518/solution/9/execute/tabular?'
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
queryParams = {'jsontype': 'tableau'}
|
|
38
38
|
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
if bool(dynamic_filters):
|
|
40
|
+
queryParams.update(dynamic_filters)
|
|
41
41
|
|
|
42
|
-
|
|
42
|
+
uri += urllib.parse.urlencode(queryParams)
|
|
43
43
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
44
|
+
json={
|
|
45
|
+
'simulations': {'concepts': {}, 'data': None}
|
|
46
|
+
}
|
|
47
|
+
response = tc.api_client._TenantAPI__run_post(uri, json)
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
return response.json()
|
|
50
50
|
|
|
51
51
|
def generate_sentences(tc: AIContext, replica_schema=None, concept_white_list=None, use_questions=False):
|
|
52
52
|
"""
|
|
@@ -59,9 +59,6 @@ def generate_sentences(tc: AIContext, replica_schema=None, concept_white_list=No
|
|
|
59
59
|
use_questions (bool) OPTIONAL: Extract facts from published Kobai questions.
|
|
60
60
|
"""
|
|
61
61
|
|
|
62
|
-
#if tc.spark_client is None:
|
|
63
|
-
# return None
|
|
64
|
-
|
|
65
62
|
ss = tc.spark_session
|
|
66
63
|
|
|
67
64
|
print("Getting Tenant Config")
|
|
@@ -152,9 +149,6 @@ def encode_to_delta_local(tc: AIContext, st_model: SentenceTransformer, replica_
|
|
|
152
149
|
replica_schema (str) OPTIONAL: An alternate schema (catalog.database) to create the Delta table. Useful when the base Kobai schema is not on a Unity Catalog.
|
|
153
150
|
"""
|
|
154
151
|
|
|
155
|
-
#if tc.spark_client is None:
|
|
156
|
-
# return None
|
|
157
|
-
|
|
158
152
|
ss = tc.spark_session
|
|
159
153
|
|
|
160
154
|
schema = tc.schema
|
|
@@ -224,10 +218,6 @@ def rag_delta(tc: AIContext, emb_model: Union[SentenceTransformer, Embeddings],
|
|
|
224
218
|
if replica_schema is not None:
|
|
225
219
|
schema = replica_schema
|
|
226
220
|
|
|
227
|
-
#if tc.spark_client is None:
|
|
228
|
-
# print("Instantiate Spark Client First")
|
|
229
|
-
# return None
|
|
230
|
-
|
|
231
221
|
ss = tc.spark_session
|
|
232
222
|
|
|
233
223
|
if isinstance(emb_model, SentenceTransformer):
|
|
@@ -2,7 +2,6 @@ import base64
|
|
|
2
2
|
import json
|
|
3
3
|
import urllib
|
|
4
4
|
import urllib.parse
|
|
5
|
-
import requests
|
|
6
5
|
|
|
7
6
|
from azure.identity import DeviceCodeCredential
|
|
8
7
|
from pyspark.sql import SparkSession
|
|
@@ -65,7 +64,7 @@ class TenantClient:
|
|
|
65
64
|
# MS Entra Auth
|
|
66
65
|
########################################
|
|
67
66
|
|
|
68
|
-
def authenticate(self, client_id: str, tenant_id: str):
|
|
67
|
+
def authenticate(self, client_id: str, tenant_id: str, run_ai_init: bool = True, override_username: str = None):
|
|
69
68
|
|
|
70
69
|
"""
|
|
71
70
|
Authenticate the TenantClient with the Kobai instance. Returns nothing, but stores bearer token in client.
|
|
@@ -85,6 +84,9 @@ class TenantClient:
|
|
|
85
84
|
oauth_token = access.serialize()
|
|
86
85
|
user_name = json.loads(access.serialize())["username"]
|
|
87
86
|
|
|
87
|
+
if override_username is not None:
|
|
88
|
+
user_name = override_username
|
|
89
|
+
|
|
88
90
|
user_name_query_params={ 'userName' : user_name}
|
|
89
91
|
tenants_response = self.api_client._TenantAPI__run_get('/user-mgmt-svcs/auth/tenants?'+urllib.parse.urlencode(user_name_query_params))
|
|
90
92
|
|
|
@@ -110,11 +112,12 @@ class TenantClient:
|
|
|
110
112
|
|
|
111
113
|
self.__api_init_session()
|
|
112
114
|
self.__set_tenant_solutionid()
|
|
113
|
-
|
|
115
|
+
if run_ai_init:
|
|
116
|
+
self.init_ai_components()
|
|
114
117
|
|
|
115
118
|
print("Authentication Successful.")
|
|
116
119
|
|
|
117
|
-
def authenticate_browser_token(self, access_token):
|
|
120
|
+
def authenticate_browser_token(self, access_token, run_ai_init: bool = True):
|
|
118
121
|
|
|
119
122
|
"""
|
|
120
123
|
Authenticate the TenantClient with the Kobai instance. Returns nothing, but stores bearer token in client.
|
|
@@ -128,7 +131,8 @@ class TenantClient:
|
|
|
128
131
|
|
|
129
132
|
self.__api_init_session()
|
|
130
133
|
self.__set_tenant_solutionid()
|
|
131
|
-
|
|
134
|
+
if run_ai_init:
|
|
135
|
+
self.init_ai_components()
|
|
132
136
|
|
|
133
137
|
|
|
134
138
|
print("Authentication Successful.")
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "kobai-sdk"
|
|
7
|
-
version = "0.2.
|
|
7
|
+
version = "0.2.8rc8"
|
|
8
8
|
description = "A package that enables interaction with a Kobai tenant."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
authors = [{ name = "Ryan Oattes", email = "ryan@kobai.io" }]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|