outerproduct 0.2.3__tar.gz → 0.2.4__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.
- {outerproduct-0.2.3 → outerproduct-0.2.4}/PKG-INFO +27 -1
- {outerproduct-0.2.3 → outerproduct-0.2.4}/README.md +26 -0
- {outerproduct-0.2.3 → outerproduct-0.2.4}/pyproject.toml +1 -1
- {outerproduct-0.2.3 → outerproduct-0.2.4}/src/outerproduct/__init__.py +78 -3
- {outerproduct-0.2.3 → outerproduct-0.2.4}/src/outerproduct/agentic/documents.py +4 -4
- {outerproduct-0.2.3 → outerproduct-0.2.4}/src/outerproduct/client/apis.py +13 -61
- {outerproduct-0.2.3 → outerproduct-0.2.4}/src/outerproduct/client/client.py +4 -4
- {outerproduct-0.2.3 → outerproduct-0.2.4}/src/outerproduct/client/endpoints.py +23 -42
- outerproduct-0.2.4/src/outerproduct/connector.py +543 -0
- {outerproduct-0.2.3 → outerproduct-0.2.4}/src/outerproduct/dataset.py +122 -158
- {outerproduct-0.2.3 → outerproduct-0.2.4}/src/outerproduct/job.py +7 -1
- {outerproduct-0.2.3 → outerproduct-0.2.4}/src/outerproduct/model.py +17 -0
- {outerproduct-0.2.3 → outerproduct-0.2.4}/src/outerproduct/reasoning/__init__.py +14 -8
- {outerproduct-0.2.3 → outerproduct-0.2.4}/src/outerproduct/reasoning/pattern_tracker.py +30 -2
- {outerproduct-0.2.3 → outerproduct-0.2.4}/src/outerproduct/trainer.py +10 -4
- {outerproduct-0.2.3 → outerproduct-0.2.4}/src/outerproduct/utils.py +21 -2
- outerproduct-0.2.3/src/outerproduct/connector.py +0 -745
- {outerproduct-0.2.3 → outerproduct-0.2.4}/.gitignore +0 -0
- {outerproduct-0.2.3 → outerproduct-0.2.4}/LICENSE +0 -0
- {outerproduct-0.2.3 → outerproduct-0.2.4}/src/outerproduct/agentic/__init__.py +0 -0
- {outerproduct-0.2.3 → outerproduct-0.2.4}/src/outerproduct/client/__init__.py +0 -0
- {outerproduct-0.2.3 → outerproduct-0.2.4}/src/outerproduct/client/_http.py +0 -0
- {outerproduct-0.2.3 → outerproduct-0.2.4}/src/outerproduct/client/exceptions.py +0 -0
- {outerproduct-0.2.3 → outerproduct-0.2.4}/src/outerproduct/py.typed +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: outerproduct
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.4
|
|
4
4
|
Summary: Python SDK for the OuterProduct API
|
|
5
5
|
Project-URL: Documentation, https://docs.outerproduct.com
|
|
6
6
|
Project-URL: Homepage, https://outerproduct.com
|
|
@@ -80,6 +80,32 @@ df = pd.read_csv("credit.csv")
|
|
|
80
80
|
dataset = op.Dataset.from_pandas(df, label_column="default")
|
|
81
81
|
```
|
|
82
82
|
|
|
83
|
+
### Tabularize Documents into a Dataset
|
|
84
|
+
|
|
85
|
+
```python
|
|
86
|
+
from outerproduct.agentic import documents
|
|
87
|
+
|
|
88
|
+
docs = documents.DocumentSet.from_directory("./invoices")
|
|
89
|
+
refs = documents.upload(docs)
|
|
90
|
+
schema = documents.induce_schema(refs, use_case="fraud audit", skill="invoice")
|
|
91
|
+
dataset = documents.tabularize(refs, schema, label_column="is_fraud")
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
You can also hand-author the schema:
|
|
95
|
+
|
|
96
|
+
```python
|
|
97
|
+
from outerproduct.agentic.documents import DocumentSchema, DocumentQuestion, AnswerType
|
|
98
|
+
|
|
99
|
+
schema = DocumentSchema(
|
|
100
|
+
skill="invoice",
|
|
101
|
+
use_case="fraud audit",
|
|
102
|
+
questions=[
|
|
103
|
+
DocumentQuestion(id="invoice_total", question="Total amount due?", answer_type=AnswerType.NUMBER, unit="USD"),
|
|
104
|
+
DocumentQuestion(id="payment_terms", question="Payment terms?", answer_type=AnswerType.ENUM, enum=("net_15", "net_30", "net_60")),
|
|
105
|
+
],
|
|
106
|
+
)
|
|
107
|
+
```
|
|
108
|
+
|
|
83
109
|
### Train a Plain Model (No Explanations)
|
|
84
110
|
|
|
85
111
|
```python
|
|
@@ -45,6 +45,32 @@ df = pd.read_csv("credit.csv")
|
|
|
45
45
|
dataset = op.Dataset.from_pandas(df, label_column="default")
|
|
46
46
|
```
|
|
47
47
|
|
|
48
|
+
### Tabularize Documents into a Dataset
|
|
49
|
+
|
|
50
|
+
```python
|
|
51
|
+
from outerproduct.agentic import documents
|
|
52
|
+
|
|
53
|
+
docs = documents.DocumentSet.from_directory("./invoices")
|
|
54
|
+
refs = documents.upload(docs)
|
|
55
|
+
schema = documents.induce_schema(refs, use_case="fraud audit", skill="invoice")
|
|
56
|
+
dataset = documents.tabularize(refs, schema, label_column="is_fraud")
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
You can also hand-author the schema:
|
|
60
|
+
|
|
61
|
+
```python
|
|
62
|
+
from outerproduct.agentic.documents import DocumentSchema, DocumentQuestion, AnswerType
|
|
63
|
+
|
|
64
|
+
schema = DocumentSchema(
|
|
65
|
+
skill="invoice",
|
|
66
|
+
use_case="fraud audit",
|
|
67
|
+
questions=[
|
|
68
|
+
DocumentQuestion(id="invoice_total", question="Total amount due?", answer_type=AnswerType.NUMBER, unit="USD"),
|
|
69
|
+
DocumentQuestion(id="payment_terms", question="Payment terms?", answer_type=AnswerType.ENUM, enum=("net_15", "net_30", "net_60")),
|
|
70
|
+
],
|
|
71
|
+
)
|
|
72
|
+
```
|
|
73
|
+
|
|
48
74
|
### Train a Plain Model (No Explanations)
|
|
49
75
|
|
|
50
76
|
```python
|
|
@@ -42,8 +42,11 @@ Quickstart
|
|
|
42
42
|
|
|
43
43
|
from __future__ import annotations
|
|
44
44
|
|
|
45
|
+
from contextlib import contextmanager
|
|
46
|
+
from contextvars import ContextVar
|
|
45
47
|
from dataclasses import dataclass, field
|
|
46
48
|
from importlib.metadata import version as _pkg_version
|
|
49
|
+
from typing import TYPE_CHECKING, Generator
|
|
47
50
|
|
|
48
51
|
from outerproduct_http_types import ConnectorType
|
|
49
52
|
|
|
@@ -68,6 +71,9 @@ from outerproduct.trainer import (
|
|
|
68
71
|
Trainer,
|
|
69
72
|
)
|
|
70
73
|
|
|
74
|
+
if TYPE_CHECKING:
|
|
75
|
+
from outerproduct.client import OuterProductClient
|
|
76
|
+
|
|
71
77
|
try:
|
|
72
78
|
__version__ = _pkg_version("outerproduct")
|
|
73
79
|
except Exception:
|
|
@@ -87,6 +93,61 @@ class _GlobalState:
|
|
|
87
93
|
_state = _GlobalState()
|
|
88
94
|
|
|
89
95
|
|
|
96
|
+
# ---------------------------------------------------------------------
|
|
97
|
+
# Per-request client override (contextvar)
|
|
98
|
+
# ---------------------------------------------------------------------
|
|
99
|
+
#
|
|
100
|
+
# By default, every SDK HTTP call builds an :class:`OuterProductClient`
|
|
101
|
+
# from ``_state`` — one shared bearer token for the whole process. That
|
|
102
|
+
# works for single-user SDK consumers (notebooks, scripts).
|
|
103
|
+
#
|
|
104
|
+
# Multi-tenant SDK consumers (e.g. an MCP server serving many users)
|
|
105
|
+
# need *per-request* credentials. The contextvar below lets a caller
|
|
106
|
+
# enter a scope in which SDK HTTP helpers use a provided pre-built
|
|
107
|
+
# client instead of the global state — without mutating the global
|
|
108
|
+
# state and without changing every SDK class signature.
|
|
109
|
+
|
|
110
|
+
_request_client: ContextVar["OuterProductClient | None"] = ContextVar(
|
|
111
|
+
"outerproduct_request_client", default=None
|
|
112
|
+
)
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
@contextmanager
|
|
116
|
+
def use_client(
|
|
117
|
+
client: "OuterProductClient",
|
|
118
|
+
) -> Generator[None, None, None]:
|
|
119
|
+
"""Use ``client`` for every SDK HTTP call inside this block.
|
|
120
|
+
|
|
121
|
+
Inside the ``with`` block, the SDK's internal client helper yields
|
|
122
|
+
``client`` rather than building one from ``op._state``. The caller
|
|
123
|
+
owns ``client``'s lifecycle — the SDK will not close it.
|
|
124
|
+
|
|
125
|
+
Designed for service-style consumers (e.g. an MCP server) that need
|
|
126
|
+
to thread per-request credentials through SDK calls without mutating
|
|
127
|
+
global state. Contextvars propagate across ``asyncio.to_thread`` and
|
|
128
|
+
``asyncio.TaskGroup``, so this works inside async dispatch.
|
|
129
|
+
|
|
130
|
+
Examples
|
|
131
|
+
--------
|
|
132
|
+
.. code-block:: python
|
|
133
|
+
|
|
134
|
+
from outerproduct.client import OuterProductClient
|
|
135
|
+
import outerproduct as op
|
|
136
|
+
|
|
137
|
+
# Mint a per-request bearer (e.g. a short-lived JWT) and use it
|
|
138
|
+
# for every SDK call inside the `with` block.
|
|
139
|
+
with OuterProductClient.from_credentials(base_url, per_request_token) as client:
|
|
140
|
+
with op.use_client(client):
|
|
141
|
+
model = op.ReasoningModel(id="mdl-1", feature_names=["a","b"])
|
|
142
|
+
preds = model.predict(X)
|
|
143
|
+
"""
|
|
144
|
+
token = _request_client.set(client)
|
|
145
|
+
try:
|
|
146
|
+
yield
|
|
147
|
+
finally:
|
|
148
|
+
_request_client.reset(token)
|
|
149
|
+
|
|
150
|
+
|
|
90
151
|
def init(
|
|
91
152
|
api_key: str | None = None,
|
|
92
153
|
*,
|
|
@@ -131,14 +192,28 @@ def get_datasets() -> list[Dataset]:
|
|
|
131
192
|
|
|
132
193
|
with OuterProductClient.from_credentials(_state.base_url, _state.api_key) as client:
|
|
133
194
|
response = client.datasets_api.list()
|
|
134
|
-
return [
|
|
135
|
-
|
|
136
|
-
|
|
195
|
+
return [Dataset._from_response(record) for record in response.datasets]
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
def get_dataset(dataset_id: str) -> Dataset:
|
|
199
|
+
"""Fetch a single dataset by id; useful for cross-session reuse.
|
|
200
|
+
|
|
201
|
+
The returned Dataset has its ``_id`` and ``connection_config`` already
|
|
202
|
+
stamped, so subsequent fit/predict calls short-circuit the server-side
|
|
203
|
+
create.
|
|
204
|
+
"""
|
|
205
|
+
from outerproduct.client import OuterProductClient
|
|
206
|
+
|
|
207
|
+
with OuterProductClient.from_credentials(_state.base_url, _state.api_key) as client:
|
|
208
|
+
record = client.datasets_api.get(dataset_id)
|
|
209
|
+
return Dataset._from_response(record)
|
|
137
210
|
|
|
138
211
|
|
|
139
212
|
__all__ = [
|
|
140
213
|
# Bootstrap
|
|
141
214
|
"init",
|
|
215
|
+
"use_client",
|
|
216
|
+
"get_dataset",
|
|
142
217
|
"get_datasets",
|
|
143
218
|
"__version__",
|
|
144
219
|
# Dataset
|
|
@@ -313,8 +313,7 @@ class DocumentDataset(Dataset):
|
|
|
313
313
|
Column(name=q.id) for q in schema.questions
|
|
314
314
|
]
|
|
315
315
|
self._id = dataset_id
|
|
316
|
-
self.
|
|
317
|
-
self._table_name = None
|
|
316
|
+
self._connection_config = None
|
|
318
317
|
self._remote_only = True
|
|
319
318
|
self._schema = schema
|
|
320
319
|
self._document_ids = list(document_ids)
|
|
@@ -470,7 +469,6 @@ def tabularize(
|
|
|
470
469
|
schema: DocumentSchema,
|
|
471
470
|
*,
|
|
472
471
|
web_augmentation: bool = False,
|
|
473
|
-
concurrency: int = 1,
|
|
474
472
|
label_column: str | None = None,
|
|
475
473
|
client: OuterProductClient | None = None,
|
|
476
474
|
) -> DocumentDataset:
|
|
@@ -481,6 +479,9 @@ def tabularize(
|
|
|
481
479
|
:class:`~outerproduct.Trainer` and :func:`~outerproduct.reasoning.fit`
|
|
482
480
|
consume directly via the standard ``dataset_id`` wire mode.
|
|
483
481
|
No rows are downloaded to the client.
|
|
482
|
+
|
|
483
|
+
Fan-out concurrency is governed server-side by the API's Lambda
|
|
484
|
+
fleet; there is no client-side ``concurrency`` knob.
|
|
484
485
|
"""
|
|
485
486
|
op = _resolve_client(client)
|
|
486
487
|
refs = _coerce_to_refs(documents, op)
|
|
@@ -490,7 +491,6 @@ def tabularize(
|
|
|
490
491
|
"documents": [r.model_dump() for r in refs],
|
|
491
492
|
"schema": _schema_to_payload(schema).model_dump(),
|
|
492
493
|
"web_augmentation": web_augmentation,
|
|
493
|
-
"concurrency": concurrency,
|
|
494
494
|
}
|
|
495
495
|
)
|
|
496
496
|
)
|
|
@@ -12,25 +12,19 @@ from __future__ import annotations
|
|
|
12
12
|
from typing import TYPE_CHECKING
|
|
13
13
|
|
|
14
14
|
from outerproduct_http_types import (
|
|
15
|
-
ConnectorResponse,
|
|
16
|
-
CreateConnectorRequest,
|
|
17
15
|
CreateDocumentUploadRequest,
|
|
18
16
|
CreateDocumentUploadResponse,
|
|
19
17
|
CreateUploadRequest,
|
|
20
18
|
CreateUploadResponse,
|
|
21
19
|
Dataset,
|
|
22
20
|
DatasetResponse,
|
|
23
|
-
DeleteConnectorResponse,
|
|
24
21
|
ExplainRequest,
|
|
25
22
|
ExplainResponse,
|
|
26
23
|
GlobalDriversRequest,
|
|
27
24
|
GlobalDriversResponse,
|
|
28
25
|
InduceSchemaJobResponse,
|
|
29
26
|
InduceSchemaRequest,
|
|
30
|
-
ListConnectorsResponse,
|
|
31
27
|
ListDatasetsResponse,
|
|
32
|
-
ListTablesRequest,
|
|
33
|
-
ListTablesResponse,
|
|
34
28
|
PatternTrackerApplyRequest,
|
|
35
29
|
PatternTrackerDistributionResponse,
|
|
36
30
|
PatternTrackerFitRequest,
|
|
@@ -52,25 +46,21 @@ from outerproduct_http_types import (
|
|
|
52
46
|
TabularizeResultResponse,
|
|
53
47
|
TrainerRunRequest,
|
|
54
48
|
TrainerRunResponse,
|
|
49
|
+
ValidateConnectorRequest,
|
|
55
50
|
ValidateConnectorResponse,
|
|
56
51
|
)
|
|
57
52
|
|
|
58
53
|
from outerproduct.client.endpoints import (
|
|
59
|
-
CREATE_CONNECTOR,
|
|
60
54
|
CREATE_DATASET,
|
|
61
55
|
CREATE_DOCUMENT_UPLOAD,
|
|
62
56
|
CREATE_UPLOAD,
|
|
63
|
-
DELETE_CONNECTOR,
|
|
64
57
|
EXPLAIN,
|
|
65
|
-
GET_CONNECTOR,
|
|
66
58
|
GET_DATASET,
|
|
67
59
|
GET_DOCUMENT_SCHEMA,
|
|
68
60
|
GET_DOCUMENT_TABLE,
|
|
69
61
|
GLOBAL_DRIVERS,
|
|
70
62
|
INDUCE_DOCUMENT_SCHEMA,
|
|
71
|
-
LIST_CONNECTORS,
|
|
72
63
|
LIST_DATASETS,
|
|
73
|
-
LIST_TABLES,
|
|
74
64
|
PATTERN_TRACKER_DISTRIBUTION,
|
|
75
65
|
PATTERN_TRACKER_FIT,
|
|
76
66
|
PATTERN_TRACKER_GET,
|
|
@@ -158,10 +148,7 @@ class DatasetsAPI:
|
|
|
158
148
|
self._client = client
|
|
159
149
|
|
|
160
150
|
def create(self, request: Dataset) -> DatasetResponse:
|
|
161
|
-
return self._client._post(
|
|
162
|
-
CREATE_DATASET, # ty: ignore[invalid-argument-type]
|
|
163
|
-
request,
|
|
164
|
-
)
|
|
151
|
+
return self._client._post(CREATE_DATASET, request)
|
|
165
152
|
|
|
166
153
|
def list(self) -> ListDatasetsResponse:
|
|
167
154
|
return self._client._get(LIST_DATASETS)
|
|
@@ -254,62 +241,27 @@ class PatternTrackerAPI:
|
|
|
254
241
|
)
|
|
255
242
|
|
|
256
243
|
|
|
257
|
-
class
|
|
258
|
-
"""
|
|
244
|
+
class ConnectorAPI:
|
|
245
|
+
"""Connector-validation endpoint exposed to the SDK.
|
|
259
246
|
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
- ``GET /v1/connectors/{connector_id}`` → get
|
|
264
|
-
- ``DELETE /v1/connectors/{connector_id}`` → delete
|
|
265
|
-
- ``POST /v1/connectors/{connector_id}/tables`` → list_tables
|
|
266
|
-
- ``POST /v1/connectors/{connector_id}/validate`` → validate
|
|
247
|
+
Credential CRUD (``POST/GET/DELETE /v1/connector``) is managed by
|
|
248
|
+
console.op only — the SDK does not surface credential management.
|
|
249
|
+
The SDK only needs :meth:`validate` to test a ``ConnectionConfig``.
|
|
267
250
|
"""
|
|
268
251
|
|
|
269
252
|
def __init__(self, client: OuterProductClient) -> None:
|
|
270
253
|
self._client = client
|
|
271
254
|
|
|
272
|
-
def
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
return self._client._post( # ty: ignore[invalid-return-type]
|
|
278
|
-
CREATE_CONNECTOR, # ty: ignore[invalid-argument-type]
|
|
279
|
-
request,
|
|
280
|
-
)
|
|
281
|
-
|
|
282
|
-
def list(self) -> ListConnectorsResponse:
|
|
283
|
-
"""List all connectors for the authenticated org."""
|
|
284
|
-
return self._client._get(LIST_CONNECTORS)
|
|
285
|
-
|
|
286
|
-
def get(self, connector_id: str) -> ConnectorResponse:
|
|
287
|
-
"""Get a single connector by ID."""
|
|
288
|
-
return self._client._get( # ty: ignore[invalid-return-type]
|
|
289
|
-
GET_CONNECTOR,
|
|
290
|
-
connector_id=connector_id,
|
|
291
|
-
)
|
|
292
|
-
|
|
293
|
-
def delete(self, connector_id: str) -> DeleteConnectorResponse:
|
|
294
|
-
"""Delete a connector."""
|
|
295
|
-
return self._client._delete(DELETE_CONNECTOR, connector_id=connector_id)
|
|
296
|
-
|
|
297
|
-
def list_tables(self, connector_id: str) -> ListTablesResponse:
|
|
298
|
-
"""List tables/paths available through a connector."""
|
|
299
|
-
return self._client._post(
|
|
300
|
-
LIST_TABLES, ListTablesRequest(), connector_id=connector_id
|
|
301
|
-
)
|
|
302
|
-
|
|
303
|
-
def validate(self, connector_id: str) -> ValidateConnectorResponse:
|
|
304
|
-
"""Test connectivity for a connector."""
|
|
305
|
-
return self._client._post(
|
|
306
|
-
VALIDATE_CONNECTOR, ListTablesRequest(), connector_id=connector_id
|
|
307
|
-
)
|
|
255
|
+
def validate(
|
|
256
|
+
self, request: ValidateConnectorRequest
|
|
257
|
+
) -> ValidateConnectorResponse:
|
|
258
|
+
"""Probe connectivity against an inline ``ConnectionConfig``."""
|
|
259
|
+
return self._client._post(VALIDATE_CONNECTOR, request)
|
|
308
260
|
|
|
309
261
|
|
|
310
262
|
__all__ = [
|
|
311
263
|
"AgenticDocumentsAPI",
|
|
312
|
-
"
|
|
264
|
+
"ConnectorAPI",
|
|
313
265
|
"DatasetsAPI",
|
|
314
266
|
"InferenceAPI",
|
|
315
267
|
"PatternTrackerAPI",
|
|
@@ -29,7 +29,7 @@ from outerproduct.client.exceptions import (
|
|
|
29
29
|
if TYPE_CHECKING:
|
|
30
30
|
from outerproduct.client.apis import (
|
|
31
31
|
AgenticDocumentsAPI,
|
|
32
|
-
|
|
32
|
+
ConnectorAPI,
|
|
33
33
|
DatasetsAPI,
|
|
34
34
|
InferenceAPI,
|
|
35
35
|
PatternTrackerAPI,
|
|
@@ -176,10 +176,10 @@ class OuterProductClient:
|
|
|
176
176
|
return PatternTrackerAPI(self)
|
|
177
177
|
|
|
178
178
|
@property
|
|
179
|
-
def
|
|
180
|
-
from outerproduct.client.apis import
|
|
179
|
+
def connector_api(self) -> ConnectorAPI:
|
|
180
|
+
from outerproduct.client.apis import ConnectorAPI
|
|
181
181
|
|
|
182
|
-
return
|
|
182
|
+
return ConnectorAPI(self)
|
|
183
183
|
|
|
184
184
|
@property
|
|
185
185
|
def datasets_api(self) -> DatasetsAPI:
|
|
@@ -18,25 +18,23 @@ from dataclasses import dataclass
|
|
|
18
18
|
from typing import Generic, TypeVar
|
|
19
19
|
|
|
20
20
|
from outerproduct_http_types import (
|
|
21
|
-
|
|
22
|
-
CreateConnectorRequest,
|
|
21
|
+
CreateCredentialRequest,
|
|
23
22
|
CreateDocumentUploadRequest,
|
|
24
23
|
CreateDocumentUploadResponse,
|
|
25
24
|
CreateUploadRequest,
|
|
26
25
|
CreateUploadResponse,
|
|
26
|
+
CredentialResponse,
|
|
27
27
|
Dataset,
|
|
28
28
|
DatasetResponse,
|
|
29
|
-
|
|
29
|
+
DeleteCredentialResponse,
|
|
30
30
|
ExplainRequest,
|
|
31
31
|
ExplainResponse,
|
|
32
32
|
GlobalDriversRequest,
|
|
33
33
|
GlobalDriversResponse,
|
|
34
34
|
InduceSchemaJobResponse,
|
|
35
35
|
InduceSchemaRequest,
|
|
36
|
-
|
|
36
|
+
ListCredentialsResponse,
|
|
37
37
|
ListDatasetsResponse,
|
|
38
|
-
ListTablesRequest,
|
|
39
|
-
ListTablesResponse,
|
|
40
38
|
PatternTrackerApplyRequest,
|
|
41
39
|
PatternTrackerDistributionResponse,
|
|
42
40
|
PatternTrackerFitRequest,
|
|
@@ -59,6 +57,7 @@ from outerproduct_http_types import (
|
|
|
59
57
|
TabularizeResultResponse,
|
|
60
58
|
TrainerRunRequest,
|
|
61
59
|
TrainerRunResponse,
|
|
60
|
+
ValidateConnectorRequest,
|
|
62
61
|
ValidateConnectorResponse,
|
|
63
62
|
)
|
|
64
63
|
from pydantic import BaseModel
|
|
@@ -69,11 +68,7 @@ RespT = TypeVar("RespT", bound=BaseModel)
|
|
|
69
68
|
|
|
70
69
|
@dataclass(frozen=True)
|
|
71
70
|
class GetEndpoint(Generic[RespT]):
|
|
72
|
-
"""A ``GET`` endpoint, parameterised by its response model.
|
|
73
|
-
|
|
74
|
-
``path`` is a relative path (no leading slash) that may contain
|
|
75
|
-
``{name}`` placeholders to be filled in at call time.
|
|
76
|
-
"""
|
|
71
|
+
"""A ``GET`` endpoint, parameterised by its response model."""
|
|
77
72
|
|
|
78
73
|
path: str
|
|
79
74
|
response_type: type[RespT]
|
|
@@ -160,7 +155,7 @@ REASONING_FIT = PostEndpoint(
|
|
|
160
155
|
|
|
161
156
|
CREATE_DATASET = PostEndpoint(
|
|
162
157
|
path="datasets",
|
|
163
|
-
request_type=Dataset,
|
|
158
|
+
request_type=Dataset,
|
|
164
159
|
response_type=DatasetResponse,
|
|
165
160
|
)
|
|
166
161
|
LIST_DATASETS = GetEndpoint(
|
|
@@ -241,59 +236,45 @@ PATTERN_TRACKER_PARTITION = PostEndpoint(
|
|
|
241
236
|
)
|
|
242
237
|
|
|
243
238
|
# --------------------------------------------------------------------------- #
|
|
244
|
-
#
|
|
239
|
+
# Connector (credentials CRUD via console.op; validate is shared with SDK) #
|
|
245
240
|
# --------------------------------------------------------------------------- #
|
|
246
241
|
|
|
247
|
-
|
|
248
|
-
path="
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
# ty sees them where a plain `type[BaseModel]` is expected.
|
|
252
|
-
request_type=CreateConnectorRequest, # ty: ignore[invalid-argument-type]
|
|
253
|
-
response_type=ConnectorResponse, # ty: ignore[invalid-argument-type]
|
|
254
|
-
)
|
|
255
|
-
LIST_CONNECTORS = GetEndpoint(
|
|
256
|
-
path="connectors",
|
|
257
|
-
response_type=ListConnectorsResponse,
|
|
258
|
-
)
|
|
259
|
-
GET_CONNECTOR = GetEndpoint(
|
|
260
|
-
path="connectors/{connector_id}",
|
|
261
|
-
response_type=ConnectorResponse, # ty: ignore[invalid-argument-type]
|
|
242
|
+
CREATE_CREDENTIAL = PostEndpoint(
|
|
243
|
+
path="connector",
|
|
244
|
+
request_type=CreateCredentialRequest,
|
|
245
|
+
response_type=CredentialResponse,
|
|
262
246
|
)
|
|
263
|
-
|
|
264
|
-
path="
|
|
265
|
-
response_type=
|
|
247
|
+
LIST_CREDENTIALS = GetEndpoint(
|
|
248
|
+
path="connector",
|
|
249
|
+
response_type=ListCredentialsResponse,
|
|
266
250
|
)
|
|
267
|
-
|
|
268
|
-
path="
|
|
269
|
-
|
|
270
|
-
response_type=ListTablesResponse,
|
|
251
|
+
DELETE_CREDENTIAL = DeleteEndpoint(
|
|
252
|
+
path="connector/{credential_name}",
|
|
253
|
+
response_type=DeleteCredentialResponse,
|
|
271
254
|
)
|
|
272
255
|
VALIDATE_CONNECTOR = PostEndpoint(
|
|
273
|
-
path="
|
|
274
|
-
request_type=
|
|
256
|
+
path="connector/validate",
|
|
257
|
+
request_type=ValidateConnectorRequest,
|
|
275
258
|
response_type=ValidateConnectorResponse,
|
|
276
259
|
)
|
|
277
260
|
|
|
278
261
|
|
|
279
262
|
__all__ = [
|
|
280
|
-
"
|
|
263
|
+
"CREATE_CREDENTIAL",
|
|
281
264
|
"CREATE_DATASET",
|
|
282
265
|
"CREATE_DOCUMENT_UPLOAD",
|
|
283
266
|
"CREATE_UPLOAD",
|
|
284
|
-
"
|
|
267
|
+
"DELETE_CREDENTIAL",
|
|
285
268
|
"DeleteEndpoint",
|
|
286
269
|
"EXPLAIN",
|
|
287
|
-
"GET_CONNECTOR",
|
|
288
270
|
"GET_DATASET",
|
|
289
271
|
"GET_DOCUMENT_SCHEMA",
|
|
290
272
|
"GET_DOCUMENT_TABLE",
|
|
291
273
|
"GLOBAL_DRIVERS",
|
|
292
274
|
"GetEndpoint",
|
|
293
275
|
"INDUCE_DOCUMENT_SCHEMA",
|
|
294
|
-
"
|
|
276
|
+
"LIST_CREDENTIALS",
|
|
295
277
|
"LIST_DATASETS",
|
|
296
|
-
"LIST_TABLES",
|
|
297
278
|
"PATTERN_TRACKER_DISTRIBUTION",
|
|
298
279
|
"PATTERN_TRACKER_FIT",
|
|
299
280
|
"PATTERN_TRACKER_GET",
|