Metadata-Version: 2.4
Name: shaped
Version: 2.0.0
Summary: CLI and SDK tools for interacting with the Shaped API.
Home-page: https://github.com/shaped-ai/shaped-cli
Author: Shaped Team
Author-email: support@shaped.ai
Keywords: shaped-ai
Classifier: Operating System :: POSIX :: Linux
Classifier: Operating System :: MacOS :: MacOS X
Classifier: Programming Language :: Python :: 3
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Requires-Python: >=3.9, <3.14
Description-Content-Type: text/markdown
Requires-Dist: pyarrow==20.0.0
Requires-Dist: pandas==2.3.0
Requires-Dist: numpy==1.26.4
Requires-Dist: typer>=0.7.0
Requires-Dist: requests>=2.28.1
Requires-Dist: pydantic>=2.8.2
Requires-Dist: pyyaml>=6.0
Requires-Dist: tqdm==4.67.1
Requires-Dist: s3fs==0.4.2
Requires-Dist: fsspec==2023.5.0
Requires-Dist: urllib3<2.1.0,>=1.25.3
Requires-Dist: python-dateutil
Requires-Dist: typing-extensions>=4.7.1
Requires-Dist: pytest>=6.2.5
Requires-Dist: pytest-mock==3.14.0
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: keywords
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

# Shaped CLI

CLI for interactions with the Shaped API.

## Installing the Shaped CLI

```
pip install shaped
```

## Initialize

```
shaped init --api-key <API_KEY> [--env <ENV>]
```

The `--env` option defaults to `prod` and can be set to other environments like `dev` or `staging`.

## Engine API

### Create Engine

```
shaped create-engine --file <PATH_TO_FILE>
```

Or pipe from stdin:

```
cat <PATH_TO_FILE> | shaped create-engine
```

### Update Engine

```
shaped update-engine --file <PATH_TO_FILE>
```

Or pipe from stdin:

```
cat <PATH_TO_FILE> | shaped update-engine
```

### List Engines

```
shaped list-engines
```

### View Engine

```
shaped view-engine --engine-name <ENGINE_NAME>
```

### Delete Engine

```
shaped delete-engine --engine-name <ENGINE_NAME>
```

## Table API

### Create Table

```
shaped create-table --file <PATH_TO_FILE>
```

Or pipe from stdin:

```
cat <PATH_TO_FILE> | shaped create-table
```

### Create Table from URI

Create a table and automatically insert data from a file:

```
shaped create-table-from-uri --name <TABLE_NAME> --path <PATH_TO_FILE> --type <FILE_TYPE>
```

Supported file types: `parquet`, `csv`, `tsv`, `json`, `jsonl`

### List Tables

```
shaped list-tables
```

### Table Insert

Insert data into an existing table:

```
shaped table-insert --table-name <TABLE_NAME> --file <DATAFRAME_FILE> --type <FILE_TYPE>
```

Supported file types: `parquet`, `csv`, `tsv`, `json`, `jsonl`

### View Table

```
shaped view-table --table-name <TABLE_NAME>
```

### Update Table

```
shaped update-table --file <PATH_TO_FILE>
```

Or pipe from stdin:

```
cat <PATH_TO_FILE> | shaped update-table
```

### Delete Table

```
shaped delete-table --table-name <TABLE_NAME>
```

## View API

### Create View

```
shaped create-view --file <PATH_TO_FILE>
```

Or pipe from stdin:

```
cat <PATH_TO_FILE> | shaped create-view
```

### List Views

```
shaped list-views
```

### View View

```
shaped view-view --view-name <VIEW_NAME>
```

### Update View

```
shaped update-view --file <PATH_TO_FILE>
```

Or pipe from stdin:

```
cat <PATH_TO_FILE> | shaped update-view
```

### Delete View

```
shaped delete-view --view-name <VIEW_NAME>
```

## Query API

### Execute Query

Execute an ad-hoc query against an engine. The query can be provided in three ways:

**From a file:**
```
shaped query --engine-name <ENGINE_NAME> --query-file <PATH_TO_FILE>
```

**As a JSON string:**
```
shaped query --engine-name <ENGINE_NAME> --query '{"sql": "SELECT * FROM table"}'
```

**From stdin:**
```
cat <PATH_TO_FILE> | shaped query --engine-name <ENGINE_NAME>
```

### Execute Saved Query

Execute a previously saved query by name:

```
shaped execute-saved-query --engine-name <ENGINE_NAME> --query-name <QUERY_NAME>
```

### List Saved Queries

List all saved queries for an engine:

```
shaped list-saved-queries --engine-name <ENGINE_NAME>
```

### View Saved Query

View the definition of a saved query:

```
shaped view-saved-query --engine-name <ENGINE_NAME> --query-name <QUERY_NAME>
```

---

# Python SDK

## Installation

### Pip Installation

```sh
pip install shaped
```

## Rank

```python
import shaped

api_key = 'your_api_key' 
client = shaped.Client(api_key=api_key)

api_response = client.rank(
    model_name="amazon_beauty_product_recommendations",
    user_id="A2FRWMTWYJUK7P",
    return_metadata=True,
    item_ids=['B01AHSUT8M', 'B00GW7H5EY', 'B01GLA54SA', 'B0016PKWK6', 'B00PJD7KPG', 'B00BCI8OP2', 'B004FK7R02'],
)
print(api_response)
```

## Retrieve
```python
import shaped

api_key = 'your_api_key' 
client = shaped.Client(api_key=api_key)

api_response = client.retrieve(
    model_name="amazon_beauty_product_recommendations",
)
print(api_response)
```

## Similar Items
```python
import shaped

api_key = 'your_api_key' 
client = shaped.Client(api_key=api_key)

api_response = client.similar_items(
    model_name="amazon_beauty_product_recommendations", 
    item_id="B000FOI48G",
)
print(api_response)
```

## Similar Users
```python
import shaped

api_key = 'your_api_key' 
client = shaped.Client(api_key=api_key)

api_response = client.similar_users(
    model_name="amazon_beauty_product_recommendations", 
    user_id="A2FRWMTWYJUK7P",
)
print(api_response)
```

## Complement Items
```python
import shaped

api_key = 'your_api_key' 
client = shaped.Client(api_key=api_key)

api_response = client.complement_items(
    model_name="amazon_beauty_product_recommendations", 
    item_ids=['B000URXP6E', 'B0012Y0ZG2'],
)
print(api_response)
```

---
