shaped 1.0.1__tar.gz → 2.0.0__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.
- shaped-2.0.0/PKG-INFO +341 -0
- shaped-2.0.0/README.md +300 -0
- shaped-2.0.0/python/shaped/cli/shaped_cli.py +670 -0
- shaped-2.0.0/python/shaped.egg-info/PKG-INFO +341 -0
- {shaped-1.0.1 → shaped-2.0.0}/python/shaped.egg-info/requires.txt +4 -4
- {shaped-1.0.1 → shaped-2.0.0}/setup.py +6 -7
- shaped-1.0.1/PKG-INFO +0 -256
- shaped-1.0.1/README.md +0 -225
- shaped-1.0.1/python/shaped/cli/shaped_cli.py +0 -393
- shaped-1.0.1/python/shaped.egg-info/PKG-INFO +0 -256
- {shaped-1.0.1 → shaped-2.0.0}/pyproject.toml +0 -0
- {shaped-1.0.1 → shaped-2.0.0}/python/shaped/__init__.py +0 -0
- {shaped-1.0.1 → shaped-2.0.0}/python/shaped/autogen/__init__.py +0 -0
- {shaped-1.0.1 → shaped-2.0.0}/python/shaped/autogen/api/__init__.py +0 -0
- {shaped-1.0.1 → shaped-2.0.0}/python/shaped/autogen/api/dataset_api.py +0 -0
- {shaped-1.0.1 → shaped-2.0.0}/python/shaped/autogen/api/model_inference_api.py +0 -0
- {shaped-1.0.1 → shaped-2.0.0}/python/shaped/autogen/api/model_management_api.py +0 -0
- {shaped-1.0.1 → shaped-2.0.0}/python/shaped/autogen/api_client.py +0 -0
- {shaped-1.0.1 → shaped-2.0.0}/python/shaped/autogen/api_response.py +0 -0
- {shaped-1.0.1 → shaped-2.0.0}/python/shaped/autogen/configuration.py +0 -0
- {shaped-1.0.1 → shaped-2.0.0}/python/shaped/autogen/exceptions.py +0 -0
- {shaped-1.0.1 → shaped-2.0.0}/python/shaped/autogen/models/__init__.py +0 -0
- {shaped-1.0.1 → shaped-2.0.0}/python/shaped/autogen/models/amplitude_dataset_config.py +0 -0
- {shaped-1.0.1 → shaped-2.0.0}/python/shaped/autogen/models/aws_pinpoint_dataset_config.py +0 -0
- {shaped-1.0.1 → shaped-2.0.0}/python/shaped/autogen/models/big_query_dataset_config.py +0 -0
- {shaped-1.0.1 → shaped-2.0.0}/python/shaped/autogen/models/complement_items_request.py +0 -0
- {shaped-1.0.1 → shaped-2.0.0}/python/shaped/autogen/models/complement_items_response.py +0 -0
- {shaped-1.0.1 → shaped-2.0.0}/python/shaped/autogen/models/connectors_inner.py +0 -0
- {shaped-1.0.1 → shaped-2.0.0}/python/shaped/autogen/models/create_dataset_arguments.py +0 -0
- {shaped-1.0.1 → shaped-2.0.0}/python/shaped/autogen/models/create_embedding_response.py +0 -0
- {shaped-1.0.1 → shaped-2.0.0}/python/shaped/autogen/models/create_item_embedding_request.py +0 -0
- {shaped-1.0.1 → shaped-2.0.0}/python/shaped/autogen/models/create_model_arguments.py +0 -0
- {shaped-1.0.1 → shaped-2.0.0}/python/shaped/autogen/models/create_model_response.py +0 -0
- {shaped-1.0.1 → shaped-2.0.0}/python/shaped/autogen/models/create_user_embedding_request.py +0 -0
- {shaped-1.0.1 → shaped-2.0.0}/python/shaped/autogen/models/custom_dataset_config.py +0 -0
- {shaped-1.0.1 → shaped-2.0.0}/python/shaped/autogen/models/dataset_config.py +0 -0
- {shaped-1.0.1 → shaped-2.0.0}/python/shaped/autogen/models/dataset_schema_type.py +0 -0
- {shaped-1.0.1 → shaped-2.0.0}/python/shaped/autogen/models/datasets_inner.py +0 -0
- {shaped-1.0.1 → shaped-2.0.0}/python/shaped/autogen/models/delete_model_response.py +0 -0
- {shaped-1.0.1 → shaped-2.0.0}/python/shaped/autogen/models/fetch_config.py +0 -0
- {shaped-1.0.1 → shaped-2.0.0}/python/shaped/autogen/models/file_config.py +0 -0
- {shaped-1.0.1 → shaped-2.0.0}/python/shaped/autogen/models/file_source_config.py +0 -0
- {shaped-1.0.1 → shaped-2.0.0}/python/shaped/autogen/models/http_validation_error.py +0 -0
- {shaped-1.0.1 → shaped-2.0.0}/python/shaped/autogen/models/inference_config.py +0 -0
- {shaped-1.0.1 → shaped-2.0.0}/python/shaped/autogen/models/insert_model_response.py +0 -0
- {shaped-1.0.1 → shaped-2.0.0}/python/shaped/autogen/models/interaction.py +0 -0
- {shaped-1.0.1 → shaped-2.0.0}/python/shaped/autogen/models/list_datasets_response.py +0 -0
- {shaped-1.0.1 → shaped-2.0.0}/python/shaped/autogen/models/list_models_response.py +0 -0
- {shaped-1.0.1 → shaped-2.0.0}/python/shaped/autogen/models/model_config.py +0 -0
- {shaped-1.0.1 → shaped-2.0.0}/python/shaped/autogen/models/model_response.py +0 -0
- {shaped-1.0.1 → shaped-2.0.0}/python/shaped/autogen/models/mongo_db_dataset_config.py +0 -0
- {shaped-1.0.1 → shaped-2.0.0}/python/shaped/autogen/models/my_sql_dataset_config.py +0 -0
- {shaped-1.0.1 → shaped-2.0.0}/python/shaped/autogen/models/path.py +0 -0
- {shaped-1.0.1 → shaped-2.0.0}/python/shaped/autogen/models/post_rank_request.py +0 -0
- {shaped-1.0.1 → shaped-2.0.0}/python/shaped/autogen/models/postgres_dataset_config.py +0 -0
- {shaped-1.0.1 → shaped-2.0.0}/python/shaped/autogen/models/rank_attribute_response.py +0 -0
- {shaped-1.0.1 → shaped-2.0.0}/python/shaped/autogen/models/rank_grid_attribute_request.py +0 -0
- {shaped-1.0.1 → shaped-2.0.0}/python/shaped/autogen/models/rank_grid_attribute_request1.py +0 -0
- {shaped-1.0.1 → shaped-2.0.0}/python/shaped/autogen/models/rank_grid_attribute_response.py +0 -0
- {shaped-1.0.1 → shaped-2.0.0}/python/shaped/autogen/models/rank_response.py +0 -0
- {shaped-1.0.1 → shaped-2.0.0}/python/shaped/autogen/models/redshift_dataset_config.py +0 -0
- {shaped-1.0.1 → shaped-2.0.0}/python/shaped/autogen/models/retrieve_request.py +0 -0
- {shaped-1.0.1 → shaped-2.0.0}/python/shaped/autogen/models/retrieve_response.py +0 -0
- {shaped-1.0.1 → shaped-2.0.0}/python/shaped/autogen/models/retriever_top_k_override.py +0 -0
- {shaped-1.0.1 → shaped-2.0.0}/python/shaped/autogen/models/rudder_stack_dataset_config.py +0 -0
- {shaped-1.0.1 → shaped-2.0.0}/python/shaped/autogen/models/segment_dataset_config.py +0 -0
- {shaped-1.0.1 → shaped-2.0.0}/python/shaped/autogen/models/similar_item_request.py +0 -0
- {shaped-1.0.1 → shaped-2.0.0}/python/shaped/autogen/models/similar_response.py +0 -0
- {shaped-1.0.1 → shaped-2.0.0}/python/shaped/autogen/models/similar_users_request.py +0 -0
- {shaped-1.0.1 → shaped-2.0.0}/python/shaped/autogen/models/snowflake_dataset_config.py +0 -0
- {shaped-1.0.1 → shaped-2.0.0}/python/shaped/autogen/models/successful_response.py +0 -0
- {shaped-1.0.1 → shaped-2.0.0}/python/shaped/autogen/models/validation_error.py +0 -0
- {shaped-1.0.1 → shaped-2.0.0}/python/shaped/autogen/models/value_type.py +0 -0
- {shaped-1.0.1 → shaped-2.0.0}/python/shaped/autogen/models/view_model_response.py +0 -0
- {shaped-1.0.1 → shaped-2.0.0}/python/shaped/autogen/rest.py +0 -0
- {shaped-1.0.1 → shaped-2.0.0}/python/shaped/cli/__init__.py +0 -0
- {shaped-1.0.1 → shaped-2.0.0}/python/shaped/client.py +0 -0
- {shaped-1.0.1 → shaped-2.0.0}/python/shaped.egg-info/SOURCES.txt +0 -0
- {shaped-1.0.1 → shaped-2.0.0}/python/shaped.egg-info/dependency_links.txt +0 -0
- {shaped-1.0.1 → shaped-2.0.0}/python/shaped.egg-info/entry_points.txt +0 -0
- {shaped-1.0.1 → shaped-2.0.0}/python/shaped.egg-info/top_level.txt +0 -0
- {shaped-1.0.1 → shaped-2.0.0}/python/shaped.egg-info/zip-safe +0 -0
- {shaped-1.0.1 → shaped-2.0.0}/setup.cfg +0 -0
shaped-2.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,341 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: shaped
|
|
3
|
+
Version: 2.0.0
|
|
4
|
+
Summary: CLI and SDK tools for interacting with the Shaped API.
|
|
5
|
+
Home-page: https://github.com/shaped-ai/shaped-cli
|
|
6
|
+
Author: Shaped Team
|
|
7
|
+
Author-email: support@shaped.ai
|
|
8
|
+
Keywords: shaped-ai
|
|
9
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
10
|
+
Classifier: Operating System :: MacOS :: MacOS X
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Requires-Python: >=3.9, <3.14
|
|
15
|
+
Description-Content-Type: text/markdown
|
|
16
|
+
Requires-Dist: pyarrow==20.0.0
|
|
17
|
+
Requires-Dist: pandas==2.3.0
|
|
18
|
+
Requires-Dist: numpy==1.26.4
|
|
19
|
+
Requires-Dist: typer>=0.7.0
|
|
20
|
+
Requires-Dist: requests>=2.28.1
|
|
21
|
+
Requires-Dist: pydantic>=2.8.2
|
|
22
|
+
Requires-Dist: pyyaml>=6.0
|
|
23
|
+
Requires-Dist: tqdm==4.67.1
|
|
24
|
+
Requires-Dist: s3fs==0.4.2
|
|
25
|
+
Requires-Dist: fsspec==2023.5.0
|
|
26
|
+
Requires-Dist: urllib3<2.1.0,>=1.25.3
|
|
27
|
+
Requires-Dist: python-dateutil
|
|
28
|
+
Requires-Dist: typing-extensions>=4.7.1
|
|
29
|
+
Requires-Dist: pytest>=6.2.5
|
|
30
|
+
Requires-Dist: pytest-mock==3.14.0
|
|
31
|
+
Dynamic: author
|
|
32
|
+
Dynamic: author-email
|
|
33
|
+
Dynamic: classifier
|
|
34
|
+
Dynamic: description
|
|
35
|
+
Dynamic: description-content-type
|
|
36
|
+
Dynamic: home-page
|
|
37
|
+
Dynamic: keywords
|
|
38
|
+
Dynamic: requires-dist
|
|
39
|
+
Dynamic: requires-python
|
|
40
|
+
Dynamic: summary
|
|
41
|
+
|
|
42
|
+
# Shaped CLI
|
|
43
|
+
|
|
44
|
+
CLI for interactions with the Shaped API.
|
|
45
|
+
|
|
46
|
+
## Installing the Shaped CLI
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
pip install shaped
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Initialize
|
|
53
|
+
|
|
54
|
+
```
|
|
55
|
+
shaped init --api-key <API_KEY> [--env <ENV>]
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
The `--env` option defaults to `prod` and can be set to other environments like `dev` or `staging`.
|
|
59
|
+
|
|
60
|
+
## Engine API
|
|
61
|
+
|
|
62
|
+
### Create Engine
|
|
63
|
+
|
|
64
|
+
```
|
|
65
|
+
shaped create-engine --file <PATH_TO_FILE>
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Or pipe from stdin:
|
|
69
|
+
|
|
70
|
+
```
|
|
71
|
+
cat <PATH_TO_FILE> | shaped create-engine
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### Update Engine
|
|
75
|
+
|
|
76
|
+
```
|
|
77
|
+
shaped update-engine --file <PATH_TO_FILE>
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Or pipe from stdin:
|
|
81
|
+
|
|
82
|
+
```
|
|
83
|
+
cat <PATH_TO_FILE> | shaped update-engine
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### List Engines
|
|
87
|
+
|
|
88
|
+
```
|
|
89
|
+
shaped list-engines
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### View Engine
|
|
93
|
+
|
|
94
|
+
```
|
|
95
|
+
shaped view-engine --engine-name <ENGINE_NAME>
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Delete Engine
|
|
99
|
+
|
|
100
|
+
```
|
|
101
|
+
shaped delete-engine --engine-name <ENGINE_NAME>
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## Table API
|
|
105
|
+
|
|
106
|
+
### Create Table
|
|
107
|
+
|
|
108
|
+
```
|
|
109
|
+
shaped create-table --file <PATH_TO_FILE>
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Or pipe from stdin:
|
|
113
|
+
|
|
114
|
+
```
|
|
115
|
+
cat <PATH_TO_FILE> | shaped create-table
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### Create Table from URI
|
|
119
|
+
|
|
120
|
+
Create a table and automatically insert data from a file:
|
|
121
|
+
|
|
122
|
+
```
|
|
123
|
+
shaped create-table-from-uri --name <TABLE_NAME> --path <PATH_TO_FILE> --type <FILE_TYPE>
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
Supported file types: `parquet`, `csv`, `tsv`, `json`, `jsonl`
|
|
127
|
+
|
|
128
|
+
### List Tables
|
|
129
|
+
|
|
130
|
+
```
|
|
131
|
+
shaped list-tables
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### Table Insert
|
|
135
|
+
|
|
136
|
+
Insert data into an existing table:
|
|
137
|
+
|
|
138
|
+
```
|
|
139
|
+
shaped table-insert --table-name <TABLE_NAME> --file <DATAFRAME_FILE> --type <FILE_TYPE>
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
Supported file types: `parquet`, `csv`, `tsv`, `json`, `jsonl`
|
|
143
|
+
|
|
144
|
+
### View Table
|
|
145
|
+
|
|
146
|
+
```
|
|
147
|
+
shaped view-table --table-name <TABLE_NAME>
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### Update Table
|
|
151
|
+
|
|
152
|
+
```
|
|
153
|
+
shaped update-table --file <PATH_TO_FILE>
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
Or pipe from stdin:
|
|
157
|
+
|
|
158
|
+
```
|
|
159
|
+
cat <PATH_TO_FILE> | shaped update-table
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### Delete Table
|
|
163
|
+
|
|
164
|
+
```
|
|
165
|
+
shaped delete-table --table-name <TABLE_NAME>
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
## View API
|
|
169
|
+
|
|
170
|
+
### Create View
|
|
171
|
+
|
|
172
|
+
```
|
|
173
|
+
shaped create-view --file <PATH_TO_FILE>
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
Or pipe from stdin:
|
|
177
|
+
|
|
178
|
+
```
|
|
179
|
+
cat <PATH_TO_FILE> | shaped create-view
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
### List Views
|
|
183
|
+
|
|
184
|
+
```
|
|
185
|
+
shaped list-views
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
### View View
|
|
189
|
+
|
|
190
|
+
```
|
|
191
|
+
shaped view-view --view-name <VIEW_NAME>
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
### Update View
|
|
195
|
+
|
|
196
|
+
```
|
|
197
|
+
shaped update-view --file <PATH_TO_FILE>
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
Or pipe from stdin:
|
|
201
|
+
|
|
202
|
+
```
|
|
203
|
+
cat <PATH_TO_FILE> | shaped update-view
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
### Delete View
|
|
207
|
+
|
|
208
|
+
```
|
|
209
|
+
shaped delete-view --view-name <VIEW_NAME>
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
## Query API
|
|
213
|
+
|
|
214
|
+
### Execute Query
|
|
215
|
+
|
|
216
|
+
Execute an ad-hoc query against an engine. The query can be provided in three ways:
|
|
217
|
+
|
|
218
|
+
**From a file:**
|
|
219
|
+
```
|
|
220
|
+
shaped query --engine-name <ENGINE_NAME> --query-file <PATH_TO_FILE>
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
**As a JSON string:**
|
|
224
|
+
```
|
|
225
|
+
shaped query --engine-name <ENGINE_NAME> --query '{"sql": "SELECT * FROM table"}'
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
**From stdin:**
|
|
229
|
+
```
|
|
230
|
+
cat <PATH_TO_FILE> | shaped query --engine-name <ENGINE_NAME>
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
### Execute Saved Query
|
|
234
|
+
|
|
235
|
+
Execute a previously saved query by name:
|
|
236
|
+
|
|
237
|
+
```
|
|
238
|
+
shaped execute-saved-query --engine-name <ENGINE_NAME> --query-name <QUERY_NAME>
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
### List Saved Queries
|
|
242
|
+
|
|
243
|
+
List all saved queries for an engine:
|
|
244
|
+
|
|
245
|
+
```
|
|
246
|
+
shaped list-saved-queries --engine-name <ENGINE_NAME>
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
### View Saved Query
|
|
250
|
+
|
|
251
|
+
View the definition of a saved query:
|
|
252
|
+
|
|
253
|
+
```
|
|
254
|
+
shaped view-saved-query --engine-name <ENGINE_NAME> --query-name <QUERY_NAME>
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
---
|
|
258
|
+
|
|
259
|
+
# Python SDK
|
|
260
|
+
|
|
261
|
+
## Installation
|
|
262
|
+
|
|
263
|
+
### Pip Installation
|
|
264
|
+
|
|
265
|
+
```sh
|
|
266
|
+
pip install shaped
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
## Rank
|
|
270
|
+
|
|
271
|
+
```python
|
|
272
|
+
import shaped
|
|
273
|
+
|
|
274
|
+
api_key = 'your_api_key'
|
|
275
|
+
client = shaped.Client(api_key=api_key)
|
|
276
|
+
|
|
277
|
+
api_response = client.rank(
|
|
278
|
+
model_name="amazon_beauty_product_recommendations",
|
|
279
|
+
user_id="A2FRWMTWYJUK7P",
|
|
280
|
+
return_metadata=True,
|
|
281
|
+
item_ids=['B01AHSUT8M', 'B00GW7H5EY', 'B01GLA54SA', 'B0016PKWK6', 'B00PJD7KPG', 'B00BCI8OP2', 'B004FK7R02'],
|
|
282
|
+
)
|
|
283
|
+
print(api_response)
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
## Retrieve
|
|
287
|
+
```python
|
|
288
|
+
import shaped
|
|
289
|
+
|
|
290
|
+
api_key = 'your_api_key'
|
|
291
|
+
client = shaped.Client(api_key=api_key)
|
|
292
|
+
|
|
293
|
+
api_response = client.retrieve(
|
|
294
|
+
model_name="amazon_beauty_product_recommendations",
|
|
295
|
+
)
|
|
296
|
+
print(api_response)
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
## Similar Items
|
|
300
|
+
```python
|
|
301
|
+
import shaped
|
|
302
|
+
|
|
303
|
+
api_key = 'your_api_key'
|
|
304
|
+
client = shaped.Client(api_key=api_key)
|
|
305
|
+
|
|
306
|
+
api_response = client.similar_items(
|
|
307
|
+
model_name="amazon_beauty_product_recommendations",
|
|
308
|
+
item_id="B000FOI48G",
|
|
309
|
+
)
|
|
310
|
+
print(api_response)
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
## Similar Users
|
|
314
|
+
```python
|
|
315
|
+
import shaped
|
|
316
|
+
|
|
317
|
+
api_key = 'your_api_key'
|
|
318
|
+
client = shaped.Client(api_key=api_key)
|
|
319
|
+
|
|
320
|
+
api_response = client.similar_users(
|
|
321
|
+
model_name="amazon_beauty_product_recommendations",
|
|
322
|
+
user_id="A2FRWMTWYJUK7P",
|
|
323
|
+
)
|
|
324
|
+
print(api_response)
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
## Complement Items
|
|
328
|
+
```python
|
|
329
|
+
import shaped
|
|
330
|
+
|
|
331
|
+
api_key = 'your_api_key'
|
|
332
|
+
client = shaped.Client(api_key=api_key)
|
|
333
|
+
|
|
334
|
+
api_response = client.complement_items(
|
|
335
|
+
model_name="amazon_beauty_product_recommendations",
|
|
336
|
+
item_ids=['B000URXP6E', 'B0012Y0ZG2'],
|
|
337
|
+
)
|
|
338
|
+
print(api_response)
|
|
339
|
+
```
|
|
340
|
+
|
|
341
|
+
---
|
shaped-2.0.0/README.md
ADDED
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
# Shaped CLI
|
|
2
|
+
|
|
3
|
+
CLI for interactions with the Shaped API.
|
|
4
|
+
|
|
5
|
+
## Installing the Shaped CLI
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
pip install shaped
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Initialize
|
|
12
|
+
|
|
13
|
+
```
|
|
14
|
+
shaped init --api-key <API_KEY> [--env <ENV>]
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
The `--env` option defaults to `prod` and can be set to other environments like `dev` or `staging`.
|
|
18
|
+
|
|
19
|
+
## Engine API
|
|
20
|
+
|
|
21
|
+
### Create Engine
|
|
22
|
+
|
|
23
|
+
```
|
|
24
|
+
shaped create-engine --file <PATH_TO_FILE>
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Or pipe from stdin:
|
|
28
|
+
|
|
29
|
+
```
|
|
30
|
+
cat <PATH_TO_FILE> | shaped create-engine
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Update Engine
|
|
34
|
+
|
|
35
|
+
```
|
|
36
|
+
shaped update-engine --file <PATH_TO_FILE>
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Or pipe from stdin:
|
|
40
|
+
|
|
41
|
+
```
|
|
42
|
+
cat <PATH_TO_FILE> | shaped update-engine
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### List Engines
|
|
46
|
+
|
|
47
|
+
```
|
|
48
|
+
shaped list-engines
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### View Engine
|
|
52
|
+
|
|
53
|
+
```
|
|
54
|
+
shaped view-engine --engine-name <ENGINE_NAME>
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Delete Engine
|
|
58
|
+
|
|
59
|
+
```
|
|
60
|
+
shaped delete-engine --engine-name <ENGINE_NAME>
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Table API
|
|
64
|
+
|
|
65
|
+
### Create Table
|
|
66
|
+
|
|
67
|
+
```
|
|
68
|
+
shaped create-table --file <PATH_TO_FILE>
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Or pipe from stdin:
|
|
72
|
+
|
|
73
|
+
```
|
|
74
|
+
cat <PATH_TO_FILE> | shaped create-table
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### Create Table from URI
|
|
78
|
+
|
|
79
|
+
Create a table and automatically insert data from a file:
|
|
80
|
+
|
|
81
|
+
```
|
|
82
|
+
shaped create-table-from-uri --name <TABLE_NAME> --path <PATH_TO_FILE> --type <FILE_TYPE>
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Supported file types: `parquet`, `csv`, `tsv`, `json`, `jsonl`
|
|
86
|
+
|
|
87
|
+
### List Tables
|
|
88
|
+
|
|
89
|
+
```
|
|
90
|
+
shaped list-tables
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Table Insert
|
|
94
|
+
|
|
95
|
+
Insert data into an existing table:
|
|
96
|
+
|
|
97
|
+
```
|
|
98
|
+
shaped table-insert --table-name <TABLE_NAME> --file <DATAFRAME_FILE> --type <FILE_TYPE>
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Supported file types: `parquet`, `csv`, `tsv`, `json`, `jsonl`
|
|
102
|
+
|
|
103
|
+
### View Table
|
|
104
|
+
|
|
105
|
+
```
|
|
106
|
+
shaped view-table --table-name <TABLE_NAME>
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### Update Table
|
|
110
|
+
|
|
111
|
+
```
|
|
112
|
+
shaped update-table --file <PATH_TO_FILE>
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
Or pipe from stdin:
|
|
116
|
+
|
|
117
|
+
```
|
|
118
|
+
cat <PATH_TO_FILE> | shaped update-table
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### Delete Table
|
|
122
|
+
|
|
123
|
+
```
|
|
124
|
+
shaped delete-table --table-name <TABLE_NAME>
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
## View API
|
|
128
|
+
|
|
129
|
+
### Create View
|
|
130
|
+
|
|
131
|
+
```
|
|
132
|
+
shaped create-view --file <PATH_TO_FILE>
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
Or pipe from stdin:
|
|
136
|
+
|
|
137
|
+
```
|
|
138
|
+
cat <PATH_TO_FILE> | shaped create-view
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### List Views
|
|
142
|
+
|
|
143
|
+
```
|
|
144
|
+
shaped list-views
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### View View
|
|
148
|
+
|
|
149
|
+
```
|
|
150
|
+
shaped view-view --view-name <VIEW_NAME>
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### Update View
|
|
154
|
+
|
|
155
|
+
```
|
|
156
|
+
shaped update-view --file <PATH_TO_FILE>
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
Or pipe from stdin:
|
|
160
|
+
|
|
161
|
+
```
|
|
162
|
+
cat <PATH_TO_FILE> | shaped update-view
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### Delete View
|
|
166
|
+
|
|
167
|
+
```
|
|
168
|
+
shaped delete-view --view-name <VIEW_NAME>
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
## Query API
|
|
172
|
+
|
|
173
|
+
### Execute Query
|
|
174
|
+
|
|
175
|
+
Execute an ad-hoc query against an engine. The query can be provided in three ways:
|
|
176
|
+
|
|
177
|
+
**From a file:**
|
|
178
|
+
```
|
|
179
|
+
shaped query --engine-name <ENGINE_NAME> --query-file <PATH_TO_FILE>
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
**As a JSON string:**
|
|
183
|
+
```
|
|
184
|
+
shaped query --engine-name <ENGINE_NAME> --query '{"sql": "SELECT * FROM table"}'
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
**From stdin:**
|
|
188
|
+
```
|
|
189
|
+
cat <PATH_TO_FILE> | shaped query --engine-name <ENGINE_NAME>
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
### Execute Saved Query
|
|
193
|
+
|
|
194
|
+
Execute a previously saved query by name:
|
|
195
|
+
|
|
196
|
+
```
|
|
197
|
+
shaped execute-saved-query --engine-name <ENGINE_NAME> --query-name <QUERY_NAME>
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
### List Saved Queries
|
|
201
|
+
|
|
202
|
+
List all saved queries for an engine:
|
|
203
|
+
|
|
204
|
+
```
|
|
205
|
+
shaped list-saved-queries --engine-name <ENGINE_NAME>
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
### View Saved Query
|
|
209
|
+
|
|
210
|
+
View the definition of a saved query:
|
|
211
|
+
|
|
212
|
+
```
|
|
213
|
+
shaped view-saved-query --engine-name <ENGINE_NAME> --query-name <QUERY_NAME>
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
---
|
|
217
|
+
|
|
218
|
+
# Python SDK
|
|
219
|
+
|
|
220
|
+
## Installation
|
|
221
|
+
|
|
222
|
+
### Pip Installation
|
|
223
|
+
|
|
224
|
+
```sh
|
|
225
|
+
pip install shaped
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
## Rank
|
|
229
|
+
|
|
230
|
+
```python
|
|
231
|
+
import shaped
|
|
232
|
+
|
|
233
|
+
api_key = 'your_api_key'
|
|
234
|
+
client = shaped.Client(api_key=api_key)
|
|
235
|
+
|
|
236
|
+
api_response = client.rank(
|
|
237
|
+
model_name="amazon_beauty_product_recommendations",
|
|
238
|
+
user_id="A2FRWMTWYJUK7P",
|
|
239
|
+
return_metadata=True,
|
|
240
|
+
item_ids=['B01AHSUT8M', 'B00GW7H5EY', 'B01GLA54SA', 'B0016PKWK6', 'B00PJD7KPG', 'B00BCI8OP2', 'B004FK7R02'],
|
|
241
|
+
)
|
|
242
|
+
print(api_response)
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
## Retrieve
|
|
246
|
+
```python
|
|
247
|
+
import shaped
|
|
248
|
+
|
|
249
|
+
api_key = 'your_api_key'
|
|
250
|
+
client = shaped.Client(api_key=api_key)
|
|
251
|
+
|
|
252
|
+
api_response = client.retrieve(
|
|
253
|
+
model_name="amazon_beauty_product_recommendations",
|
|
254
|
+
)
|
|
255
|
+
print(api_response)
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
## Similar Items
|
|
259
|
+
```python
|
|
260
|
+
import shaped
|
|
261
|
+
|
|
262
|
+
api_key = 'your_api_key'
|
|
263
|
+
client = shaped.Client(api_key=api_key)
|
|
264
|
+
|
|
265
|
+
api_response = client.similar_items(
|
|
266
|
+
model_name="amazon_beauty_product_recommendations",
|
|
267
|
+
item_id="B000FOI48G",
|
|
268
|
+
)
|
|
269
|
+
print(api_response)
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
## Similar Users
|
|
273
|
+
```python
|
|
274
|
+
import shaped
|
|
275
|
+
|
|
276
|
+
api_key = 'your_api_key'
|
|
277
|
+
client = shaped.Client(api_key=api_key)
|
|
278
|
+
|
|
279
|
+
api_response = client.similar_users(
|
|
280
|
+
model_name="amazon_beauty_product_recommendations",
|
|
281
|
+
user_id="A2FRWMTWYJUK7P",
|
|
282
|
+
)
|
|
283
|
+
print(api_response)
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
## Complement Items
|
|
287
|
+
```python
|
|
288
|
+
import shaped
|
|
289
|
+
|
|
290
|
+
api_key = 'your_api_key'
|
|
291
|
+
client = shaped.Client(api_key=api_key)
|
|
292
|
+
|
|
293
|
+
api_response = client.complement_items(
|
|
294
|
+
model_name="amazon_beauty_product_recommendations",
|
|
295
|
+
item_ids=['B000URXP6E', 'B0012Y0ZG2'],
|
|
296
|
+
)
|
|
297
|
+
print(api_response)
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
---
|