airbyte-agent-amazon-ads 0.1.5__tar.gz → 0.1.9__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.
- {airbyte_agent_amazon_ads-0.1.5 → airbyte_agent_amazon_ads-0.1.9}/AUTH.md +2 -2
- {airbyte_agent_amazon_ads-0.1.5 → airbyte_agent_amazon_ads-0.1.9}/CHANGELOG.md +20 -0
- {airbyte_agent_amazon_ads-0.1.5 → airbyte_agent_amazon_ads-0.1.9}/PKG-INFO +7 -6
- {airbyte_agent_amazon_ads-0.1.5 → airbyte_agent_amazon_ads-0.1.9}/README.md +6 -5
- {airbyte_agent_amazon_ads-0.1.5 → airbyte_agent_amazon_ads-0.1.9}/REFERENCE.md +71 -1
- {airbyte_agent_amazon_ads-0.1.5 → airbyte_agent_amazon_ads-0.1.9}/airbyte_agent_amazon_ads/__init__.py +20 -2
- {airbyte_agent_amazon_ads-0.1.5 → airbyte_agent_amazon_ads-0.1.9}/airbyte_agent_amazon_ads/_vendored/connector_sdk/connector_model_loader.py +84 -0
- {airbyte_agent_amazon_ads-0.1.5 → airbyte_agent_amazon_ads-0.1.9}/airbyte_agent_amazon_ads/_vendored/connector_sdk/executor/local_executor.py +3 -1
- {airbyte_agent_amazon_ads-0.1.5 → airbyte_agent_amazon_ads-0.1.9}/airbyte_agent_amazon_ads/_vendored/connector_sdk/introspection.py +222 -10
- {airbyte_agent_amazon_ads-0.1.5 → airbyte_agent_amazon_ads-0.1.9}/airbyte_agent_amazon_ads/_vendored/connector_sdk/schema/base.py +34 -2
- {airbyte_agent_amazon_ads-0.1.5 → airbyte_agent_amazon_ads-0.1.9}/airbyte_agent_amazon_ads/_vendored/connector_sdk/schema/components.py +5 -0
- {airbyte_agent_amazon_ads-0.1.5 → airbyte_agent_amazon_ads-0.1.9}/airbyte_agent_amazon_ads/_vendored/connector_sdk/schema/extensions.py +71 -0
- {airbyte_agent_amazon_ads-0.1.5 → airbyte_agent_amazon_ads-0.1.9}/airbyte_agent_amazon_ads/_vendored/connector_sdk/types.py +1 -0
- {airbyte_agent_amazon_ads-0.1.5 → airbyte_agent_amazon_ads-0.1.9}/airbyte_agent_amazon_ads/connector.py +166 -38
- {airbyte_agent_amazon_ads-0.1.5 → airbyte_agent_amazon_ads-0.1.9}/airbyte_agent_amazon_ads/connector_model.py +1144 -2
- {airbyte_agent_amazon_ads-0.1.5 → airbyte_agent_amazon_ads-0.1.9}/airbyte_agent_amazon_ads/models.py +55 -0
- airbyte_agent_amazon_ads-0.1.9/airbyte_agent_amazon_ads/types.py +238 -0
- {airbyte_agent_amazon_ads-0.1.5 → airbyte_agent_amazon_ads-0.1.9}/pyproject.toml +1 -1
- airbyte_agent_amazon_ads-0.1.5/airbyte_agent_amazon_ads/types.py +0 -48
- {airbyte_agent_amazon_ads-0.1.5 → airbyte_agent_amazon_ads-0.1.9}/.gitignore +0 -0
- {airbyte_agent_amazon_ads-0.1.5 → airbyte_agent_amazon_ads-0.1.9}/airbyte_agent_amazon_ads/_vendored/__init__.py +0 -0
- {airbyte_agent_amazon_ads-0.1.5 → airbyte_agent_amazon_ads-0.1.9}/airbyte_agent_amazon_ads/_vendored/connector_sdk/__init__.py +0 -0
- {airbyte_agent_amazon_ads-0.1.5 → airbyte_agent_amazon_ads-0.1.9}/airbyte_agent_amazon_ads/_vendored/connector_sdk/auth_strategies.py +0 -0
- {airbyte_agent_amazon_ads-0.1.5 → airbyte_agent_amazon_ads-0.1.9}/airbyte_agent_amazon_ads/_vendored/connector_sdk/auth_template.py +0 -0
- {airbyte_agent_amazon_ads-0.1.5 → airbyte_agent_amazon_ads-0.1.9}/airbyte_agent_amazon_ads/_vendored/connector_sdk/cloud_utils/__init__.py +0 -0
- {airbyte_agent_amazon_ads-0.1.5 → airbyte_agent_amazon_ads-0.1.9}/airbyte_agent_amazon_ads/_vendored/connector_sdk/cloud_utils/client.py +0 -0
- {airbyte_agent_amazon_ads-0.1.5 → airbyte_agent_amazon_ads-0.1.9}/airbyte_agent_amazon_ads/_vendored/connector_sdk/constants.py +0 -0
- {airbyte_agent_amazon_ads-0.1.5 → airbyte_agent_amazon_ads-0.1.9}/airbyte_agent_amazon_ads/_vendored/connector_sdk/exceptions.py +0 -0
- {airbyte_agent_amazon_ads-0.1.5 → airbyte_agent_amazon_ads-0.1.9}/airbyte_agent_amazon_ads/_vendored/connector_sdk/executor/__init__.py +0 -0
- {airbyte_agent_amazon_ads-0.1.5 → airbyte_agent_amazon_ads-0.1.9}/airbyte_agent_amazon_ads/_vendored/connector_sdk/executor/hosted_executor.py +0 -0
- {airbyte_agent_amazon_ads-0.1.5 → airbyte_agent_amazon_ads-0.1.9}/airbyte_agent_amazon_ads/_vendored/connector_sdk/executor/models.py +0 -0
- {airbyte_agent_amazon_ads-0.1.5 → airbyte_agent_amazon_ads-0.1.9}/airbyte_agent_amazon_ads/_vendored/connector_sdk/extensions.py +0 -0
- {airbyte_agent_amazon_ads-0.1.5 → airbyte_agent_amazon_ads-0.1.9}/airbyte_agent_amazon_ads/_vendored/connector_sdk/http/__init__.py +0 -0
- {airbyte_agent_amazon_ads-0.1.5 → airbyte_agent_amazon_ads-0.1.9}/airbyte_agent_amazon_ads/_vendored/connector_sdk/http/adapters/__init__.py +0 -0
- {airbyte_agent_amazon_ads-0.1.5 → airbyte_agent_amazon_ads-0.1.9}/airbyte_agent_amazon_ads/_vendored/connector_sdk/http/adapters/httpx_adapter.py +0 -0
- {airbyte_agent_amazon_ads-0.1.5 → airbyte_agent_amazon_ads-0.1.9}/airbyte_agent_amazon_ads/_vendored/connector_sdk/http/config.py +0 -0
- {airbyte_agent_amazon_ads-0.1.5 → airbyte_agent_amazon_ads-0.1.9}/airbyte_agent_amazon_ads/_vendored/connector_sdk/http/exceptions.py +0 -0
- {airbyte_agent_amazon_ads-0.1.5 → airbyte_agent_amazon_ads-0.1.9}/airbyte_agent_amazon_ads/_vendored/connector_sdk/http/protocols.py +0 -0
- {airbyte_agent_amazon_ads-0.1.5 → airbyte_agent_amazon_ads-0.1.9}/airbyte_agent_amazon_ads/_vendored/connector_sdk/http/response.py +0 -0
- {airbyte_agent_amazon_ads-0.1.5 → airbyte_agent_amazon_ads-0.1.9}/airbyte_agent_amazon_ads/_vendored/connector_sdk/http_client.py +0 -0
- {airbyte_agent_amazon_ads-0.1.5 → airbyte_agent_amazon_ads-0.1.9}/airbyte_agent_amazon_ads/_vendored/connector_sdk/logging/__init__.py +0 -0
- {airbyte_agent_amazon_ads-0.1.5 → airbyte_agent_amazon_ads-0.1.9}/airbyte_agent_amazon_ads/_vendored/connector_sdk/logging/logger.py +0 -0
- {airbyte_agent_amazon_ads-0.1.5 → airbyte_agent_amazon_ads-0.1.9}/airbyte_agent_amazon_ads/_vendored/connector_sdk/logging/types.py +0 -0
- {airbyte_agent_amazon_ads-0.1.5 → airbyte_agent_amazon_ads-0.1.9}/airbyte_agent_amazon_ads/_vendored/connector_sdk/observability/__init__.py +0 -0
- {airbyte_agent_amazon_ads-0.1.5 → airbyte_agent_amazon_ads-0.1.9}/airbyte_agent_amazon_ads/_vendored/connector_sdk/observability/config.py +0 -0
- {airbyte_agent_amazon_ads-0.1.5 → airbyte_agent_amazon_ads-0.1.9}/airbyte_agent_amazon_ads/_vendored/connector_sdk/observability/models.py +0 -0
- {airbyte_agent_amazon_ads-0.1.5 → airbyte_agent_amazon_ads-0.1.9}/airbyte_agent_amazon_ads/_vendored/connector_sdk/observability/redactor.py +0 -0
- {airbyte_agent_amazon_ads-0.1.5 → airbyte_agent_amazon_ads-0.1.9}/airbyte_agent_amazon_ads/_vendored/connector_sdk/observability/session.py +0 -0
- {airbyte_agent_amazon_ads-0.1.5 → airbyte_agent_amazon_ads-0.1.9}/airbyte_agent_amazon_ads/_vendored/connector_sdk/performance/__init__.py +0 -0
- {airbyte_agent_amazon_ads-0.1.5 → airbyte_agent_amazon_ads-0.1.9}/airbyte_agent_amazon_ads/_vendored/connector_sdk/performance/instrumentation.py +0 -0
- {airbyte_agent_amazon_ads-0.1.5 → airbyte_agent_amazon_ads-0.1.9}/airbyte_agent_amazon_ads/_vendored/connector_sdk/performance/metrics.py +0 -0
- {airbyte_agent_amazon_ads-0.1.5 → airbyte_agent_amazon_ads-0.1.9}/airbyte_agent_amazon_ads/_vendored/connector_sdk/schema/__init__.py +0 -0
- {airbyte_agent_amazon_ads-0.1.5 → airbyte_agent_amazon_ads-0.1.9}/airbyte_agent_amazon_ads/_vendored/connector_sdk/schema/connector.py +0 -0
- {airbyte_agent_amazon_ads-0.1.5 → airbyte_agent_amazon_ads-0.1.9}/airbyte_agent_amazon_ads/_vendored/connector_sdk/schema/operations.py +0 -0
- {airbyte_agent_amazon_ads-0.1.5 → airbyte_agent_amazon_ads-0.1.9}/airbyte_agent_amazon_ads/_vendored/connector_sdk/schema/security.py +0 -0
- {airbyte_agent_amazon_ads-0.1.5 → airbyte_agent_amazon_ads-0.1.9}/airbyte_agent_amazon_ads/_vendored/connector_sdk/secrets.py +0 -0
- {airbyte_agent_amazon_ads-0.1.5 → airbyte_agent_amazon_ads-0.1.9}/airbyte_agent_amazon_ads/_vendored/connector_sdk/telemetry/__init__.py +0 -0
- {airbyte_agent_amazon_ads-0.1.5 → airbyte_agent_amazon_ads-0.1.9}/airbyte_agent_amazon_ads/_vendored/connector_sdk/telemetry/config.py +0 -0
- {airbyte_agent_amazon_ads-0.1.5 → airbyte_agent_amazon_ads-0.1.9}/airbyte_agent_amazon_ads/_vendored/connector_sdk/telemetry/events.py +0 -0
- {airbyte_agent_amazon_ads-0.1.5 → airbyte_agent_amazon_ads-0.1.9}/airbyte_agent_amazon_ads/_vendored/connector_sdk/telemetry/tracker.py +0 -0
- {airbyte_agent_amazon_ads-0.1.5 → airbyte_agent_amazon_ads-0.1.9}/airbyte_agent_amazon_ads/_vendored/connector_sdk/utils.py +0 -0
- {airbyte_agent_amazon_ads-0.1.5 → airbyte_agent_amazon_ads-0.1.9}/airbyte_agent_amazon_ads/_vendored/connector_sdk/validation.py +0 -0
|
@@ -75,7 +75,7 @@ connector = AmazonAdsConnector(
|
|
|
75
75
|
)
|
|
76
76
|
|
|
77
77
|
@agent.tool_plain # assumes you're using Pydantic AI
|
|
78
|
-
@AmazonAdsConnector.
|
|
78
|
+
@AmazonAdsConnector.tool_utils
|
|
79
79
|
async def amazon-ads_execute(entity: str, action: str, params: dict | None = None):
|
|
80
80
|
return await connector.execute(entity, action, params or {})
|
|
81
81
|
```
|
|
@@ -96,7 +96,7 @@ The Amazon-Ads connector requires the following configuration variables. These v
|
|
|
96
96
|
|
|
97
97
|
| Variable | Type | Required | Default | Description |
|
|
98
98
|
|----------|------|----------|---------|-------------|
|
|
99
|
-
| `
|
|
99
|
+
| `region` | `string` | Yes | https://advertising-api.amazon.com | The Amazon Ads API endpoint URL based on region:
|
|
100
100
|
- NA (North America): https://advertising-api.amazon.com
|
|
101
101
|
- EU (Europe): https://advertising-api-eu.amazon.com
|
|
102
102
|
- FE (Far East): https://advertising-api-fe.amazon.com
|
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# Amazon Ads changelog
|
|
2
2
|
|
|
3
|
+
## [0.1.9] - 2026-01-24
|
|
4
|
+
- Updated connector definition (YAML version 1.0.3)
|
|
5
|
+
- Source commit: 609c1d86
|
|
6
|
+
- SDK version: 0.1.0
|
|
7
|
+
|
|
8
|
+
## [0.1.8] - 2026-01-23
|
|
9
|
+
- Updated connector definition (YAML version 1.0.3)
|
|
10
|
+
- Source commit: 6b458f8d
|
|
11
|
+
- SDK version: 0.1.0
|
|
12
|
+
|
|
13
|
+
## [0.1.7] - 2026-01-23
|
|
14
|
+
- Updated connector definition (YAML version 1.0.2)
|
|
15
|
+
- Source commit: 32c5ef46
|
|
16
|
+
- SDK version: 0.1.0
|
|
17
|
+
|
|
18
|
+
## [0.1.6] - 2026-01-23
|
|
19
|
+
- Updated connector definition (YAML version 1.0.1)
|
|
20
|
+
- Source commit: 416466da
|
|
21
|
+
- SDK version: 0.1.0
|
|
22
|
+
|
|
3
23
|
## [0.1.5] - 2026-01-23
|
|
4
24
|
- Updated connector definition (YAML version 1.0.1)
|
|
5
25
|
- Source commit: f17cdd8c
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: airbyte-agent-amazon-ads
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.9
|
|
4
4
|
Summary: Airbyte Amazon-Ads Connector for AI platforms
|
|
5
5
|
Project-URL: Homepage, https://github.com/airbytehq/airbyte-agent-connectors
|
|
6
6
|
Project-URL: Documentation, https://docs.airbyte.com/ai-agents/
|
|
@@ -86,7 +86,7 @@ connector = AmazonAdsConnector(
|
|
|
86
86
|
)
|
|
87
87
|
|
|
88
88
|
@agent.tool_plain # assumes you're using Pydantic AI
|
|
89
|
-
@AmazonAdsConnector.
|
|
89
|
+
@AmazonAdsConnector.tool_utils
|
|
90
90
|
async def amazon-ads_execute(entity: str, action: str, params: dict | None = None):
|
|
91
91
|
return await connector.execute(entity, action, params or {})
|
|
92
92
|
```
|
|
@@ -107,11 +107,12 @@ connector = AmazonAdsConnector(
|
|
|
107
107
|
)
|
|
108
108
|
|
|
109
109
|
@agent.tool_plain # assumes you're using Pydantic AI
|
|
110
|
-
@AmazonAdsConnector.
|
|
110
|
+
@AmazonAdsConnector.tool_utils
|
|
111
111
|
async def amazon-ads_execute(entity: str, action: str, params: dict | None = None):
|
|
112
112
|
return await connector.execute(entity, action, params or {})
|
|
113
113
|
```
|
|
114
114
|
|
|
115
|
+
|
|
115
116
|
## Full documentation
|
|
116
117
|
|
|
117
118
|
This connector supports the following entities and actions.
|
|
@@ -131,6 +132,6 @@ For the service's official API docs, see the [Amazon-Ads API reference](https://
|
|
|
131
132
|
|
|
132
133
|
## Version information
|
|
133
134
|
|
|
134
|
-
- **Package version:** 0.1.
|
|
135
|
-
- **Connector version:** 1.0.
|
|
136
|
-
- **Generated with Connector SDK commit SHA:**
|
|
135
|
+
- **Package version:** 0.1.9
|
|
136
|
+
- **Connector version:** 1.0.3
|
|
137
|
+
- **Generated with Connector SDK commit SHA:** 609c1d86c76b36ff699b57123a5a8c2050d958c3
|
|
@@ -53,7 +53,7 @@ connector = AmazonAdsConnector(
|
|
|
53
53
|
)
|
|
54
54
|
|
|
55
55
|
@agent.tool_plain # assumes you're using Pydantic AI
|
|
56
|
-
@AmazonAdsConnector.
|
|
56
|
+
@AmazonAdsConnector.tool_utils
|
|
57
57
|
async def amazon-ads_execute(entity: str, action: str, params: dict | None = None):
|
|
58
58
|
return await connector.execute(entity, action, params or {})
|
|
59
59
|
```
|
|
@@ -74,11 +74,12 @@ connector = AmazonAdsConnector(
|
|
|
74
74
|
)
|
|
75
75
|
|
|
76
76
|
@agent.tool_plain # assumes you're using Pydantic AI
|
|
77
|
-
@AmazonAdsConnector.
|
|
77
|
+
@AmazonAdsConnector.tool_utils
|
|
78
78
|
async def amazon-ads_execute(entity: str, action: str, params: dict | None = None):
|
|
79
79
|
return await connector.execute(entity, action, params or {})
|
|
80
80
|
```
|
|
81
81
|
|
|
82
|
+
|
|
82
83
|
## Full documentation
|
|
83
84
|
|
|
84
85
|
This connector supports the following entities and actions.
|
|
@@ -98,6 +99,6 @@ For the service's official API docs, see the [Amazon-Ads API reference](https://
|
|
|
98
99
|
|
|
99
100
|
## Version information
|
|
100
101
|
|
|
101
|
-
- **Package version:** 0.1.
|
|
102
|
-
- **Connector version:** 1.0.
|
|
103
|
-
- **Generated with Connector SDK commit SHA:**
|
|
102
|
+
- **Package version:** 0.1.9
|
|
103
|
+
- **Connector version:** 1.0.3
|
|
104
|
+
- **Generated with Connector SDK commit SHA:** 609c1d86c76b36ff699b57123a5a8c2050d958c3
|
|
@@ -8,7 +8,7 @@ The Amazon-Ads connector supports the following entities and actions.
|
|
|
8
8
|
|
|
9
9
|
| Entity | Actions |
|
|
10
10
|
|--------|---------|
|
|
11
|
-
| Profiles | [List](#profiles-list), [Get](#profiles-get) |
|
|
11
|
+
| Profiles | [List](#profiles-list), [Get](#profiles-get), [Search](#profiles-search) |
|
|
12
12
|
| Portfolios | [List](#portfolios-list), [Get](#portfolios-get) |
|
|
13
13
|
| Sponsored Product Campaigns | [List](#sponsored-product-campaigns-list), [Get](#sponsored-product-campaigns-get) |
|
|
14
14
|
|
|
@@ -119,6 +119,75 @@ curl --location 'https://api.airbyte.ai/api/v1/connectors/sources/{your_source_i
|
|
|
119
119
|
| `accountInfo` | `object \| any` | |
|
|
120
120
|
|
|
121
121
|
|
|
122
|
+
</details>
|
|
123
|
+
|
|
124
|
+
### Profiles Search
|
|
125
|
+
|
|
126
|
+
Search and filter profiles records powered by Airbyte's data sync. This often provides additional fields and operators beyond what the API natively supports, making it easier to narrow down results before performing further operations. Only available in hosted mode.
|
|
127
|
+
|
|
128
|
+
#### Python SDK
|
|
129
|
+
|
|
130
|
+
```python
|
|
131
|
+
await amazon_ads.profiles.search(
|
|
132
|
+
query={"filter": {"eq": {"accountInfo": {}}}}
|
|
133
|
+
)
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
#### API
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
curl --location 'https://api.airbyte.ai/api/v1/connectors/sources/{your_source_id}/execute' \
|
|
140
|
+
--header 'Content-Type: application/json' \
|
|
141
|
+
--header 'Authorization: Bearer {your_auth_token}' \
|
|
142
|
+
--data '{
|
|
143
|
+
"entity": "profiles",
|
|
144
|
+
"action": "search",
|
|
145
|
+
"params": {
|
|
146
|
+
"query": {"filter": {"eq": {"accountInfo": {}}}}
|
|
147
|
+
}
|
|
148
|
+
}'
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
#### Parameters
|
|
152
|
+
|
|
153
|
+
| Parameter Name | Type | Required | Description |
|
|
154
|
+
|----------------|------|----------|-------------|
|
|
155
|
+
| `query` | `object` | Yes | Filter and sort conditions. Supports operators: eq, neq, gt, gte, lt, lte, in, like, fuzzy, keyword, not, and, or |
|
|
156
|
+
| `query.filter` | `object` | No | Filter conditions |
|
|
157
|
+
| `query.sort` | `array` | No | Sort conditions |
|
|
158
|
+
| `limit` | `integer` | No | Maximum results to return (default 1000) |
|
|
159
|
+
| `cursor` | `string` | No | Pagination cursor from previous response's next_cursor |
|
|
160
|
+
| `fields` | `array` | No | Field paths to include in results |
|
|
161
|
+
|
|
162
|
+
#### Searchable Fields
|
|
163
|
+
|
|
164
|
+
| Field Name | Type | Description |
|
|
165
|
+
|------------|------|-------------|
|
|
166
|
+
| `accountInfo` | `object` | |
|
|
167
|
+
| `countryCode` | `string` | |
|
|
168
|
+
| `currencyCode` | `string` | |
|
|
169
|
+
| `dailyBudget` | `number` | |
|
|
170
|
+
| `profileId` | `integer` | |
|
|
171
|
+
| `timezone` | `string` | |
|
|
172
|
+
|
|
173
|
+
<details>
|
|
174
|
+
<summary><b>Response Schema</b></summary>
|
|
175
|
+
|
|
176
|
+
| Field Name | Type | Description |
|
|
177
|
+
|------------|------|-------------|
|
|
178
|
+
| `hits` | `array` | List of matching records |
|
|
179
|
+
| `hits[].id` | `string` | Record identifier |
|
|
180
|
+
| `hits[].score` | `number` | Relevance score |
|
|
181
|
+
| `hits[].data` | `object` | Record data containing the searchable fields listed above |
|
|
182
|
+
| `hits[].data.accountInfo` | `object` | |
|
|
183
|
+
| `hits[].data.countryCode` | `string` | |
|
|
184
|
+
| `hits[].data.currencyCode` | `string` | |
|
|
185
|
+
| `hits[].data.dailyBudget` | `number` | |
|
|
186
|
+
| `hits[].data.profileId` | `integer` | |
|
|
187
|
+
| `hits[].data.timezone` | `string` | |
|
|
188
|
+
| `next_cursor` | `string \| null` | Cursor for next page of results |
|
|
189
|
+
| `took_ms` | `number` | Query execution time in milliseconds |
|
|
190
|
+
|
|
122
191
|
</details>
|
|
123
192
|
|
|
124
193
|
## Portfolios
|
|
@@ -311,3 +380,4 @@ curl --location 'https://api.airbyte.ai/api/v1/connectors/sources/{your_source_i
|
|
|
311
380
|
|
|
312
381
|
</details>
|
|
313
382
|
|
|
383
|
+
|
|
@@ -19,7 +19,11 @@ from .models import (
|
|
|
19
19
|
AmazonAdsExecuteResultWithMeta,
|
|
20
20
|
ProfilesListResult,
|
|
21
21
|
PortfoliosListResult,
|
|
22
|
-
SponsoredProductCampaignsListResult
|
|
22
|
+
SponsoredProductCampaignsListResult,
|
|
23
|
+
AirbyteSearchHit,
|
|
24
|
+
AirbyteSearchResult,
|
|
25
|
+
ProfilesSearchData,
|
|
26
|
+
ProfilesSearchResult
|
|
23
27
|
)
|
|
24
28
|
from .types import (
|
|
25
29
|
SponsoredProductCampaignsListParamsStatefilter,
|
|
@@ -28,7 +32,12 @@ from .types import (
|
|
|
28
32
|
PortfoliosListParams,
|
|
29
33
|
PortfoliosGetParams,
|
|
30
34
|
SponsoredProductCampaignsListParams,
|
|
31
|
-
SponsoredProductCampaignsGetParams
|
|
35
|
+
SponsoredProductCampaignsGetParams,
|
|
36
|
+
AirbyteSearchParams,
|
|
37
|
+
AirbyteSortOrder,
|
|
38
|
+
ProfilesSearchFilter,
|
|
39
|
+
ProfilesSearchQuery,
|
|
40
|
+
ProfilesCondition
|
|
32
41
|
)
|
|
33
42
|
|
|
34
43
|
__all__ = [
|
|
@@ -47,6 +56,10 @@ __all__ = [
|
|
|
47
56
|
"ProfilesListResult",
|
|
48
57
|
"PortfoliosListResult",
|
|
49
58
|
"SponsoredProductCampaignsListResult",
|
|
59
|
+
"AirbyteSearchHit",
|
|
60
|
+
"AirbyteSearchResult",
|
|
61
|
+
"ProfilesSearchData",
|
|
62
|
+
"ProfilesSearchResult",
|
|
50
63
|
"SponsoredProductCampaignsListParamsStatefilter",
|
|
51
64
|
"ProfilesListParams",
|
|
52
65
|
"ProfilesGetParams",
|
|
@@ -54,4 +67,9 @@ __all__ = [
|
|
|
54
67
|
"PortfoliosGetParams",
|
|
55
68
|
"SponsoredProductCampaignsListParams",
|
|
56
69
|
"SponsoredProductCampaignsGetParams",
|
|
70
|
+
"AirbyteSearchParams",
|
|
71
|
+
"AirbyteSortOrder",
|
|
72
|
+
"ProfilesSearchFilter",
|
|
73
|
+
"ProfilesSearchQuery",
|
|
74
|
+
"ProfilesCondition",
|
|
57
75
|
]
|
|
@@ -145,6 +145,87 @@ def _deproxy_schema(obj: Any) -> Any:
|
|
|
145
145
|
return obj
|
|
146
146
|
|
|
147
147
|
|
|
148
|
+
def _type_includes(type_value: Any, target: str) -> bool:
|
|
149
|
+
if isinstance(type_value, list):
|
|
150
|
+
return target in type_value
|
|
151
|
+
return type_value == target
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
def _flatten_cache_properties(properties: dict[str, Any], prefix: str) -> list[str]:
|
|
155
|
+
entries: list[str] = []
|
|
156
|
+
for prop_name, prop in properties.items():
|
|
157
|
+
path = f"{prefix}{prop_name}" if prefix else prop_name
|
|
158
|
+
entries.append(path)
|
|
159
|
+
|
|
160
|
+
prop_type = getattr(prop, "type", None) if not isinstance(prop, dict) else prop.get("type")
|
|
161
|
+
prop_properties = getattr(prop, "properties", None) if not isinstance(prop, dict) else prop.get("properties")
|
|
162
|
+
|
|
163
|
+
if _type_includes(prop_type, "array"):
|
|
164
|
+
array_path = f"{path}[]"
|
|
165
|
+
entries.append(array_path)
|
|
166
|
+
if isinstance(prop_properties, dict):
|
|
167
|
+
entries.extend(_flatten_cache_properties(prop_properties, prefix=f"{array_path}."))
|
|
168
|
+
elif isinstance(prop_properties, dict):
|
|
169
|
+
entries.extend(_flatten_cache_properties(prop_properties, prefix=f"{path}."))
|
|
170
|
+
|
|
171
|
+
return entries
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
def _flatten_cache_field_paths(field: Any) -> list[str]:
|
|
175
|
+
field_name = getattr(field, "name", None) if not isinstance(field, dict) else field.get("name")
|
|
176
|
+
if not isinstance(field_name, str) or not field_name:
|
|
177
|
+
return []
|
|
178
|
+
|
|
179
|
+
field_type = getattr(field, "type", None) if not isinstance(field, dict) else field.get("type")
|
|
180
|
+
field_properties = getattr(field, "properties", None) if not isinstance(field, dict) else field.get("properties")
|
|
181
|
+
|
|
182
|
+
entries = [field_name]
|
|
183
|
+
if _type_includes(field_type, "array"):
|
|
184
|
+
array_path = f"{field_name}[]"
|
|
185
|
+
entries.append(array_path)
|
|
186
|
+
if isinstance(field_properties, dict):
|
|
187
|
+
entries.extend(_flatten_cache_properties(field_properties, prefix=f"{array_path}."))
|
|
188
|
+
elif isinstance(field_properties, dict):
|
|
189
|
+
entries.extend(_flatten_cache_properties(field_properties, prefix=f"{field_name}."))
|
|
190
|
+
|
|
191
|
+
return entries
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
def _dedupe_strings(values: list[str]) -> list[str]:
|
|
195
|
+
seen: set[str] = set()
|
|
196
|
+
ordered: list[str] = []
|
|
197
|
+
for value in values:
|
|
198
|
+
if value not in seen:
|
|
199
|
+
seen.add(value)
|
|
200
|
+
ordered.append(value)
|
|
201
|
+
return ordered
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
def _extract_search_field_paths(spec: OpenAPIConnector) -> dict[str, list[str]]:
|
|
205
|
+
cache_config = getattr(spec.info, "x_airbyte_cache", None)
|
|
206
|
+
entities = getattr(cache_config, "entities", None)
|
|
207
|
+
if not isinstance(entities, list):
|
|
208
|
+
return {}
|
|
209
|
+
|
|
210
|
+
search_fields: dict[str, list[str]] = {}
|
|
211
|
+
for entity in entities:
|
|
212
|
+
entity_name = getattr(entity, "entity", None) if not isinstance(entity, dict) else entity.get("entity")
|
|
213
|
+
if not isinstance(entity_name, str) or not entity_name:
|
|
214
|
+
continue
|
|
215
|
+
|
|
216
|
+
fields = getattr(entity, "fields", None) if not isinstance(entity, dict) else entity.get("fields")
|
|
217
|
+
if not isinstance(fields, list):
|
|
218
|
+
continue
|
|
219
|
+
|
|
220
|
+
field_paths: list[str] = []
|
|
221
|
+
for field in fields:
|
|
222
|
+
field_paths.extend(_flatten_cache_field_paths(field))
|
|
223
|
+
|
|
224
|
+
search_fields[entity_name] = _dedupe_strings(field_paths)
|
|
225
|
+
|
|
226
|
+
return search_fields
|
|
227
|
+
|
|
228
|
+
|
|
148
229
|
def parse_openapi_spec(raw_config: dict) -> OpenAPIConnector:
|
|
149
230
|
"""Parse OpenAPI specification from YAML.
|
|
150
231
|
|
|
@@ -434,6 +515,8 @@ def convert_openapi_to_connector_model(spec: OpenAPIConnector) -> ConnectorModel
|
|
|
434
515
|
if not connector_id:
|
|
435
516
|
raise InvalidOpenAPIError("Missing required x-airbyte-connector-id field")
|
|
436
517
|
|
|
518
|
+
search_field_paths = _extract_search_field_paths(spec)
|
|
519
|
+
|
|
437
520
|
# Create ConnectorModel
|
|
438
521
|
model = ConnectorModel(
|
|
439
522
|
id=connector_id,
|
|
@@ -444,6 +527,7 @@ def convert_openapi_to_connector_model(spec: OpenAPIConnector) -> ConnectorModel
|
|
|
444
527
|
entities=entities,
|
|
445
528
|
openapi_spec=spec,
|
|
446
529
|
retry_config=retry_config,
|
|
530
|
+
search_field_paths=search_field_paths,
|
|
447
531
|
)
|
|
448
532
|
|
|
449
533
|
return model
|
|
@@ -1032,7 +1032,9 @@ class LocalExecutor:
|
|
|
1032
1032
|
if "variables" in graphql_config and graphql_config["variables"]:
|
|
1033
1033
|
variables = self._interpolate_variables(graphql_config["variables"], params, param_defaults)
|
|
1034
1034
|
# Filter out None values (optional fields not provided) - matches REST _extract_body() behavior
|
|
1035
|
-
|
|
1035
|
+
# But preserve None for variables explicitly marked as nullable (e.g., to unassign a user)
|
|
1036
|
+
nullable_vars = set(graphql_config.get("x-airbyte-nullable-variables") or [])
|
|
1037
|
+
body["variables"] = {k: v for k, v in variables.items() if v is not None or k in nullable_vars}
|
|
1036
1038
|
|
|
1037
1039
|
# Add operation name if specified
|
|
1038
1040
|
if "operationName" in graphql_config:
|
|
@@ -18,6 +18,185 @@ from typing import Any, Protocol
|
|
|
18
18
|
MAX_EXAMPLE_QUESTIONS = 5 # Maximum number of example questions to include in description
|
|
19
19
|
|
|
20
20
|
|
|
21
|
+
def _type_includes(type_value: Any, target: str) -> bool:
|
|
22
|
+
if isinstance(type_value, list):
|
|
23
|
+
return target in type_value
|
|
24
|
+
return type_value == target
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def _is_object_schema(schema: dict[str, Any]) -> bool:
|
|
28
|
+
if "properties" in schema:
|
|
29
|
+
return True
|
|
30
|
+
return _type_includes(schema.get("type"), "object")
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def _is_array_schema(schema: dict[str, Any]) -> bool:
|
|
34
|
+
if "items" in schema:
|
|
35
|
+
return True
|
|
36
|
+
return _type_includes(schema.get("type"), "array")
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def _dedupe_param_entries(entries: list[tuple[str, bool]]) -> list[tuple[str, bool]]:
|
|
40
|
+
seen: dict[str, bool] = {}
|
|
41
|
+
ordered: list[str] = []
|
|
42
|
+
for name, required in entries:
|
|
43
|
+
if name not in seen:
|
|
44
|
+
seen[name] = required
|
|
45
|
+
ordered.append(name)
|
|
46
|
+
else:
|
|
47
|
+
seen[name] = seen[name] or required
|
|
48
|
+
return [(name, seen[name]) for name in ordered]
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def _flatten_schema_params(
|
|
52
|
+
schema: dict[str, Any],
|
|
53
|
+
prefix: str = "",
|
|
54
|
+
parent_required: bool = True,
|
|
55
|
+
seen_stack: set[int] | None = None,
|
|
56
|
+
) -> list[tuple[str, bool]]:
|
|
57
|
+
if not isinstance(schema, dict):
|
|
58
|
+
return []
|
|
59
|
+
|
|
60
|
+
if seen_stack is None:
|
|
61
|
+
seen_stack = set()
|
|
62
|
+
|
|
63
|
+
schema_id = id(schema)
|
|
64
|
+
if schema_id in seen_stack:
|
|
65
|
+
return []
|
|
66
|
+
|
|
67
|
+
seen_stack.add(schema_id)
|
|
68
|
+
try:
|
|
69
|
+
entries: list[tuple[str, bool]] = []
|
|
70
|
+
|
|
71
|
+
for subschema in schema.get("allOf", []) or []:
|
|
72
|
+
if isinstance(subschema, dict):
|
|
73
|
+
entries.extend(_flatten_schema_params(subschema, prefix, parent_required, seen_stack))
|
|
74
|
+
|
|
75
|
+
for keyword in ("anyOf", "oneOf"):
|
|
76
|
+
for subschema in schema.get(keyword, []) or []:
|
|
77
|
+
if isinstance(subschema, dict):
|
|
78
|
+
entries.extend(_flatten_schema_params(subschema, prefix, False, seen_stack))
|
|
79
|
+
|
|
80
|
+
properties = schema.get("properties")
|
|
81
|
+
if isinstance(properties, dict):
|
|
82
|
+
required_fields = set(schema.get("required", [])) if isinstance(schema.get("required"), list) else set()
|
|
83
|
+
for prop_name, prop_schema in properties.items():
|
|
84
|
+
path = f"{prefix}{prop_name}" if prefix else prop_name
|
|
85
|
+
is_required = parent_required and prop_name in required_fields
|
|
86
|
+
entries.append((path, is_required))
|
|
87
|
+
|
|
88
|
+
if isinstance(prop_schema, dict):
|
|
89
|
+
if _is_array_schema(prop_schema):
|
|
90
|
+
array_path = f"{path}[]"
|
|
91
|
+
entries.append((array_path, is_required))
|
|
92
|
+
items = prop_schema.get("items")
|
|
93
|
+
if isinstance(items, dict):
|
|
94
|
+
entries.extend(_flatten_schema_params(items, prefix=f"{array_path}.", parent_required=is_required, seen_stack=seen_stack))
|
|
95
|
+
if _is_object_schema(prop_schema):
|
|
96
|
+
entries.extend(_flatten_schema_params(prop_schema, prefix=f"{path}.", parent_required=is_required, seen_stack=seen_stack))
|
|
97
|
+
|
|
98
|
+
return _dedupe_param_entries(entries)
|
|
99
|
+
finally:
|
|
100
|
+
seen_stack.remove(schema_id)
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
def _cache_field_value(field: Any, key: str) -> Any:
|
|
104
|
+
if isinstance(field, dict):
|
|
105
|
+
return field.get(key)
|
|
106
|
+
return getattr(field, key, None)
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
def _flatten_cache_properties(properties: dict[str, Any], prefix: str) -> list[str]:
|
|
110
|
+
entries: list[str] = []
|
|
111
|
+
for prop_name, prop in properties.items():
|
|
112
|
+
path = f"{prefix}{prop_name}" if prefix else prop_name
|
|
113
|
+
entries.append(path)
|
|
114
|
+
|
|
115
|
+
prop_type = _cache_field_value(prop, "type")
|
|
116
|
+
prop_properties = _cache_field_value(prop, "properties")
|
|
117
|
+
|
|
118
|
+
if _type_includes(prop_type, "array"):
|
|
119
|
+
array_path = f"{path}[]"
|
|
120
|
+
entries.append(array_path)
|
|
121
|
+
if isinstance(prop_properties, dict):
|
|
122
|
+
entries.extend(_flatten_cache_properties(prop_properties, prefix=f"{array_path}."))
|
|
123
|
+
elif isinstance(prop_properties, dict):
|
|
124
|
+
entries.extend(_flatten_cache_properties(prop_properties, prefix=f"{path}."))
|
|
125
|
+
|
|
126
|
+
return entries
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
def _flatten_cache_field_paths(field: Any) -> list[str]:
|
|
130
|
+
field_name = _cache_field_value(field, "name")
|
|
131
|
+
if not isinstance(field_name, str) or not field_name:
|
|
132
|
+
return []
|
|
133
|
+
|
|
134
|
+
field_type = _cache_field_value(field, "type")
|
|
135
|
+
field_properties = _cache_field_value(field, "properties")
|
|
136
|
+
|
|
137
|
+
entries = [field_name]
|
|
138
|
+
if _type_includes(field_type, "array"):
|
|
139
|
+
array_path = f"{field_name}[]"
|
|
140
|
+
entries.append(array_path)
|
|
141
|
+
if isinstance(field_properties, dict):
|
|
142
|
+
entries.extend(_flatten_cache_properties(field_properties, prefix=f"{array_path}."))
|
|
143
|
+
elif isinstance(field_properties, dict):
|
|
144
|
+
entries.extend(_flatten_cache_properties(field_properties, prefix=f"{field_name}."))
|
|
145
|
+
|
|
146
|
+
return entries
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
def _dedupe_strings(values: list[str]) -> list[str]:
|
|
150
|
+
seen: set[str] = set()
|
|
151
|
+
ordered: list[str] = []
|
|
152
|
+
for value in values:
|
|
153
|
+
if value not in seen:
|
|
154
|
+
seen.add(value)
|
|
155
|
+
ordered.append(value)
|
|
156
|
+
return ordered
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
def _collect_search_field_paths(model: ConnectorModelProtocol) -> dict[str, list[str]]:
|
|
160
|
+
search_field_paths = getattr(model, "search_field_paths", None)
|
|
161
|
+
if isinstance(search_field_paths, dict) and search_field_paths:
|
|
162
|
+
normalized: dict[str, list[str]] = {}
|
|
163
|
+
for entity, fields in search_field_paths.items():
|
|
164
|
+
if not isinstance(entity, str) or not entity:
|
|
165
|
+
continue
|
|
166
|
+
if isinstance(fields, list):
|
|
167
|
+
normalized[entity] = _dedupe_strings([field for field in fields if isinstance(field, str) and field])
|
|
168
|
+
return normalized
|
|
169
|
+
|
|
170
|
+
openapi_spec = getattr(model, "openapi_spec", None)
|
|
171
|
+
info = getattr(openapi_spec, "info", None)
|
|
172
|
+
cache_config = getattr(info, "x_airbyte_cache", None)
|
|
173
|
+
entities = getattr(cache_config, "entities", None)
|
|
174
|
+
if not isinstance(entities, list):
|
|
175
|
+
return {}
|
|
176
|
+
|
|
177
|
+
search_fields: dict[str, list[str]] = {}
|
|
178
|
+
for entity in entities:
|
|
179
|
+
entity_name = _cache_field_value(entity, "entity")
|
|
180
|
+
if not isinstance(entity_name, str) or not entity_name:
|
|
181
|
+
continue
|
|
182
|
+
|
|
183
|
+
fields = _cache_field_value(entity, "fields") or []
|
|
184
|
+
if not isinstance(fields, list):
|
|
185
|
+
continue
|
|
186
|
+
field_paths: list[str] = []
|
|
187
|
+
for field in fields:
|
|
188
|
+
field_paths.extend(_flatten_cache_field_paths(field))
|
|
189
|
+
|
|
190
|
+
search_fields[entity_name] = _dedupe_strings(field_paths)
|
|
191
|
+
|
|
192
|
+
return search_fields
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
def _format_search_param_signature() -> str:
|
|
196
|
+
params = ["query*", "limit?", "cursor?", "fields?"]
|
|
197
|
+
return f"({', '.join(params)})"
|
|
198
|
+
|
|
199
|
+
|
|
21
200
|
class EndpointProtocol(Protocol):
|
|
22
201
|
"""Protocol defining the expected interface for endpoint parameters.
|
|
23
202
|
|
|
@@ -54,6 +233,9 @@ class ConnectorModelProtocol(Protocol):
|
|
|
54
233
|
@property
|
|
55
234
|
def openapi_spec(self) -> Any: ...
|
|
56
235
|
|
|
236
|
+
@property
|
|
237
|
+
def search_field_paths(self) -> dict[str, list[str]] | None: ...
|
|
238
|
+
|
|
57
239
|
|
|
58
240
|
def format_param_signature(endpoint: EndpointProtocol) -> str:
|
|
59
241
|
"""Format parameter signature for an endpoint action.
|
|
@@ -86,9 +268,12 @@ def format_param_signature(endpoint: EndpointProtocol) -> str:
|
|
|
86
268
|
required = schema.get("required", False)
|
|
87
269
|
params.append(f"{name}{'*' if required else '?'}")
|
|
88
270
|
|
|
89
|
-
# Body fields
|
|
90
|
-
if request_schema:
|
|
91
|
-
|
|
271
|
+
# Body fields (include nested params from schema when available)
|
|
272
|
+
if isinstance(request_schema, dict):
|
|
273
|
+
for name, required in _flatten_schema_params(request_schema):
|
|
274
|
+
params.append(f"{name}{'*' if required else '?'}")
|
|
275
|
+
elif request_schema:
|
|
276
|
+
required_fields = set(request_schema.get("required", [])) if isinstance(request_schema, dict) else set()
|
|
92
277
|
for name in body_fields:
|
|
93
278
|
params.append(f"{name}{'*' if name in required_fields else '?'}")
|
|
94
279
|
|
|
@@ -99,7 +284,7 @@ def describe_entities(model: ConnectorModelProtocol) -> list[dict[str, Any]]:
|
|
|
99
284
|
"""Generate entity descriptions from ConnectorModel.
|
|
100
285
|
|
|
101
286
|
Returns a list of entity descriptions with detailed parameter information
|
|
102
|
-
for each action. This is used by generated connectors'
|
|
287
|
+
for each action. This is used by generated connectors' list_entities() method.
|
|
103
288
|
|
|
104
289
|
Args:
|
|
105
290
|
model: Object conforming to ConnectorModelProtocol (e.g., ConnectorModel)
|
|
@@ -203,8 +388,8 @@ def generate_tool_description(model: ConnectorModelProtocol) -> str:
|
|
|
203
388
|
- Response structure documentation with pagination hints
|
|
204
389
|
- Example questions if available in the OpenAPI spec
|
|
205
390
|
|
|
206
|
-
This is used by the Connector.
|
|
207
|
-
|
|
391
|
+
This is used by the Connector.tool_utils decorator to populate function
|
|
392
|
+
docstrings for AI framework integration.
|
|
208
393
|
|
|
209
394
|
Args:
|
|
210
395
|
model: Object conforming to ConnectorModelProtocol (e.g., ConnectorModel)
|
|
@@ -213,8 +398,11 @@ def generate_tool_description(model: ConnectorModelProtocol) -> str:
|
|
|
213
398
|
Formatted description string suitable for AI tool documentation
|
|
214
399
|
"""
|
|
215
400
|
lines = []
|
|
401
|
+
# NOTE: Do not insert blank lines in the docstring; pydantic-ai parsing truncates
|
|
402
|
+
# at the first empty line and only keeps the initial section.
|
|
216
403
|
|
|
217
404
|
# Entity/action parameter details (including pagination params like limit, starting_after)
|
|
405
|
+
search_field_paths = _collect_search_field_paths(model)
|
|
218
406
|
lines.append("ENTITIES AND PARAMETERS:")
|
|
219
407
|
for entity in model.entities:
|
|
220
408
|
lines.append(f" {entity.name}:")
|
|
@@ -228,14 +416,41 @@ def generate_tool_description(model: ConnectorModelProtocol) -> str:
|
|
|
228
416
|
lines.append(f" - {action_str}{param_sig}")
|
|
229
417
|
else:
|
|
230
418
|
lines.append(f" - {action_str}()")
|
|
419
|
+
if entity.name in search_field_paths:
|
|
420
|
+
search_sig = _format_search_param_signature()
|
|
421
|
+
lines.append(f" - search{search_sig}")
|
|
231
422
|
|
|
232
423
|
# Response structure (brief, includes pagination hint)
|
|
233
|
-
lines.append("")
|
|
234
424
|
lines.append("RESPONSE STRUCTURE:")
|
|
235
425
|
lines.append(" - list/api_search: {data: [...], meta: {has_more: bool}}")
|
|
236
426
|
lines.append(" - get: Returns entity directly (no envelope)")
|
|
237
427
|
lines.append(" To paginate: pass starting_after=<last_id> while has_more is true")
|
|
238
428
|
|
|
429
|
+
lines.append("GUIDELINES:")
|
|
430
|
+
lines.append(' - Prefer cached search over direct API calls when using execute(): action="search" whenever possible.')
|
|
431
|
+
lines.append(" - Direct API actions (list/get/download) are slower and should be used only if search cannot answer the query.")
|
|
432
|
+
lines.append(" - Keep results small: use params.fields, params.query.filter, small params.limit, and cursor pagination.")
|
|
433
|
+
lines.append(" - If output is too large, refine the query with tighter filters/fields/limit.")
|
|
434
|
+
|
|
435
|
+
if search_field_paths:
|
|
436
|
+
lines.append("SEARCH (PREFERRED):")
|
|
437
|
+
lines.append(' execute(entity, action="search", params={')
|
|
438
|
+
lines.append(' "query": {"filter": <condition>, "sort": [{"field": "asc|desc"}, ...]},')
|
|
439
|
+
lines.append(' "limit": <int>, "cursor": <str>, "fields": ["field", "nested.field", ...]')
|
|
440
|
+
lines.append(" })")
|
|
441
|
+
lines.append(' Example: {"query": {"filter": {"eq": {"title": "Intro to Airbyte | Miinto"}}}, "limit": 1,')
|
|
442
|
+
lines.append(' "fields": ["id", "title", "started", "primaryUserId"]}')
|
|
443
|
+
lines.append(" Conditions are composable:")
|
|
444
|
+
lines.append(" - eq, neq, gt, gte, lt, lte, in, like, fuzzy, keyword, contains, any")
|
|
445
|
+
lines.append(' - and/or/not to combine conditions (e.g., {"and": [cond1, cond2]})')
|
|
446
|
+
|
|
447
|
+
lines.append("SEARCHABLE FIELDS:")
|
|
448
|
+
for entity_name, field_paths in search_field_paths.items():
|
|
449
|
+
if field_paths:
|
|
450
|
+
lines.append(f" {entity_name}: {', '.join(field_paths)}")
|
|
451
|
+
else:
|
|
452
|
+
lines.append(f" {entity_name}: (no fields listed)")
|
|
453
|
+
|
|
239
454
|
# Add example questions if available in openapi_spec
|
|
240
455
|
openapi_spec = getattr(model, "openapi_spec", None)
|
|
241
456
|
if openapi_spec:
|
|
@@ -245,18 +460,15 @@ def generate_tool_description(model: ConnectorModelProtocol) -> str:
|
|
|
245
460
|
if example_questions:
|
|
246
461
|
supported = getattr(example_questions, "supported", None)
|
|
247
462
|
if supported:
|
|
248
|
-
lines.append("")
|
|
249
463
|
lines.append("EXAMPLE QUESTIONS:")
|
|
250
464
|
for q in supported[:MAX_EXAMPLE_QUESTIONS]:
|
|
251
465
|
lines.append(f" - {q}")
|
|
252
466
|
|
|
253
467
|
# Generic parameter description for function signature
|
|
254
|
-
lines.append("")
|
|
255
468
|
lines.append("FUNCTION PARAMETERS:")
|
|
256
469
|
lines.append(" - entity: Entity name (string)")
|
|
257
470
|
lines.append(" - action: Operation to perform (string)")
|
|
258
471
|
lines.append(" - params: Operation parameters (dict) - see entity details above")
|
|
259
|
-
lines.append("")
|
|
260
472
|
lines.append("Parameter markers: * = required, ? = optional")
|
|
261
473
|
|
|
262
474
|
return "\n".join(lines)
|