weave-python 0.28.1__py3-none-any.whl → 0.30.3__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.
- weave/weaveapi/auth/v1/service_pb2.py +194 -98
- weave/weaveapi/auth/v1/service_pb2.pyi +1288 -1134
- weave/weaveapi/auth/v1/service_pb2_grpc.pyi +248 -335
- weave/weaveapi/auth/v1/session_pb2.py +14 -6
- weave/weaveapi/auth/v1/session_pb2.pyi +109 -89
- weave/weaveapi/auth/v1/session_pb2_grpc.pyi +11 -10
- weave/weaveapi/auth/v1/usage_pb2.py +18 -14
- weave/weaveapi/auth/v1/usage_pb2.pyi +251 -197
- weave/weaveapi/auth/v1/usage_pb2_grpc.pyi +11 -10
- weave/weaveapi/auth/v1/user_pb2.py +60 -18
- weave/weaveapi/auth/v1/user_pb2.pyi +588 -505
- weave/weaveapi/auth/v1/user_pb2_grpc.pyi +11 -10
- weave/weaveapi/generate/v1/configuration_pb2.py +31 -19
- weave/weaveapi/generate/v1/configuration_pb2.pyi +277 -241
- weave/weaveapi/generate/v1/configuration_pb2_grpc.pyi +11 -10
- weave/weaveapi/generate/v1/generate_pb2.py +32 -6
- weave/weaveapi/generate/v1/generate_pb2.pyi +138 -40
- weave/weaveapi/generate/v1/generate_pb2_grpc.pyi +11 -10
- weave/weaveapi/generate/v1/service_pb2.py +52 -22
- weave/weaveapi/generate/v1/service_pb2.pyi +264 -135
- weave/weaveapi/generate/v1/service_pb2_grpc.py +47 -0
- weave/weaveapi/generate/v1/service_pb2_grpc.pyi +89 -78
- weave/weaveapi/llmx/v1/architecture_pb2.py +42 -42
- weave/weaveapi/llmx/v1/architecture_pb2.pyi +664 -555
- weave/weaveapi/llmx/v1/architecture_pb2_grpc.pyi +11 -10
- weave/weaveapi/llmx/v1/capabilities_pb2.py +88 -56
- weave/weaveapi/llmx/v1/capabilities_pb2.pyi +967 -852
- weave/weaveapi/llmx/v1/capabilities_pb2_grpc.pyi +11 -10
- weave/weaveapi/llmx/v1/model_pb2.py +56 -20
- weave/weaveapi/llmx/v1/model_pb2.pyi +533 -455
- weave/weaveapi/llmx/v1/model_pb2_grpc.pyi +11 -10
- weave/weaveapi/llmx/v1/pricing_pb2.py +24 -20
- weave/weaveapi/llmx/v1/pricing_pb2.pyi +194 -172
- weave/weaveapi/llmx/v1/pricing_pb2_grpc.pyi +11 -10
- weave/weaveapi/llmx/v1/provider_pb2.py +6 -6
- weave/weaveapi/llmx/v1/provider_pb2.pyi +84 -59
- weave/weaveapi/llmx/v1/provider_pb2_grpc.pyi +11 -10
- weave/weaveapi/llmx/v1/service_pb2.py +228 -90
- weave/weaveapi/llmx/v1/service_pb2.pyi +1651 -1403
- weave/weaveapi/llmx/v1/service_pb2_grpc.pyi +160 -203
- weave/weaveapi/mcpregistry/v1/server_pb2.py +16 -10
- weave/weaveapi/mcpregistry/v1/server_pb2.pyi +143 -121
- weave/weaveapi/mcpregistry/v1/server_pb2_grpc.pyi +11 -10
- weave/weaveapi/mcpregistry/v1/service_pb2.py +51 -31
- weave/weaveapi/mcpregistry/v1/service_pb2.pyi +132 -122
- weave/weaveapi/mcpregistry/v1/service_pb2_grpc.pyi +87 -112
- weave/weaveapi/payment/v1/invoice_pb2.py +38 -12
- weave/weaveapi/payment/v1/invoice_pb2.pyi +352 -291
- weave/weaveapi/payment/v1/invoice_pb2_grpc.pyi +11 -10
- weave/weaveapi/payment/v1/service_pb2.py +264 -98
- weave/weaveapi/payment/v1/service_pb2.pyi +1381 -1242
- weave/weaveapi/payment/v1/service_pb2_grpc.pyi +229 -319
- weave/weaveapi/payment/v1/subscription_pb2.py +99 -23
- weave/weaveapi/payment/v1/subscription_pb2.pyi +727 -611
- weave/weaveapi/payment/v1/subscription_pb2_grpc.pyi +11 -10
- weave/weaveapi/storage/v1/auth_pb2.py +6 -6
- weave/weaveapi/storage/v1/auth_pb2.pyi +42 -29
- weave/weaveapi/storage/v1/auth_pb2_grpc.pyi +11 -10
- weave/weaveapi/storage/v1/nosql_database_pb2.py +47 -23
- weave/weaveapi/storage/v1/nosql_database_pb2.pyi +438 -372
- weave/weaveapi/storage/v1/nosql_database_pb2_grpc.pyi +11 -10
- weave/weaveapi/storage/v1/object_store_pb2.py +27 -13
- weave/weaveapi/storage/v1/object_store_pb2.pyi +203 -187
- weave/weaveapi/storage/v1/object_store_pb2_grpc.pyi +11 -10
- weave/weaveapi/storage/v1/service_pb2.py +96 -36
- weave/weaveapi/storage/v1/service_pb2.pyi +414 -357
- weave/weaveapi/storage/v1/service_pb2_grpc.pyi +88 -107
- weave/weaveapi/storage/v1/sql_database_pb2.py +39 -23
- weave/weaveapi/storage/v1/sql_database_pb2.pyi +481 -400
- weave/weaveapi/storage/v1/sql_database_pb2_grpc.pyi +11 -10
- weave/weaveapi/storage/v1/storage_pb2.py +20 -6
- weave/weaveapi/storage/v1/storage_pb2.pyi +79 -70
- weave/weaveapi/storage/v1/storage_pb2_grpc.pyi +11 -10
- weave/weaveapi/synthesize/v1/dataset_pb2.py +14 -12
- weave/weaveapi/synthesize/v1/dataset_pb2.pyi +158 -128
- weave/weaveapi/synthesize/v1/dataset_pb2_grpc.pyi +11 -10
- weave/weaveapi/synthesize/v1/inline_data_pb2.py +9 -9
- weave/weaveapi/synthesize/v1/inline_data_pb2.pyi +31 -27
- weave/weaveapi/synthesize/v1/inline_data_pb2_grpc.pyi +11 -10
- weave/weaveapi/synthesize/v1/relationship_pb2.py +19 -11
- weave/weaveapi/synthesize/v1/relationship_pb2.pyi +67 -64
- weave/weaveapi/synthesize/v1/relationship_pb2_grpc.pyi +11 -10
- weave/weaveapi/synthesize/v1/service_pb2.py +42 -24
- weave/weaveapi/synthesize/v1/service_pb2.pyi +202 -168
- weave/weaveapi/synthesize/v1/service_pb2_grpc.pyi +67 -79
- weave/weaveapi/synthesize/v1/training_pb2.py +19 -13
- weave/weaveapi/synthesize/v1/training_pb2.pyi +119 -106
- weave/weaveapi/synthesize/v1/training_pb2_grpc.pyi +11 -10
- weave/weavesql/llmxdb/capabilities.py +487 -0
- weave/weavesql/llmxdb/changes.py +297 -0
- weave/weavesql/llmxdb/models.py +594 -0
- weave/weavesql/llmxdb/providers.py +348 -0
- weave/weavesql/llmxdb/scraper_runs.py +287 -0
- weave/weavesql/llmxdb/search.py +721 -0
- weave/weavesql/weavedb/dataset.py +75 -0
- weave/weavesql/weavedb/models.py +135 -0
- weave/weavesql/weavedb/relationships.py +72 -0
- weave/weavesql/weavedb/storage.py +113 -0
- weave/weavesql/weavedb/synthesizer.py +107 -0
- weave_python-0.30.3.dist-info/METADATA +52 -0
- weave_python-0.30.3.dist-info/RECORD +131 -0
- {weave_python-0.28.1.dist-info → weave_python-0.30.3.dist-info}/WHEEL +1 -1
- weave_python-0.30.3.dist-info/licenses/LICENSE +120 -0
- weave_python-0.28.1.dist-info/METADATA +0 -6
- weave_python-0.28.1.dist-info/RECORD +0 -119
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# Code generated by sqlc. DO NOT EDIT.
|
|
2
|
+
# versions:
|
|
3
|
+
# sqlc v1.28.0
|
|
4
|
+
# source: dataset.sql
|
|
5
|
+
import dataclasses
|
|
6
|
+
from typing import Optional
|
|
7
|
+
import uuid
|
|
8
|
+
|
|
9
|
+
import sqlalchemy
|
|
10
|
+
import sqlalchemy.ext.asyncio
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
UPSERT_DATASET = """-- name: upsert_dataset \\:exec
|
|
14
|
+
INSERT INTO generate_v1.dataset (id, organization_id, name, description, storage_connection_id, schema_id,
|
|
15
|
+
synthesizer_id, is_synthetic)
|
|
16
|
+
VALUES (:p1, :p2, :p3, :p4, :p5, :p6, :p7, :p8)
|
|
17
|
+
ON CONFLICT (id) DO UPDATE SET name = EXCLUDED.name,
|
|
18
|
+
description = EXCLUDED.description,
|
|
19
|
+
storage_connection_id = EXCLUDED.storage_connection_id,
|
|
20
|
+
schema_id = EXCLUDED.schema_id,
|
|
21
|
+
synthesizer_id = EXCLUDED.synthesizer_id,
|
|
22
|
+
is_synthetic = EXCLUDED.is_synthetic
|
|
23
|
+
"""
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
@dataclasses.dataclass()
|
|
27
|
+
class UpsertDatasetParams:
|
|
28
|
+
id: uuid.UUID
|
|
29
|
+
organization_id: uuid.UUID
|
|
30
|
+
name: str
|
|
31
|
+
description: Optional[str]
|
|
32
|
+
storage_connection_id: uuid.UUID
|
|
33
|
+
schema_id: Optional[uuid.UUID]
|
|
34
|
+
synthesizer_id: Optional[uuid.UUID]
|
|
35
|
+
is_synthetic: Optional[bool]
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
class Querier:
|
|
39
|
+
def __init__(self, conn: sqlalchemy.engine.Connection):
|
|
40
|
+
self._conn = conn
|
|
41
|
+
|
|
42
|
+
def upsert_dataset(self, arg: UpsertDatasetParams) -> None:
|
|
43
|
+
self._conn.execute(
|
|
44
|
+
sqlalchemy.text(UPSERT_DATASET),
|
|
45
|
+
{
|
|
46
|
+
"p1": arg.id,
|
|
47
|
+
"p2": arg.organization_id,
|
|
48
|
+
"p3": arg.name,
|
|
49
|
+
"p4": arg.description,
|
|
50
|
+
"p5": arg.storage_connection_id,
|
|
51
|
+
"p6": arg.schema_id,
|
|
52
|
+
"p7": arg.synthesizer_id,
|
|
53
|
+
"p8": arg.is_synthetic,
|
|
54
|
+
},
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
class AsyncQuerier:
|
|
59
|
+
def __init__(self, conn: sqlalchemy.ext.asyncio.AsyncConnection):
|
|
60
|
+
self._conn = conn
|
|
61
|
+
|
|
62
|
+
async def upsert_dataset(self, arg: UpsertDatasetParams) -> None:
|
|
63
|
+
await self._conn.execute(
|
|
64
|
+
sqlalchemy.text(UPSERT_DATASET),
|
|
65
|
+
{
|
|
66
|
+
"p1": arg.id,
|
|
67
|
+
"p2": arg.organization_id,
|
|
68
|
+
"p3": arg.name,
|
|
69
|
+
"p4": arg.description,
|
|
70
|
+
"p5": arg.storage_connection_id,
|
|
71
|
+
"p6": arg.schema_id,
|
|
72
|
+
"p7": arg.synthesizer_id,
|
|
73
|
+
"p8": arg.is_synthetic,
|
|
74
|
+
},
|
|
75
|
+
)
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
# Code generated by sqlc. DO NOT EDIT.
|
|
2
|
+
# versions:
|
|
3
|
+
# sqlc v1.28.0
|
|
4
|
+
import dataclasses
|
|
5
|
+
import datetime
|
|
6
|
+
import enum
|
|
7
|
+
from typing import Any, Optional
|
|
8
|
+
import uuid
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class StorageCategory(enum.StrEnum):
|
|
12
|
+
OBJECT_STORE = "object_store"
|
|
13
|
+
SQL_DATABASE = "sql_database"
|
|
14
|
+
NOSQL_DATABASE = "nosql_database"
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class StorageVariant(enum.StrEnum):
|
|
18
|
+
AWS_S3 = "aws_s3"
|
|
19
|
+
AZURE_BLOB_STORAGE = "azure_blob_storage"
|
|
20
|
+
GOOGLE_CLOUD_STORAGE = "google_cloud_storage"
|
|
21
|
+
MYSQL = "mysql"
|
|
22
|
+
POSTGRES = "postgres"
|
|
23
|
+
SQL_SERVER = "sql_server"
|
|
24
|
+
ORACLE = "oracle"
|
|
25
|
+
MARIADB = "mariadb"
|
|
26
|
+
SNOWFLAKE = "snowflake"
|
|
27
|
+
BIGQUERY = "bigquery"
|
|
28
|
+
DATABRICKS = "databricks"
|
|
29
|
+
CASSANDRA = "cassandra"
|
|
30
|
+
MONGODB = "mongodb"
|
|
31
|
+
DYNAMODB = "dynamodb"
|
|
32
|
+
COSMOSDB = "cosmosdb"
|
|
33
|
+
REDIS = "redis"
|
|
34
|
+
VALKEY = "valkey"
|
|
35
|
+
ELASTICSEARCH = "elasticsearch"
|
|
36
|
+
OPENSEARCH = "opensearch"
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
class SynthesizeV1ColumnDataType(enum.StrEnum):
|
|
40
|
+
STRING = "string"
|
|
41
|
+
INTEGER = "integer"
|
|
42
|
+
FLOAT = "float"
|
|
43
|
+
BOOLEAN = "boolean"
|
|
44
|
+
TIMESTAMP = "timestamp"
|
|
45
|
+
DATE = "date"
|
|
46
|
+
BINARY = "binary"
|
|
47
|
+
CATEGORICAL = "categorical"
|
|
48
|
+
ORDINAL = "ordinal"
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
class SynthesizeV1ColumnRelationshipType(enum.StrEnum):
|
|
52
|
+
CONTEXT_FOREIGN_KEY = "context_foreign_key"
|
|
53
|
+
NON_CONTEXT_FOREIGN_KEY = "non_context_foreign_key"
|
|
54
|
+
ONE_TO_MANY = "one_to_many"
|
|
55
|
+
MANY_TO_ONE = "many_to_one"
|
|
56
|
+
MANY_TO_MANY = "many_to_many"
|
|
57
|
+
SELF_REFERENCE = "self_reference"
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
@dataclasses.dataclass()
|
|
61
|
+
class GenerateV1Dataset:
|
|
62
|
+
id: uuid.UUID
|
|
63
|
+
organization_id: uuid.UUID
|
|
64
|
+
name: str
|
|
65
|
+
description: Optional[str]
|
|
66
|
+
storage_connection_id: uuid.UUID
|
|
67
|
+
schema_id: Optional[uuid.UUID]
|
|
68
|
+
synthesizer_id: Optional[uuid.UUID]
|
|
69
|
+
is_synthetic: Optional[bool]
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
@dataclasses.dataclass()
|
|
73
|
+
class LlmProviderCredential:
|
|
74
|
+
id: uuid.UUID
|
|
75
|
+
organization_id: uuid.UUID
|
|
76
|
+
provider_slug: str
|
|
77
|
+
credentials: Any
|
|
78
|
+
created_at: Optional[datetime.datetime]
|
|
79
|
+
updated_at: Optional[datetime.datetime]
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
@dataclasses.dataclass()
|
|
83
|
+
class Organization:
|
|
84
|
+
id: uuid.UUID
|
|
85
|
+
name: str
|
|
86
|
+
description: Optional[str]
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
@dataclasses.dataclass()
|
|
90
|
+
class StorageConnection:
|
|
91
|
+
id: uuid.UUID
|
|
92
|
+
organization_id: uuid.UUID
|
|
93
|
+
name: str
|
|
94
|
+
description: Optional[str]
|
|
95
|
+
category: StorageCategory
|
|
96
|
+
variant: StorageVariant
|
|
97
|
+
details: Any
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
@dataclasses.dataclass()
|
|
101
|
+
class SynthesizeV1ColumnRelationship:
|
|
102
|
+
id: uuid.UUID
|
|
103
|
+
source_column_id: uuid.UUID
|
|
104
|
+
source_dataset_id: uuid.UUID
|
|
105
|
+
target_column_id: uuid.UUID
|
|
106
|
+
target_dataset_id: uuid.UUID
|
|
107
|
+
relationship_type: Any
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
@dataclasses.dataclass()
|
|
111
|
+
class SynthesizeV1DataColumn:
|
|
112
|
+
id: uuid.UUID
|
|
113
|
+
schema_id: uuid.UUID
|
|
114
|
+
name: str
|
|
115
|
+
data_type: Any
|
|
116
|
+
is_primary_key: Optional[bool]
|
|
117
|
+
description: Optional[str]
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
@dataclasses.dataclass()
|
|
121
|
+
class SynthesizeV1DataSchema:
|
|
122
|
+
id: uuid.UUID
|
|
123
|
+
organization_id: uuid.UUID
|
|
124
|
+
name: str
|
|
125
|
+
description: Optional[str]
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
@dataclasses.dataclass()
|
|
129
|
+
class SynthesizeV1Synthesizer:
|
|
130
|
+
id: uuid.UUID
|
|
131
|
+
organization_id: uuid.UUID
|
|
132
|
+
name: str
|
|
133
|
+
description: Optional[str]
|
|
134
|
+
storage_connection_id: uuid.UUID
|
|
135
|
+
metadata: Optional[Any]
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# Code generated by sqlc. DO NOT EDIT.
|
|
2
|
+
# versions:
|
|
3
|
+
# sqlc v1.28.0
|
|
4
|
+
# source: relationships.sql
|
|
5
|
+
import dataclasses
|
|
6
|
+
from typing import AsyncIterator, Iterator, List
|
|
7
|
+
import uuid
|
|
8
|
+
|
|
9
|
+
import sqlalchemy
|
|
10
|
+
import sqlalchemy.ext.asyncio
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
GET_FOREIGN_KEY_RELATIONSHIPS = """-- name: get_foreign_key_relationships \\:many
|
|
14
|
+
SELECT cr.source_dataset_id,
|
|
15
|
+
cr.target_dataset_id,
|
|
16
|
+
sc.name AS source_column_name,
|
|
17
|
+
tc.name AS target_column_name
|
|
18
|
+
FROM synthesize_v1.column_relationship cr
|
|
19
|
+
JOIN
|
|
20
|
+
synthesize_v1.data_column sc ON cr.source_column_id = sc.id
|
|
21
|
+
JOIN
|
|
22
|
+
synthesize_v1.data_column tc ON cr.target_column_id = tc.id
|
|
23
|
+
WHERE cr.relationship_type IN ('context_foreign_key', 'non_context_foreign_key')
|
|
24
|
+
AND cr.source_dataset_id = ANY (:p1\\:\\:UUID[])
|
|
25
|
+
AND cr.target_dataset_id = ANY (:p1\\:\\:UUID[])
|
|
26
|
+
"""
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
@dataclasses.dataclass()
|
|
30
|
+
class GetForeignKeyRelationshipsRow:
|
|
31
|
+
source_dataset_id: uuid.UUID
|
|
32
|
+
target_dataset_id: uuid.UUID
|
|
33
|
+
source_column_name: str
|
|
34
|
+
target_column_name: str
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
class Querier:
|
|
38
|
+
def __init__(self, conn: sqlalchemy.engine.Connection):
|
|
39
|
+
self._conn = conn
|
|
40
|
+
|
|
41
|
+
def get_foreign_key_relationships(
|
|
42
|
+
self, *, dataset_ids: List[uuid.UUID]
|
|
43
|
+
) -> Iterator[GetForeignKeyRelationshipsRow]:
|
|
44
|
+
result = self._conn.execute(
|
|
45
|
+
sqlalchemy.text(GET_FOREIGN_KEY_RELATIONSHIPS), {"p1": dataset_ids}
|
|
46
|
+
)
|
|
47
|
+
for row in result:
|
|
48
|
+
yield GetForeignKeyRelationshipsRow(
|
|
49
|
+
source_dataset_id=row[0],
|
|
50
|
+
target_dataset_id=row[1],
|
|
51
|
+
source_column_name=row[2],
|
|
52
|
+
target_column_name=row[3],
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
class AsyncQuerier:
|
|
57
|
+
def __init__(self, conn: sqlalchemy.ext.asyncio.AsyncConnection):
|
|
58
|
+
self._conn = conn
|
|
59
|
+
|
|
60
|
+
async def get_foreign_key_relationships(
|
|
61
|
+
self, *, dataset_ids: List[uuid.UUID]
|
|
62
|
+
) -> AsyncIterator[GetForeignKeyRelationshipsRow]:
|
|
63
|
+
result = await self._conn.stream(
|
|
64
|
+
sqlalchemy.text(GET_FOREIGN_KEY_RELATIONSHIPS), {"p1": dataset_ids}
|
|
65
|
+
)
|
|
66
|
+
async for row in result:
|
|
67
|
+
yield GetForeignKeyRelationshipsRow(
|
|
68
|
+
source_dataset_id=row[0],
|
|
69
|
+
target_dataset_id=row[1],
|
|
70
|
+
source_column_name=row[2],
|
|
71
|
+
target_column_name=row[3],
|
|
72
|
+
)
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
# Code generated by sqlc. DO NOT EDIT.
|
|
2
|
+
# versions:
|
|
3
|
+
# sqlc v1.28.0
|
|
4
|
+
# source: storage.sql
|
|
5
|
+
from typing import Optional
|
|
6
|
+
import uuid
|
|
7
|
+
|
|
8
|
+
import sqlalchemy
|
|
9
|
+
import sqlalchemy.ext.asyncio
|
|
10
|
+
|
|
11
|
+
from weave.weavesql.weavedb import models
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
GET_STORAGE_CONNECTION = """-- name: get_storage_connection \\:one
|
|
15
|
+
SELECT id, organization_id, name, description, category, variant, details
|
|
16
|
+
FROM storage_connection
|
|
17
|
+
WHERE id = :p1
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
GET_STORAGE_CONNECTION_BY_DATASET_ID = """-- name: get_storage_connection_by_dataset_id \\:one
|
|
22
|
+
SELECT sc.id, sc.organization_id, sc.name, sc.description, sc.category, sc.variant, sc.details
|
|
23
|
+
FROM storage_connection sc
|
|
24
|
+
JOIN generate_v1.dataset d ON d.storage_connection_id = sc.id
|
|
25
|
+
WHERE d.id = :p1
|
|
26
|
+
"""
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
class Querier:
|
|
30
|
+
def __init__(self, conn: sqlalchemy.engine.Connection):
|
|
31
|
+
self._conn = conn
|
|
32
|
+
|
|
33
|
+
def get_storage_connection(
|
|
34
|
+
self, *, id: uuid.UUID
|
|
35
|
+
) -> Optional[models.StorageConnection]:
|
|
36
|
+
row = self._conn.execute(
|
|
37
|
+
sqlalchemy.text(GET_STORAGE_CONNECTION), {"p1": id}
|
|
38
|
+
).first()
|
|
39
|
+
if row is None:
|
|
40
|
+
return None
|
|
41
|
+
return models.StorageConnection(
|
|
42
|
+
id=row[0],
|
|
43
|
+
organization_id=row[1],
|
|
44
|
+
name=row[2],
|
|
45
|
+
description=row[3],
|
|
46
|
+
category=row[4],
|
|
47
|
+
variant=row[5],
|
|
48
|
+
details=row[6],
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
def get_storage_connection_by_dataset_id(
|
|
52
|
+
self, *, dataset_id: uuid.UUID
|
|
53
|
+
) -> Optional[models.StorageConnection]:
|
|
54
|
+
row = self._conn.execute(
|
|
55
|
+
sqlalchemy.text(GET_STORAGE_CONNECTION_BY_DATASET_ID), {"p1": dataset_id}
|
|
56
|
+
).first()
|
|
57
|
+
if row is None:
|
|
58
|
+
return None
|
|
59
|
+
return models.StorageConnection(
|
|
60
|
+
id=row[0],
|
|
61
|
+
organization_id=row[1],
|
|
62
|
+
name=row[2],
|
|
63
|
+
description=row[3],
|
|
64
|
+
category=row[4],
|
|
65
|
+
variant=row[5],
|
|
66
|
+
details=row[6],
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
class AsyncQuerier:
|
|
71
|
+
def __init__(self, conn: sqlalchemy.ext.asyncio.AsyncConnection):
|
|
72
|
+
self._conn = conn
|
|
73
|
+
|
|
74
|
+
async def get_storage_connection(
|
|
75
|
+
self, *, id: uuid.UUID
|
|
76
|
+
) -> Optional[models.StorageConnection]:
|
|
77
|
+
row = (
|
|
78
|
+
await self._conn.execute(
|
|
79
|
+
sqlalchemy.text(GET_STORAGE_CONNECTION), {"p1": id}
|
|
80
|
+
)
|
|
81
|
+
).first()
|
|
82
|
+
if row is None:
|
|
83
|
+
return None
|
|
84
|
+
return models.StorageConnection(
|
|
85
|
+
id=row[0],
|
|
86
|
+
organization_id=row[1],
|
|
87
|
+
name=row[2],
|
|
88
|
+
description=row[3],
|
|
89
|
+
category=row[4],
|
|
90
|
+
variant=row[5],
|
|
91
|
+
details=row[6],
|
|
92
|
+
)
|
|
93
|
+
|
|
94
|
+
async def get_storage_connection_by_dataset_id(
|
|
95
|
+
self, *, dataset_id: uuid.UUID
|
|
96
|
+
) -> Optional[models.StorageConnection]:
|
|
97
|
+
row = (
|
|
98
|
+
await self._conn.execute(
|
|
99
|
+
sqlalchemy.text(GET_STORAGE_CONNECTION_BY_DATASET_ID),
|
|
100
|
+
{"p1": dataset_id},
|
|
101
|
+
)
|
|
102
|
+
).first()
|
|
103
|
+
if row is None:
|
|
104
|
+
return None
|
|
105
|
+
return models.StorageConnection(
|
|
106
|
+
id=row[0],
|
|
107
|
+
organization_id=row[1],
|
|
108
|
+
name=row[2],
|
|
109
|
+
description=row[3],
|
|
110
|
+
category=row[4],
|
|
111
|
+
variant=row[5],
|
|
112
|
+
details=row[6],
|
|
113
|
+
)
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
# Code generated by sqlc. DO NOT EDIT.
|
|
2
|
+
# versions:
|
|
3
|
+
# sqlc v1.28.0
|
|
4
|
+
# source: synthesizer.sql
|
|
5
|
+
import dataclasses
|
|
6
|
+
from typing import Any, Optional
|
|
7
|
+
import uuid
|
|
8
|
+
|
|
9
|
+
import sqlalchemy
|
|
10
|
+
import sqlalchemy.ext.asyncio
|
|
11
|
+
|
|
12
|
+
from weave.weavesql.weavedb import models
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
GET_SYNTHESIZER = """-- name: get_synthesizer \\:one
|
|
16
|
+
SELECT id, organization_id, name, description, storage_connection_id, metadata
|
|
17
|
+
FROM synthesize_v1.synthesizer
|
|
18
|
+
WHERE id = :p1
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
UPSERT_SYNTHESIZER = """-- name: upsert_synthesizer \\:exec
|
|
23
|
+
INSERT INTO synthesize_v1.synthesizer (id, organization_id, name, description, storage_connection_id, metadata)
|
|
24
|
+
VALUES (:p1, :p2, :p3, :p4, :p5, :p6)
|
|
25
|
+
ON CONFLICT (id) DO UPDATE SET name = EXCLUDED.name,
|
|
26
|
+
description = EXCLUDED.description,
|
|
27
|
+
storage_connection_id = EXCLUDED.storage_connection_id,
|
|
28
|
+
metadata = EXCLUDED.metadata
|
|
29
|
+
"""
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
@dataclasses.dataclass()
|
|
33
|
+
class UpsertSynthesizerParams:
|
|
34
|
+
id: uuid.UUID
|
|
35
|
+
organization_id: uuid.UUID
|
|
36
|
+
name: str
|
|
37
|
+
description: Optional[str]
|
|
38
|
+
storage_connection_id: uuid.UUID
|
|
39
|
+
metadata: Optional[Any]
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
class Querier:
|
|
43
|
+
def __init__(self, conn: sqlalchemy.engine.Connection):
|
|
44
|
+
self._conn = conn
|
|
45
|
+
|
|
46
|
+
def get_synthesizer(
|
|
47
|
+
self, *, id: uuid.UUID
|
|
48
|
+
) -> Optional[models.SynthesizeV1Synthesizer]:
|
|
49
|
+
row = self._conn.execute(sqlalchemy.text(GET_SYNTHESIZER), {"p1": id}).first()
|
|
50
|
+
if row is None:
|
|
51
|
+
return None
|
|
52
|
+
return models.SynthesizeV1Synthesizer(
|
|
53
|
+
id=row[0],
|
|
54
|
+
organization_id=row[1],
|
|
55
|
+
name=row[2],
|
|
56
|
+
description=row[3],
|
|
57
|
+
storage_connection_id=row[4],
|
|
58
|
+
metadata=row[5],
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
def upsert_synthesizer(self, arg: UpsertSynthesizerParams) -> None:
|
|
62
|
+
self._conn.execute(
|
|
63
|
+
sqlalchemy.text(UPSERT_SYNTHESIZER),
|
|
64
|
+
{
|
|
65
|
+
"p1": arg.id,
|
|
66
|
+
"p2": arg.organization_id,
|
|
67
|
+
"p3": arg.name,
|
|
68
|
+
"p4": arg.description,
|
|
69
|
+
"p5": arg.storage_connection_id,
|
|
70
|
+
"p6": arg.metadata,
|
|
71
|
+
},
|
|
72
|
+
)
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
class AsyncQuerier:
|
|
76
|
+
def __init__(self, conn: sqlalchemy.ext.asyncio.AsyncConnection):
|
|
77
|
+
self._conn = conn
|
|
78
|
+
|
|
79
|
+
async def get_synthesizer(
|
|
80
|
+
self, *, id: uuid.UUID
|
|
81
|
+
) -> Optional[models.SynthesizeV1Synthesizer]:
|
|
82
|
+
row = (
|
|
83
|
+
await self._conn.execute(sqlalchemy.text(GET_SYNTHESIZER), {"p1": id})
|
|
84
|
+
).first()
|
|
85
|
+
if row is None:
|
|
86
|
+
return None
|
|
87
|
+
return models.SynthesizeV1Synthesizer(
|
|
88
|
+
id=row[0],
|
|
89
|
+
organization_id=row[1],
|
|
90
|
+
name=row[2],
|
|
91
|
+
description=row[3],
|
|
92
|
+
storage_connection_id=row[4],
|
|
93
|
+
metadata=row[5],
|
|
94
|
+
)
|
|
95
|
+
|
|
96
|
+
async def upsert_synthesizer(self, arg: UpsertSynthesizerParams) -> None:
|
|
97
|
+
await self._conn.execute(
|
|
98
|
+
sqlalchemy.text(UPSERT_SYNTHESIZER),
|
|
99
|
+
{
|
|
100
|
+
"p1": arg.id,
|
|
101
|
+
"p2": arg.organization_id,
|
|
102
|
+
"p3": arg.name,
|
|
103
|
+
"p4": arg.description,
|
|
104
|
+
"p5": arg.storage_connection_id,
|
|
105
|
+
"p6": arg.metadata,
|
|
106
|
+
},
|
|
107
|
+
)
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: weave-python
|
|
3
|
+
Version: 0.30.3
|
|
4
|
+
Author: Weave Labs
|
|
5
|
+
License: FCL-1.0-ALv2
|
|
6
|
+
License-File: LICENSE
|
|
7
|
+
Requires-Python: >=3.10
|
|
8
|
+
Requires-Dist: protobuf>=6.30.2
|
|
9
|
+
Requires-Dist: sqlalchemy>=2.0.40
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
|
|
12
|
+
# Weave Python SDK
|
|
13
|
+
|
|
14
|
+
Weave Python provides client utilities for integrating with Weave platform services,
|
|
15
|
+
covering authentication, generation, synthesis, storage, and more. It is intended
|
|
16
|
+
for Python applications that need to orchestrate Weave workflows without managing
|
|
17
|
+
low-level HTTP plumbing.
|
|
18
|
+
|
|
19
|
+
## Installation
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
pip install weave-python
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
The package requires Python 3.10 or newer.
|
|
26
|
+
|
|
27
|
+
## Quick Start
|
|
28
|
+
|
|
29
|
+
```python
|
|
30
|
+
from weave.weaveapi import auth, generate
|
|
31
|
+
|
|
32
|
+
# Authenticate with your Weave credentials
|
|
33
|
+
session = auth.login_with_api_key("your-api-key")
|
|
34
|
+
|
|
35
|
+
# Send a generation request
|
|
36
|
+
result = generate.text(session=session, prompt="Hello Weave!")
|
|
37
|
+
print(result.text)
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Refer to the individual subpackages under `weave.weaveapi` (for example `auth`,
|
|
41
|
+
`synthesize`, `storage`, and `payment`) for domain-specific helpers.
|
|
42
|
+
|
|
43
|
+
## Contributing
|
|
44
|
+
|
|
45
|
+
1. Create a virtual environment and install dev dependencies with `uv pip sync uv.lock`.
|
|
46
|
+
2. Run formatting and linting via `task format` and `task lint`.
|
|
47
|
+
3. Open a pull request with context on the workflow or service you changed.
|
|
48
|
+
|
|
49
|
+
## License
|
|
50
|
+
|
|
51
|
+
Distributed under the Apache Software License and MIT License. See `LICENSE` for
|
|
52
|
+
additional licensing details.
|