kobai-sdk 0.3.3rc1__py3-none-any.whl → 0.3.4__py3-none-any.whl
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/ai_rag.py +1 -1
- kobai/genie.py +0 -32
- kobai/tenant_client.py +2 -7
- {kobai_sdk-0.3.3rc1.dist-info → kobai_sdk-0.3.4.dist-info}/METADATA +3 -3
- kobai_sdk-0.3.4.dist-info/RECORD +15 -0
- kobai_sdk-0.3.3rc1.dist-info/RECORD +0 -15
- {kobai_sdk-0.3.3rc1.dist-info → kobai_sdk-0.3.4.dist-info}/WHEEL +0 -0
- {kobai_sdk-0.3.3rc1.dist-info → kobai_sdk-0.3.4.dist-info}/licenses/LICENSE +0 -0
- {kobai_sdk-0.3.3rc1.dist-info → kobai_sdk-0.3.4.dist-info}/top_level.txt +0 -0
kobai/ai_rag.py
CHANGED
|
@@ -7,7 +7,7 @@ from delta import DeltaTable
|
|
|
7
7
|
from langchain_core.language_models.chat_models import BaseChatModel
|
|
8
8
|
from langchain_core.embeddings import Embeddings
|
|
9
9
|
from langchain_community.document_loaders import PySparkDataFrameLoader
|
|
10
|
-
from
|
|
10
|
+
from langchain_classic import hub
|
|
11
11
|
from langchain_core.output_parsers import StrOutputParser
|
|
12
12
|
|
|
13
13
|
import urllib
|
kobai/genie.py
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import json
|
|
2
1
|
|
|
3
2
|
def get_genie_descriptions(solution_id, structure, schema):
|
|
4
3
|
for di, dom in enumerate(structure["domains"]):
|
|
@@ -82,7 +81,6 @@ def recurse_parent_props(uri, structure, props, rels, visited=None):
|
|
|
82
81
|
recurse_parent_props(icon, structure, props, rels, visited)
|
|
83
82
|
|
|
84
83
|
def add_map_count(structure):
|
|
85
|
-
#mapping_defs = get_tenant_mapping_config(structure["solution_id"])
|
|
86
84
|
|
|
87
85
|
for dom in structure["domains"]:
|
|
88
86
|
for con in dom["concepts"]:
|
|
@@ -93,41 +91,11 @@ def add_map_count(structure):
|
|
|
93
91
|
map_count = map_count + 1
|
|
94
92
|
con["map_count"] = map_count
|
|
95
93
|
|
|
96
|
-
#def get_tenant_mapping_config(solution_id):
|
|
97
|
-
# mapping_sql = f"""
|
|
98
|
-
# select s.id, mapd.concept_type_uri
|
|
99
|
-
# from studio.solutions s
|
|
100
|
-
# inner join studio.mapping_defs mapd
|
|
101
|
-
# on s.id = mapd.solution_id
|
|
102
|
-
# where s.id = {solution_id}
|
|
103
|
-
# """
|
|
104
|
-
|
|
105
|
-
# mapping_rows = app_db.run_query(mapping_sql)
|
|
106
|
-
|
|
107
|
-
# mapping_defs = []
|
|
108
|
-
# for row in mapping_rows:
|
|
109
|
-
# mapping_def = {"solution_id": row[0], "concept_type_uri": row[1]}
|
|
110
|
-
# mapping_defs.append(mapping_def)
|
|
111
|
-
# return mapping_defs
|
|
112
|
-
|
|
113
94
|
############################
|
|
114
95
|
# Question Config
|
|
115
96
|
############################
|
|
116
97
|
|
|
117
98
|
def get_tenant_question_config(solution_id, structure):
|
|
118
|
-
#question_sql = f"""
|
|
119
|
-
# select s.id solution_id, q.id, q.description, q.definition, a.id api_id
|
|
120
|
-
# from studio.models m
|
|
121
|
-
# inner join studio.queries q
|
|
122
|
-
# on m.id = q.model_id
|
|
123
|
-
# inner join studio.solutions s
|
|
124
|
-
# on m.id = s.model_id
|
|
125
|
-
# left join studio.api a
|
|
126
|
-
# on q.id = a.query_id
|
|
127
|
-
# where s.id = {solution_id}
|
|
128
|
-
#"""
|
|
129
|
-
|
|
130
|
-
#question_rows = app_db.run_query(question_sql)
|
|
131
99
|
|
|
132
100
|
question_defs = []
|
|
133
101
|
for row in structure["queries"]:
|
kobai/tenant_client.py
CHANGED
|
@@ -5,8 +5,6 @@ import urllib.parse
|
|
|
5
5
|
|
|
6
6
|
from pyspark.sql import SparkSession
|
|
7
7
|
|
|
8
|
-
from langchain_community.chat_models import ChatDatabricks
|
|
9
|
-
from databricks_langchain import DatabricksEmbeddings
|
|
10
8
|
from langchain_core.language_models.chat_models import BaseChatModel
|
|
11
9
|
from langchain_core.embeddings import Embeddings
|
|
12
10
|
|
|
@@ -281,9 +279,10 @@ class TenantClient:
|
|
|
281
279
|
|
|
282
280
|
for t in self.__get_view_sql(domains=domains, concepts=concepts, not_concepts=not_concepts, enforce_map=enforce_map):
|
|
283
281
|
payload["table_identifiers"].append(t["table"])
|
|
282
|
+
print(t["table"])
|
|
284
283
|
response = self.databricks_client._DatabricksClient__api_patch("/api/2.0/data-rooms/" + room_id, payload)
|
|
285
284
|
|
|
286
|
-
payload = {"title":"Notes","content":"When filtering for a named entity, use a like comparison instead of equality. All tables are denormalized, so columns may have repeated rows for the same primary identifier. You should handle this by putting each table in a subquery and using the DISTINCT keyword.","instruction_type":"TEXT_INSTRUCTION"}
|
|
285
|
+
payload = {"title":"Notes","content":"When filtering for a named entity, use a like comparison instead of equality. All tables are denormalized, so columns may have repeated rows for the same primary identifier. You should handle this by putting each table in a subquery and using the DISTINCT keyword. The first column in each view is a unique identifier that should only be used for joins, and never shown to a user. Find another column to identify the subject of the table.","instruction_type":"TEXT_INSTRUCTION"}
|
|
287
286
|
instructions = self.databricks_client._DatabricksClient__api_get("/api/2.0/data-rooms/" + room_id + "/instructions")
|
|
288
287
|
inst_id = "-1"
|
|
289
288
|
|
|
@@ -325,10 +324,6 @@ class TenantClient:
|
|
|
325
324
|
########################################
|
|
326
325
|
|
|
327
326
|
def __get_descriptions(self):
|
|
328
|
-
|
|
329
|
-
#params={"schema": self.schema, "tenant_id": self.model_id}
|
|
330
|
-
#response = self.api_client._TenantAPI__run_get("/episteme-svcs/api/descriptions", params=params)
|
|
331
|
-
#return response.json()
|
|
332
327
|
|
|
333
328
|
tenant_config = self.get_tenant_config()
|
|
334
329
|
descriptions = get_genie_descriptions(self.model_id, tenant_config, self.schema)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: kobai-sdk
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.4
|
|
4
4
|
Summary: A package that enables interaction with a Kobai tenant.
|
|
5
5
|
Author-email: Ryan Oattes <ryan@kobai.io>
|
|
6
6
|
License: Apache License
|
|
@@ -221,8 +221,8 @@ Requires-Dist: azure-identity
|
|
|
221
221
|
Requires-Dist: azure-storage-blob
|
|
222
222
|
Requires-Dist: langchain-core
|
|
223
223
|
Requires-Dist: langchain-community
|
|
224
|
-
Requires-Dist:
|
|
225
|
-
Requires-Dist:
|
|
224
|
+
Requires-Dist: langchain-classic
|
|
225
|
+
Requires-Dist: delta-spark
|
|
226
226
|
Provides-Extra: dev
|
|
227
227
|
Requires-Dist: black; extra == "dev"
|
|
228
228
|
Requires-Dist: bumpver; extra == "dev"
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
kobai/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
+
kobai/ai_query.py,sha256=FnXn2pabJpXfTUcJvieVkAgMAjSTH9u5SFR9SJUJ-Lk,9556
|
|
3
|
+
kobai/ai_rag.py,sha256=ZBUlpjbQC73yTXNV91uG_Tw-PvtWR5bSAg2NlwJQZwM,14635
|
|
4
|
+
kobai/databricks_client.py,sha256=fyqqMly2Qm0r1AHWsQjkYeNsDdH0G1JSgTkF9KJ55qA,2118
|
|
5
|
+
kobai/demo_tenant_client.py,sha256=wlNc-bdI2wotRXo8ppUOalv4hYdBlek_WzJNARZV-AE,9293
|
|
6
|
+
kobai/genie.py,sha256=-EbEYpu9xj_3zIXaPdwbNJEAmoeM7nb9qK-h1f_STtM,8061
|
|
7
|
+
kobai/ms_authenticate.py,sha256=rlmhtvAaSRBlYmvIBy5epMVa4MBGBLPaMwawu1T_xDQ,2252
|
|
8
|
+
kobai/spark_client.py,sha256=opM_F-4Ut5Hq5zZjWMuLvUps9sDULvyPNZHXGL8dW1k,776
|
|
9
|
+
kobai/tenant_api.py,sha256=Q5yuFd9_V4lo3LWzvYEEO3LpDRWFgQD4TlRPXDTGbiE,4368
|
|
10
|
+
kobai/tenant_client.py,sha256=xozM69_e4Z8mD20JpPuVWVU5oOsRVazEjFRbcwV7p6s,38899
|
|
11
|
+
kobai_sdk-0.3.4.dist-info/licenses/LICENSE,sha256=QwcOLU5TJoTeUhuIXzhdCEEDDvorGiC6-3YTOl4TecE,11356
|
|
12
|
+
kobai_sdk-0.3.4.dist-info/METADATA,sha256=3HL7I8WqGfUJE26ZbK6XkUyJ3R93TOc38Kxj-kyOCgM,19861
|
|
13
|
+
kobai_sdk-0.3.4.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
14
|
+
kobai_sdk-0.3.4.dist-info/top_level.txt,sha256=ns1El3BrTTHKvoAgU1XtiSaVIudYeCXbEEUVY8HFDZ4,6
|
|
15
|
+
kobai_sdk-0.3.4.dist-info/RECORD,,
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
kobai/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
kobai/ai_query.py,sha256=FnXn2pabJpXfTUcJvieVkAgMAjSTH9u5SFR9SJUJ-Lk,9556
|
|
3
|
-
kobai/ai_rag.py,sha256=XUq_SnJw17P53Zk75hHJgTryGjHEAyYPwC0r2WtuNp4,14627
|
|
4
|
-
kobai/databricks_client.py,sha256=fyqqMly2Qm0r1AHWsQjkYeNsDdH0G1JSgTkF9KJ55qA,2118
|
|
5
|
-
kobai/demo_tenant_client.py,sha256=wlNc-bdI2wotRXo8ppUOalv4hYdBlek_WzJNARZV-AE,9293
|
|
6
|
-
kobai/genie.py,sha256=L78QQPnAYHk3SRXPdmrGpkG52jwCO2aG4r0esWdt3Ng,9102
|
|
7
|
-
kobai/ms_authenticate.py,sha256=rlmhtvAaSRBlYmvIBy5epMVa4MBGBLPaMwawu1T_xDQ,2252
|
|
8
|
-
kobai/spark_client.py,sha256=opM_F-4Ut5Hq5zZjWMuLvUps9sDULvyPNZHXGL8dW1k,776
|
|
9
|
-
kobai/tenant_api.py,sha256=Q5yuFd9_V4lo3LWzvYEEO3LpDRWFgQD4TlRPXDTGbiE,4368
|
|
10
|
-
kobai/tenant_client.py,sha256=Feu8786FFAUhIenLxBWRqWWrrdENzf0t35an95M1nSA,39023
|
|
11
|
-
kobai_sdk-0.3.3rc1.dist-info/licenses/LICENSE,sha256=QwcOLU5TJoTeUhuIXzhdCEEDDvorGiC6-3YTOl4TecE,11356
|
|
12
|
-
kobai_sdk-0.3.3rc1.dist-info/METADATA,sha256=KC2TQJd94mdxebpMTs8Jq-XrJaHQvBJxTYiJ4wQRAIQ,19872
|
|
13
|
-
kobai_sdk-0.3.3rc1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
14
|
-
kobai_sdk-0.3.3rc1.dist-info/top_level.txt,sha256=ns1El3BrTTHKvoAgU1XtiSaVIudYeCXbEEUVY8HFDZ4,6
|
|
15
|
-
kobai_sdk-0.3.3rc1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|