dc-python-sdk 1.5.26__tar.gz → 1.5.28__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.
- {dc_python_sdk-1.5.26/src/dc_python_sdk.egg-info → dc_python_sdk-1.5.28}/PKG-INFO +1 -1
- {dc_python_sdk-1.5.26 → dc_python_sdk-1.5.28}/pyproject.toml +1 -1
- {dc_python_sdk-1.5.26 → dc_python_sdk-1.5.28}/setup.cfg +1 -1
- {dc_python_sdk-1.5.26 → dc_python_sdk-1.5.28/src/dc_python_sdk.egg-info}/PKG-INFO +1 -1
- {dc_python_sdk-1.5.26 → dc_python_sdk-1.5.28}/src/dc_sdk/src/ai_http.py +42 -23
- {dc_python_sdk-1.5.26 → dc_python_sdk-1.5.28}/LICENSE +0 -0
- {dc_python_sdk-1.5.26 → dc_python_sdk-1.5.28}/README.md +0 -0
- {dc_python_sdk-1.5.26 → dc_python_sdk-1.5.28}/src/dc_python_sdk.egg-info/SOURCES.txt +0 -0
- {dc_python_sdk-1.5.26 → dc_python_sdk-1.5.28}/src/dc_python_sdk.egg-info/dependency_links.txt +0 -0
- {dc_python_sdk-1.5.26 → dc_python_sdk-1.5.28}/src/dc_python_sdk.egg-info/entry_points.txt +0 -0
- {dc_python_sdk-1.5.26 → dc_python_sdk-1.5.28}/src/dc_python_sdk.egg-info/requires.txt +0 -0
- {dc_python_sdk-1.5.26 → dc_python_sdk-1.5.28}/src/dc_python_sdk.egg-info/top_level.txt +0 -0
- {dc_python_sdk-1.5.26 → dc_python_sdk-1.5.28}/src/dc_sdk/__init__.py +0 -0
- {dc_python_sdk-1.5.26 → dc_python_sdk-1.5.28}/src/dc_sdk/app.py +0 -0
- {dc_python_sdk-1.5.26 → dc_python_sdk-1.5.28}/src/dc_sdk/cli.py +0 -0
- {dc_python_sdk-1.5.26 → dc_python_sdk-1.5.28}/src/dc_sdk/errors.py +0 -0
- {dc_python_sdk-1.5.26 → dc_python_sdk-1.5.28}/src/dc_sdk/handler.py +0 -0
- {dc_python_sdk-1.5.26 → dc_python_sdk-1.5.28}/src/dc_sdk/src/__init__.py +0 -0
- {dc_python_sdk-1.5.26 → dc_python_sdk-1.5.28}/src/dc_sdk/src/ai.py +0 -0
- {dc_python_sdk-1.5.26 → dc_python_sdk-1.5.28}/src/dc_sdk/src/mapping.py +0 -0
- {dc_python_sdk-1.5.26 → dc_python_sdk-1.5.28}/src/dc_sdk/src/models/__init__.py +0 -0
- {dc_python_sdk-1.5.26 → dc_python_sdk-1.5.28}/src/dc_sdk/src/models/enums.py +0 -0
- {dc_python_sdk-1.5.26 → dc_python_sdk-1.5.28}/src/dc_sdk/src/models/errors.py +0 -0
- {dc_python_sdk-1.5.26 → dc_python_sdk-1.5.28}/src/dc_sdk/src/models/log_templates.py +0 -0
- {dc_python_sdk-1.5.26 → dc_python_sdk-1.5.28}/src/dc_sdk/src/models/pipeline_details.py +0 -0
- {dc_python_sdk-1.5.26 → dc_python_sdk-1.5.28}/src/dc_sdk/src/pipeline.py +0 -0
- {dc_python_sdk-1.5.26 → dc_python_sdk-1.5.28}/src/dc_sdk/src/server.py +0 -0
- {dc_python_sdk-1.5.26 → dc_python_sdk-1.5.28}/src/dc_sdk/src/services/__init__.py +0 -0
- {dc_python_sdk-1.5.26 → dc_python_sdk-1.5.28}/src/dc_sdk/src/services/api.py +0 -0
- {dc_python_sdk-1.5.26 → dc_python_sdk-1.5.28}/src/dc_sdk/src/services/aws.py +0 -0
- {dc_python_sdk-1.5.26 → dc_python_sdk-1.5.28}/src/dc_sdk/src/services/environment.py +0 -0
- {dc_python_sdk-1.5.26 → dc_python_sdk-1.5.28}/src/dc_sdk/src/services/loader.py +0 -0
- {dc_python_sdk-1.5.26 → dc_python_sdk-1.5.28}/src/dc_sdk/src/services/logger.py +0 -0
- {dc_python_sdk-1.5.26 → dc_python_sdk-1.5.28}/src/dc_sdk/src/services/session.py +0 -0
- {dc_python_sdk-1.5.26 → dc_python_sdk-1.5.28}/src/dc_sdk/types.py +0 -0
|
@@ -17,6 +17,44 @@ app = FastAPI()
|
|
|
17
17
|
|
|
18
18
|
_DEFAULT_PROCESS_TTL_SECONDS = 600.0
|
|
19
19
|
|
|
20
|
+
METHOD_CONTEXT = {
|
|
21
|
+
"authenticate": "Authenticate using self.credentials. Return True when authentication is successful, otherwise raise a meaningful error.",
|
|
22
|
+
"get_objects": "Return a list of object dictionaries with keys: object_id, object_name, object_label, and optional object_group/visible.",
|
|
23
|
+
"get_fields": "Return a list of field dictionaries for an object_id with keys: field_id, field_name, field_label, and optional metadata like data_type/size.",
|
|
24
|
+
"get_data": "Return paginated data in shape {'next_page': <token_or_none>, 'data': [row_dict, ...]}. Respect object_id, field_ids, n_rows, filters, next_page.",
|
|
25
|
+
"load_data": "Load mapped destination rows into object_id using mapping m and update_method. Return True on success or raise a specific load/write error.",
|
|
26
|
+
"close": "Close open sessions/connections safely. Should not fail when resources were never initialized.",
|
|
27
|
+
"FOLLOWUP": "Refine output quality based on user follow-up feedback after a method succeeds.",
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
REQUIRED_METHODS = [
|
|
31
|
+
"authenticate",
|
|
32
|
+
"get_objects",
|
|
33
|
+
"get_fields",
|
|
34
|
+
"get_data",
|
|
35
|
+
"load_data",
|
|
36
|
+
"close",
|
|
37
|
+
]
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
METHOD_SHAPE_REFERENCE = """
|
|
41
|
+
Reference behavior patterns (from production connectors like PostgreSQL):
|
|
42
|
+
- authenticate(self) -> bool
|
|
43
|
+
- validates credentials and initializes client/connection state.
|
|
44
|
+
- get_objects(self) -> list[dict]
|
|
45
|
+
- each object has: object_id, object_name, object_label, optional object_group.
|
|
46
|
+
- if we need to hardcode the objects, we should not do it here. Instead return an empty list with a comment that says objects pulled from API.
|
|
47
|
+
- get_fields(self, object_id, options=dict()) -> list[dict]
|
|
48
|
+
- each field has: field_id, field_name, field_label, optional data_type/size.
|
|
49
|
+
- get_data(self, object_id, field_ids, n_rows=None, filters=None, next_page=None, options=dict()) -> dict
|
|
50
|
+
- returns {"next_page": token_or_none, "data": [row_dict, ...]}.
|
|
51
|
+
- load_data(self, data, object_id, m, update_method, batch_number: int, total_batches: int) -> bool
|
|
52
|
+
- maps/transforms rows and writes data to destination object.
|
|
53
|
+
- close(self) -> None
|
|
54
|
+
- gracefully closes resources (session/connection/tunnel/etc).
|
|
55
|
+
"""
|
|
56
|
+
|
|
57
|
+
|
|
20
58
|
# Default ports: connector HTTP (dc-sdk http) 5000, AI FastAPI 5001, code-server 5002.
|
|
21
59
|
CONNECTOR_PORT = os.getenv("CONNECTOR_PORT", 5000)
|
|
22
60
|
AI_PORT = os.getenv("AI_PORT", 5001)
|
|
@@ -60,7 +98,7 @@ class ChatMessage(BaseModel):
|
|
|
60
98
|
class FeedbackRequest(BaseModel):
|
|
61
99
|
credentials: Dict
|
|
62
100
|
feedback: str
|
|
63
|
-
connector_context:
|
|
101
|
+
connector_context: ConnectorContext
|
|
64
102
|
failed_stage: Optional[str] = None
|
|
65
103
|
# Prior turns from last response’s ai_messages; new user content is only req.feedback this round.
|
|
66
104
|
ai_messages: Optional[List[ChatMessage]] = None
|
|
@@ -71,7 +109,7 @@ class FeedbackRequest(BaseModel):
|
|
|
71
109
|
class RunRequest(BaseModel):
|
|
72
110
|
credentials: List[Dict]
|
|
73
111
|
max_attempts: Optional[int] = 5
|
|
74
|
-
connector_context:
|
|
112
|
+
connector_context: ConnectorContext
|
|
75
113
|
ai_messages: Optional[List[ChatMessage]] = None
|
|
76
114
|
# When objects_dynamic is false: required — every id must appear in get_objects results.
|
|
77
115
|
# When objects_dynamic is true and get_objects returns []: required — used to probe get_fields/get_data.
|
|
@@ -98,21 +136,8 @@ def read_connector():
|
|
|
98
136
|
with open(f"{workspace}/src/connector.py", "r") as f:
|
|
99
137
|
return f.read()
|
|
100
138
|
|
|
101
|
-
def _resolved_connector_context(
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
merged: Dict[str, Any] = {
|
|
105
|
-
"name": defaults["name"],
|
|
106
|
-
"auth_type": defaults["auth_type"],
|
|
107
|
-
"base_url": defaults["base_url"],
|
|
108
|
-
"objects_dynamic": False,
|
|
109
|
-
"notes": None,
|
|
110
|
-
}
|
|
111
|
-
if opt is not None:
|
|
112
|
-
for key, value in opt.model_dump(exclude_unset=True).items():
|
|
113
|
-
if value is not None:
|
|
114
|
-
merged[key] = value
|
|
115
|
-
return ConnectorContext(**merged)
|
|
139
|
+
def _resolved_connector_context(ctx: ConnectorContext) -> ConnectorContext:
|
|
140
|
+
return ctx
|
|
116
141
|
|
|
117
142
|
def _chat_messages_to_openai(messages: Optional[List[ChatMessage]]) -> List[Dict[str, str]]:
|
|
118
143
|
if not messages:
|
|
@@ -338,12 +363,6 @@ def _build_full_fix_prompt(
|
|
|
338
363
|
stage: Optional[str],
|
|
339
364
|
connector_context: ConnectorContext,
|
|
340
365
|
) -> str:
|
|
341
|
-
from dc_sdk.src.ai import (
|
|
342
|
-
METHOD_CONTEXT,
|
|
343
|
-
METHOD_SHAPE_REFERENCE,
|
|
344
|
-
REQUIRED_METHODS,
|
|
345
|
-
)
|
|
346
|
-
|
|
347
366
|
extra_block = ""
|
|
348
367
|
if connector_context.notes:
|
|
349
368
|
extra_block = f"\nAdditional connector details:\n{connector_context.notes}\n"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{dc_python_sdk-1.5.26 → dc_python_sdk-1.5.28}/src/dc_python_sdk.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|