Skip to content

Commit 11fc252

Browse files
authored
Workflow Endpoint: all connectors - deprecate ConfigInput and ConnectorType across all code examples (#707)
1 parent 018fe87 commit 11fc252

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+496
-706
lines changed

api-reference/workflow/overview.mdx

Lines changed: 39 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -272,15 +272,14 @@ To get this ID, see [Sources](/api-reference/workflow/sources/overview).
272272
273273
from unstructured_client import UnstructuredClient
274274
from unstructured_client.models.operations import ListSourcesRequest
275-
from unstructured_client.models.shared import SourceConnectorType
276-
275+
277276
client = UnstructuredClient(
278277
api_key_auth=os.getenv("UNSTRUCTURED_API_KEY")
279278
)
280279
281280
response = client.sources.list_sources(
282281
request=ListSourcesRequest(
283-
source_type=SourceConnectorType.<type> # Optional, list only for this source type.
282+
source_type="<type>" # Optional, list only for this source type.
284283
)
285284
)
286285
@@ -301,16 +300,15 @@ To get this ID, see [Sources](/api-reference/workflow/sources/overview).
301300

302301
from unstructured_client import UnstructuredClient
303302
from unstructured_client.models.operations import ListSourcesRequest
304-
from unstructured_client.models.shared import SourceConnectorType
305-
303+
306304
async def list_sources():
307305
client = UnstructuredClient(
308306
api_key_auth=os.getenv("UNSTRUCTURED_API_KEY")
309307
)
310308

311309
response = await client.sources.list_sources_async(
312310
request=ListSourcesRequest(
313-
source_type=SourceConnectorType.<type> # Optional, list only for this source type.
311+
source_type="<type>" # Optional, list only for this source type.
314312
)
315313
)
316314

@@ -471,22 +469,18 @@ To get this ID, see [Sources](/api-reference/workflow/sources/overview).
471469

472470
from unstructured_client import UnstructuredClient
473471
from unstructured_client.models.operations import CreateSourceRequest
474-
from unstructured_client.models.shared import (
475-
CreateSourceConnector,
476-
SourceConnectorType,
477-
<type>SourceConnectorConfigInput
478-
)
472+
from unstructured_client.models.shared import CreateSourceConnector
479473

480474
client = UnstructuredClient(
481475
api_key_auth=os.getenv("UNSTRUCTURED_API_KEY")
482476
)
483477

484-
destination_connector = CreateSourceConnector(
478+
source_connector = CreateSourceConnector(
485479
name="<name>",
486-
type=SourceConnectorType.<type>,
487-
config=<type>SourceConnectorConfigInput(
480+
type="<type>",
481+
config={
488482
# Specify the settings for the connector here.
489-
)
483+
}
490484
)
491485

492486
response = client.sources.create_source(
@@ -512,11 +506,7 @@ To get this ID, see [Sources](/api-reference/workflow/sources/overview).
512506

513507
from unstructured_client import UnstructuredClient
514508
from unstructured_client.models.operations import CreateSourceRequest
515-
from unstructured_client.models.shared import (
516-
CreateSourceConnector,
517-
SourceConnectorType,
518-
<type>SourceConnectorConfigInput
519-
)
509+
from unstructured_client.models.shared import CreateSourceConnector
520510

521511
async def create_source():
522512
client = UnstructuredClient(
@@ -525,10 +515,10 @@ To get this ID, see [Sources](/api-reference/workflow/sources/overview).
525515

526516
source_connector = CreateSourceConnector(
527517
name="<name>",
528-
type=SourceConnectorType.<type>,
529-
config=<type>SourceConnectorConfigInput(
518+
type="<type>",
519+
config={
530520
# Specify the settings for the connector here.
531-
)
521+
}
532522
)
533523

534524
response = await client.sources.create_source_async(
@@ -604,19 +594,16 @@ You can change any of the connector's settings except for its `name` and `type`.
604594

605595
from unstructured_client import UnstructuredClient
606596
from unstructured_client.models.operations import UpdateSourceRequest
607-
from unstructured_client.models.shared import (
608-
UpdateSourceConnector,
609-
<type>SourceConnectorConfigInput
610-
)
597+
from unstructured_client.models.shared import UpdateSourceConnector
611598

612599
client = UnstructuredClient(
613600
api_key_auth=os.getenv("UNSTRUCTURED_API_KEY")
614601
)
615602

616603
source_connector = UpdateSourceConnector(
617-
config=<type>SourceConnectorConfigInput(
604+
config={
618605
# Specify the settings for the connector here.
619-
)
606+
}
620607
)
621608

622609
response = client.sources.update_source(
@@ -643,20 +630,17 @@ You can change any of the connector's settings except for its `name` and `type`.
643630

644631
from unstructured_client import UnstructuredClient
645632
from unstructured_client.models.operations import UpdateSourceRequest
646-
from unstructured_client.models.shared import (
647-
UpdateSourceConnector,
648-
<type>SourceConnectorConfigInput
649-
)
650-
633+
from unstructured_client.models.shared import UpdateSourceConnector
634+
651635
async def update_source():
652636
client = UnstructuredClient(
653637
api_key_auth=os.getenv("UNSTRUCTURED_API_KEY")
654638
)
655639

656640
source_connector = UpdateSourceConnector(
657-
config=<type>SourceConnectorConfigInput(
641+
config={
658642
# Specify the settings for the connector here.
659-
)
643+
}
660644
)
661645

662646
response = await client.sources.update_source_async(
@@ -867,15 +851,14 @@ To get this ID, see [Destinations](/api-reference/workflow/destinations/overview
867851

868852
from unstructured_client import UnstructuredClient
869853
from unstructured_client.models.operations import ListDestinationsRequest
870-
from unstructured_client.models.shared import DestinationConnectorType
871-
854+
872855
client = UnstructuredClient(
873856
api_key_auth=os.getenv("UNSTRUCTURED_API_KEY")
874857
)
875858

876859
response = client.destinations.list_destinations(
877860
request=ListDestinationsRequest(
878-
destination_type=DestinationConnectorType.<type> # Optional, list only for this destination type.
861+
destination_type="<type>" # Optional, list only for this destination type.
879862
)
880863
)
881864

@@ -896,16 +879,15 @@ To get this ID, see [Destinations](/api-reference/workflow/destinations/overview
896879

897880
from unstructured_client import UnstructuredClient
898881
from unstructured_client.models.operations import ListDestinationsRequest
899-
from unstructured_client.models.shared import DestinationConnectorType
900-
882+
901883
async def list_destinations():
902884
client = UnstructuredClient(
903885
api_key_auth=os.getenv("UNSTRUCTURED_API_KEY")
904886
)
905887

906888
response = await client.destinations.list_destinations_async(
907889
request=ListDestinationsRequest(
908-
destination_type=DestinationConnectorType.<type> # Optional, list only for this destination type.
890+
destination_type="<type>" # Optional, list only for this destination type.
909891
)
910892
)
911893

@@ -1065,22 +1047,18 @@ To get this ID, see [Destinations](/api-reference/workflow/destinations/overview
10651047

10661048
from unstructured_client import UnstructuredClient
10671049
from unstructured_client.models.operations import CreateDestinationRequest
1068-
from unstructured_client.models.shared import (
1069-
CreateDestinationConnector,
1070-
DestinationConnectorType,
1071-
<type>DestinationConnectorConfigInput
1072-
)
1050+
from unstructured_client.models.shared import CreateDestinationConnector
10731051

10741052
client = UnstructuredClient(
10751053
api_key_auth=os.getenv("UNSTRUCTURED_API_KEY")
10761054
)
10771055

10781056
destination_connector = CreateDestinationConnector(
10791057
name="<name>",
1080-
type=DestinationConnectorType.<type>,
1081-
config=<type>DestinationConnectorConfigInput(
1058+
type="<type>",
1059+
config={
10821060
# Specify the settings for the connector here.
1083-
)
1061+
}
10841062
)
10851063

10861064
response = client.destinations.create_destination(
@@ -1105,23 +1083,19 @@ To get this ID, see [Destinations](/api-reference/workflow/destinations/overview
11051083

11061084
from unstructured_client import UnstructuredClient
11071085
from unstructured_client.models.operations import CreateDestinationRequest
1108-
from unstructured_client.models.shared import (
1109-
CreateDestinationConnector,
1110-
DestinationConnectorType,
1111-
<type>DestinationConnectorConfigInput
1112-
)
1086+
from unstructured_client.models.shared import CreateDestinationConnector
11131087

11141088
async def create_destination():
11151089
client = UnstructuredClient(
11161090
api_key_auth=os.getenv("UNSTRUCTURED_API_KEY")
11171091
)
11181092

11191093
destination_connector = CreateDestinationConnector(
1120-
name="my-s3-connector",
1121-
type=DestinationConnectorType.<type>,
1122-
config=<type>DestinationConnectorConfigInput(
1094+
name="<name>",
1095+
type="<type>",
1096+
config={
11231097
# Specify the settings for the connector here.
1124-
)
1098+
}
11251099
)
11261100

11271101
response = await client.destinations.create_destination_async(
@@ -1194,19 +1168,16 @@ You can change any of the connector's settings except for its `name` and `type`.
11941168

11951169
from unstructured_client import UnstructuredClient
11961170
from unstructured_client.models.operations import UpdateDestinationRequest
1197-
from unstructured_client.models.shared import (
1198-
UpdateDestinationConnector,
1199-
<type>DestinationConnectorConfigInput
1200-
)
1171+
from unstructured_client.models.shared import UpdateDestinationConnector
12011172

12021173
client = UnstructuredClient(
12031174
api_key_auth=os.getenv("UNSTRUCTURED_API_KEY")
12041175
)
12051176

12061177
destination_connector = UpdateDestinationConnector(
1207-
config=<type>DestinationConnectorConfigInput(
1178+
config={
12081179
# Specify the settings for the connector here.
1209-
)
1180+
}
12101181
)
12111182

12121183
response = client.destinations.update_destination(
@@ -1232,20 +1203,17 @@ You can change any of the connector's settings except for its `name` and `type`.
12321203

12331204
from unstructured_client import UnstructuredClient
12341205
from unstructured_client.models.operations import UpdateDestinationRequest
1235-
from unstructured_client.models.shared import (
1236-
UpdateDestinationConnector,
1237-
<type>DestinationConnectorConfigInput
1238-
)
1206+
from unstructured_client.models.shared import UpdateDestinationConnector
12391207

12401208
async def update_destination():
12411209
client = UnstructuredClient(
12421210
api_key_auth=os.getenv("UNSTRUCTURED_API_KEY")
12431211
)
12441212

12451213
destination_connector = UpdateDestinationConnector(
1246-
config=<type>DestinationConnectorConfigInput(
1214+
config={
12471215
# Specify the settings for the connector here.
1248-
)
1216+
}
12491217
)
12501218

12511219
response = await client.destinations.update_destination_async(

examplecode/tools/mcp.mdx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,7 @@ You are now ready to start coding.
140140
ListSourcesRequest,
141141
GetSourceRequest
142142
)
143-
from unstructured_client.models.shared import SourceConnectorType
144-
143+
145144
def load_environment_variables() -> None:
146145
"""
147146
Loads environment variables from a .env file and checks for required variables.
@@ -209,7 +208,7 @@ You are now ready to start coding.
209208

210209
if source_type:
211210
try:
212-
request.source_type = SourceConnectorType[source_type]
211+
request.source_type = [source_type]
213212
except KeyError:
214213
return f"Invalid source type: {source_type}"
215214

snippets/destination_connectors/astradb_sdk.mdx

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,22 @@ import os
33

44
from unstructured_client import UnstructuredClient
55
from unstructured_client.models.operations import CreateDestinationRequest
6-
from unstructured_client.models.shared import (
7-
CreateDestinationConnector,
8-
DestinationConnectorType,
9-
AstraDBConnectorConfigInput
10-
)
6+
from unstructured_client.models.shared import CreateDestinationConnector
117

128
with UnstructuredClient(api_key_auth=os.getenv("UNSTRUCTURED_API_KEY")) as client:
139
response = client.destinations.create_destination(
1410
request=CreateDestinationRequest(
1511
create_destination_connector=CreateDestinationConnector(
1612
name="<name>",
17-
type=DestinationConnectorType.ASTRADB,
18-
config=AstraDBConnectorConfigInput(
19-
token="<token>",
20-
api_endpoint="<api-endpoint>",
21-
collection_name="<collection-name>",
22-
keyspace="<keyspace>",
23-
batch_size=<batch-size>,
24-
flatten_metadata=<True|False>
25-
)
13+
type="astradb",
14+
config={
15+
"token": "<token>",
16+
"api_endpoint": "<api-endpoint>",
17+
"collection_name": "<collection-name>",
18+
"keyspace=": "<keyspace>",
19+
"batch_size": <batch-size>,
20+
"flatten_metadata": <True|False>
21+
}
2622
)
2723
)
2824
)

snippets/destination_connectors/azure_ai_search_sdk.mdx

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,19 @@ import os
33

44
from unstructured_client import UnstructuredClient
55
from unstructured_client.models.operations import CreateDestinationRequest
6-
from unstructured_client.models.shared import (
7-
CreateDestinationConnector,
8-
DestinationConnectorType,
9-
AzureAISearchConnectorConfigInput
10-
)
6+
from unstructured_client.models.shared import CreateDestinationConnector
117

128
with UnstructuredClient(api_key_auth=os.getenv("UNSTRUCTURED_API_KEY")) as client:
139
response = client.destinations.create_destination(
1410
request=CreateDestinationRequest(
1511
create_destination_connector=CreateDestinationConnector(
1612
name="<name>",
17-
type=DestinationConnectorType.AZURE_AI_SEARCH,
18-
config=AzureAISearchConnectorConfigInput(
19-
endpoint="<endpoint>",
20-
index="<index>",
21-
key="<azure-ai-search-key>"
22-
)
13+
type="azure_ai_search",
14+
config={
15+
"endpoint": "<endpoint>",
16+
"index": "<index>",
17+
"key": "<azure-ai-search-key>"
18+
}
2319
)
2420
)
2521
)

0 commit comments

Comments
 (0)