kobai-sdk 0.2.8rc6__tar.gz → 0.2.8rc7__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.8rc7}/PKG-INFO +1 -1
- {kobai_sdk-0.2.8rc6 → kobai_sdk-0.2.8rc7}/kobai/ai_rag.py +15 -25
- {kobai_sdk-0.2.8rc6 → kobai_sdk-0.2.8rc7}/kobai/tenant_client.py +6 -5
- {kobai_sdk-0.2.8rc6 → kobai_sdk-0.2.8rc7}/kobai_sdk.egg-info/PKG-INFO +1 -1
- {kobai_sdk-0.2.8rc6 → kobai_sdk-0.2.8rc7}/pyproject.toml +1 -1
- {kobai_sdk-0.2.8rc6 → kobai_sdk-0.2.8rc7}/LICENSE +0 -0
- {kobai_sdk-0.2.8rc6 → kobai_sdk-0.2.8rc7}/MANIFEST.in +0 -0
- {kobai_sdk-0.2.8rc6 → kobai_sdk-0.2.8rc7}/README.md +0 -0
- {kobai_sdk-0.2.8rc6 → kobai_sdk-0.2.8rc7}/kobai/__init__.py +0 -0
- {kobai_sdk-0.2.8rc6 → kobai_sdk-0.2.8rc7}/kobai/ai_query.py +0 -0
- {kobai_sdk-0.2.8rc6 → kobai_sdk-0.2.8rc7}/kobai/databricks_client.py +0 -0
- {kobai_sdk-0.2.8rc6 → kobai_sdk-0.2.8rc7}/kobai/demo_tenant_client.py +0 -0
- {kobai_sdk-0.2.8rc6 → kobai_sdk-0.2.8rc7}/kobai/spark_client.py +0 -0
- {kobai_sdk-0.2.8rc6 → kobai_sdk-0.2.8rc7}/kobai/tenant_api.py +0 -0
- {kobai_sdk-0.2.8rc6 → kobai_sdk-0.2.8rc7}/kobai_sdk.egg-info/SOURCES.txt +0 -0
- {kobai_sdk-0.2.8rc6 → kobai_sdk-0.2.8rc7}/kobai_sdk.egg-info/dependency_links.txt +0 -0
- {kobai_sdk-0.2.8rc6 → kobai_sdk-0.2.8rc7}/kobai_sdk.egg-info/requires.txt +0 -0
- {kobai_sdk-0.2.8rc6 → kobai_sdk-0.2.8rc7}/kobai_sdk.egg-info/top_level.txt +0 -0
- {kobai_sdk-0.2.8rc6 → kobai_sdk-0.2.8rc7}/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):
|
|
69
68
|
|
|
70
69
|
"""
|
|
71
70
|
Authenticate the TenantClient with the Kobai instance. Returns nothing, but stores bearer token in client.
|
|
@@ -110,11 +109,12 @@ class TenantClient:
|
|
|
110
109
|
|
|
111
110
|
self.__api_init_session()
|
|
112
111
|
self.__set_tenant_solutionid()
|
|
113
|
-
|
|
112
|
+
if run_ai_init:
|
|
113
|
+
self.init_ai_components()
|
|
114
114
|
|
|
115
115
|
print("Authentication Successful.")
|
|
116
116
|
|
|
117
|
-
def authenticate_browser_token(self, access_token):
|
|
117
|
+
def authenticate_browser_token(self, access_token, run_ai_init: bool = True):
|
|
118
118
|
|
|
119
119
|
"""
|
|
120
120
|
Authenticate the TenantClient with the Kobai instance. Returns nothing, but stores bearer token in client.
|
|
@@ -128,7 +128,8 @@ class TenantClient:
|
|
|
128
128
|
|
|
129
129
|
self.__api_init_session()
|
|
130
130
|
self.__set_tenant_solutionid()
|
|
131
|
-
|
|
131
|
+
if run_ai_init:
|
|
132
|
+
self.init_ai_components()
|
|
132
133
|
|
|
133
134
|
|
|
134
135
|
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.8rc7"
|
|
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
|