karrio-cli 2025.5rc3__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.
- karrio_cli/__init__.py +0 -0
- karrio_cli/__main__.py +105 -0
- karrio_cli/ai/README.md +335 -0
- karrio_cli/ai/__init__.py +0 -0
- karrio_cli/ai/commands.py +102 -0
- karrio_cli/ai/karrio_ai/__init__.py +1 -0
- karrio_cli/ai/karrio_ai/agent.py +972 -0
- karrio_cli/ai/karrio_ai/architecture/INTEGRATION_AGENT_PROMPT.md +497 -0
- karrio_cli/ai/karrio_ai/architecture/MAPPING_AGENT_PROMPT.md +355 -0
- karrio_cli/ai/karrio_ai/architecture/REAL_WORLD_TESTING.md +305 -0
- karrio_cli/ai/karrio_ai/architecture/SCHEMA_AGENT_PROMPT.md +183 -0
- karrio_cli/ai/karrio_ai/architecture/TESTING_AGENT_PROMPT.md +448 -0
- karrio_cli/ai/karrio_ai/architecture/TESTING_GUIDE.md +271 -0
- karrio_cli/ai/karrio_ai/enhanced_tools.py +943 -0
- karrio_cli/ai/karrio_ai/rag_system.py +503 -0
- karrio_cli/ai/karrio_ai/tests/test_agent.py +350 -0
- karrio_cli/ai/karrio_ai/tests/test_real_integration.py +360 -0
- karrio_cli/ai/karrio_ai/tests/test_real_world_scenarios.py +513 -0
- karrio_cli/commands/__init__.py +0 -0
- karrio_cli/commands/codegen.py +336 -0
- karrio_cli/commands/login.py +139 -0
- karrio_cli/commands/plugins.py +168 -0
- karrio_cli/commands/sdk.py +870 -0
- karrio_cli/common/queries.py +101 -0
- karrio_cli/common/utils.py +368 -0
- karrio_cli/resources/__init__.py +0 -0
- karrio_cli/resources/carriers.py +91 -0
- karrio_cli/resources/connections.py +207 -0
- karrio_cli/resources/events.py +151 -0
- karrio_cli/resources/logs.py +151 -0
- karrio_cli/resources/orders.py +144 -0
- karrio_cli/resources/shipments.py +210 -0
- karrio_cli/resources/trackers.py +287 -0
- karrio_cli/templates/__init__.py +9 -0
- karrio_cli/templates/__pycache__/__init__.cpython-311.pyc +0 -0
- karrio_cli/templates/__pycache__/__init__.cpython-312.pyc +0 -0
- karrio_cli/templates/__pycache__/address.cpython-311.pyc +0 -0
- karrio_cli/templates/__pycache__/address.cpython-312.pyc +0 -0
- karrio_cli/templates/__pycache__/docs.cpython-311.pyc +0 -0
- karrio_cli/templates/__pycache__/docs.cpython-312.pyc +0 -0
- karrio_cli/templates/__pycache__/documents.cpython-311.pyc +0 -0
- karrio_cli/templates/__pycache__/documents.cpython-312.pyc +0 -0
- karrio_cli/templates/__pycache__/manifest.cpython-311.pyc +0 -0
- karrio_cli/templates/__pycache__/manifest.cpython-312.pyc +0 -0
- karrio_cli/templates/__pycache__/pickup.cpython-311.pyc +0 -0
- karrio_cli/templates/__pycache__/pickup.cpython-312.pyc +0 -0
- karrio_cli/templates/__pycache__/rates.cpython-311.pyc +0 -0
- karrio_cli/templates/__pycache__/rates.cpython-312.pyc +0 -0
- karrio_cli/templates/__pycache__/sdk.cpython-311.pyc +0 -0
- karrio_cli/templates/__pycache__/sdk.cpython-312.pyc +0 -0
- karrio_cli/templates/__pycache__/shipments.cpython-311.pyc +0 -0
- karrio_cli/templates/__pycache__/shipments.cpython-312.pyc +0 -0
- karrio_cli/templates/__pycache__/tracking.cpython-311.pyc +0 -0
- karrio_cli/templates/__pycache__/tracking.cpython-312.pyc +0 -0
- karrio_cli/templates/address.py +308 -0
- karrio_cli/templates/docs.py +150 -0
- karrio_cli/templates/documents.py +428 -0
- karrio_cli/templates/manifest.py +396 -0
- karrio_cli/templates/pickup.py +839 -0
- karrio_cli/templates/rates.py +638 -0
- karrio_cli/templates/sdk.py +947 -0
- karrio_cli/templates/shipments.py +892 -0
- karrio_cli/templates/tracking.py +437 -0
- karrio_cli-2025.5rc3.dist-info/METADATA +165 -0
- karrio_cli-2025.5rc3.dist-info/RECORD +68 -0
- karrio_cli-2025.5rc3.dist-info/WHEEL +5 -0
- karrio_cli-2025.5rc3.dist-info/entry_points.txt +2 -0
- karrio_cli-2025.5rc3.dist-info/top_level.txt +1 -0
@@ -0,0 +1,513 @@
|
|
1
|
+
#!/usr/bin/env python3
|
2
|
+
"""
|
3
|
+
Real-world carrier integration testing scenarios.
|
4
|
+
|
5
|
+
This script demonstrates how to test the Karrio ADK agent with various
|
6
|
+
real-world input formats and integration scenarios.
|
7
|
+
"""
|
8
|
+
|
9
|
+
import sys
|
10
|
+
import json
|
11
|
+
from pathlib import Path
|
12
|
+
from typing import Dict, Any
|
13
|
+
|
14
|
+
# Add the ai module to the path
|
15
|
+
sys.path.insert(0, str(Path(__file__).parent))
|
16
|
+
|
17
|
+
from karrio_ai.agent import (
|
18
|
+
root_agent,
|
19
|
+
analyze_existing_connector,
|
20
|
+
extract_carrier_patterns,
|
21
|
+
generate_carrier_schema,
|
22
|
+
generate_carrier_mappings,
|
23
|
+
generate_integration_tests,
|
24
|
+
assemble_complete_integration,
|
25
|
+
)
|
26
|
+
from karrio_ai.enhanced_tools import analyze_carrier_documentation
|
27
|
+
|
28
|
+
|
29
|
+
def test_openapi_integration():
|
30
|
+
"""Test building integration from OpenAPI specification."""
|
31
|
+
print("=== Testing OpenAPI Integration ===")
|
32
|
+
|
33
|
+
# Example OpenAPI spec for a fictional carrier
|
34
|
+
openapi_spec = '''
|
35
|
+
openapi: 3.0.0
|
36
|
+
info:
|
37
|
+
title: SwiftShip API
|
38
|
+
version: 1.0.0
|
39
|
+
description: API for SwiftShip carrier services
|
40
|
+
servers:
|
41
|
+
- url: https://api.swiftship.com/v1
|
42
|
+
paths:
|
43
|
+
/rates:
|
44
|
+
post:
|
45
|
+
summary: Get shipping rates
|
46
|
+
tags: [Rates]
|
47
|
+
requestBody:
|
48
|
+
required: true
|
49
|
+
content:
|
50
|
+
application/json:
|
51
|
+
schema:
|
52
|
+
$ref: '#/components/schemas/RateRequest'
|
53
|
+
responses:
|
54
|
+
200:
|
55
|
+
content:
|
56
|
+
application/json:
|
57
|
+
schema:
|
58
|
+
$ref: '#/components/schemas/RateResponse'
|
59
|
+
/shipments:
|
60
|
+
post:
|
61
|
+
summary: Create shipment
|
62
|
+
tags: [Shipments]
|
63
|
+
requestBody:
|
64
|
+
required: true
|
65
|
+
content:
|
66
|
+
application/json:
|
67
|
+
schema:
|
68
|
+
$ref: '#/components/schemas/ShipmentRequest'
|
69
|
+
responses:
|
70
|
+
201:
|
71
|
+
content:
|
72
|
+
application/json:
|
73
|
+
schema:
|
74
|
+
$ref: '#/components/schemas/ShipmentResponse'
|
75
|
+
/tracking/{tracking_number}:
|
76
|
+
get:
|
77
|
+
summary: Track shipment
|
78
|
+
tags: [Tracking]
|
79
|
+
parameters:
|
80
|
+
- name: tracking_number
|
81
|
+
in: path
|
82
|
+
required: true
|
83
|
+
schema:
|
84
|
+
type: string
|
85
|
+
responses:
|
86
|
+
200:
|
87
|
+
content:
|
88
|
+
application/json:
|
89
|
+
schema:
|
90
|
+
$ref: '#/components/schemas/TrackingResponse'
|
91
|
+
components:
|
92
|
+
securitySchemes:
|
93
|
+
ApiKeyAuth:
|
94
|
+
type: apiKey
|
95
|
+
in: header
|
96
|
+
name: X-API-Key
|
97
|
+
schemas:
|
98
|
+
RateRequest:
|
99
|
+
type: object
|
100
|
+
properties:
|
101
|
+
origin:
|
102
|
+
type: object
|
103
|
+
destination:
|
104
|
+
type: object
|
105
|
+
packages:
|
106
|
+
type: array
|
107
|
+
items:
|
108
|
+
type: object
|
109
|
+
RateResponse:
|
110
|
+
type: object
|
111
|
+
properties:
|
112
|
+
rates:
|
113
|
+
type: array
|
114
|
+
items:
|
115
|
+
type: object
|
116
|
+
properties:
|
117
|
+
service_code:
|
118
|
+
type: string
|
119
|
+
total_cost:
|
120
|
+
type: number
|
121
|
+
currency:
|
122
|
+
type: string
|
123
|
+
'''
|
124
|
+
|
125
|
+
try:
|
126
|
+
# Analyze the OpenAPI specification
|
127
|
+
analysis = analyze_carrier_documentation(
|
128
|
+
carrier_name="swiftship",
|
129
|
+
documentation_source=openapi_spec,
|
130
|
+
source_type="openapi"
|
131
|
+
)
|
132
|
+
|
133
|
+
print(f"ā Analysis successful: {analysis['success']}")
|
134
|
+
print(f"ā Detected API type: {analysis['analysis']['api_type']}")
|
135
|
+
print(f"ā Found {len(analysis['analysis']['endpoints'])} endpoints")
|
136
|
+
print(f"ā Auth methods: {analysis['analysis']['auth_methods']}")
|
137
|
+
|
138
|
+
# Generate complete integration
|
139
|
+
integration_config = {
|
140
|
+
"carrier_name": "swiftship",
|
141
|
+
"operations": ["rates", "shipments", "tracking"],
|
142
|
+
"auth_type": "API_KEY",
|
143
|
+
"api_base_url": "https://api.swiftship.com/v1",
|
144
|
+
"test_mode": True
|
145
|
+
}
|
146
|
+
|
147
|
+
result = assemble_complete_integration(
|
148
|
+
carrier_name="swiftship",
|
149
|
+
integration_config=integration_config
|
150
|
+
)
|
151
|
+
|
152
|
+
print(f"ā Integration generated: {result['integration_complete']}")
|
153
|
+
print(f"ā Generated {len(result['generated_files'])} file types")
|
154
|
+
|
155
|
+
return True
|
156
|
+
|
157
|
+
except Exception as e:
|
158
|
+
print(f"ā OpenAPI integration test failed: {e}")
|
159
|
+
return False
|
160
|
+
|
161
|
+
|
162
|
+
def test_url_scraping_integration():
|
163
|
+
"""Test building integration from scraped website documentation."""
|
164
|
+
print("\n=== Testing URL Scraping Integration ===")
|
165
|
+
|
166
|
+
# Example: Pretend we're scraping API docs from a website
|
167
|
+
mock_scraped_content = """
|
168
|
+
SwiftShip Developer Documentation
|
169
|
+
|
170
|
+
API Base URL: https://api.swiftship.com/v1
|
171
|
+
|
172
|
+
Authentication:
|
173
|
+
All requests require an API key in the X-API-Key header.
|
174
|
+
|
175
|
+
Endpoints:
|
176
|
+
|
177
|
+
POST /rates - Get shipping rates
|
178
|
+
Request: JSON object with origin, destination, packages
|
179
|
+
Response: Array of rate objects with service_code, total_cost, currency
|
180
|
+
|
181
|
+
POST /shipments - Create a new shipment
|
182
|
+
Request: JSON with shipper, recipient, packages, service
|
183
|
+
Response: Shipment object with tracking_number, label_url
|
184
|
+
|
185
|
+
GET /tracking/{number} - Track a shipment
|
186
|
+
Response: Tracking object with status and events
|
187
|
+
|
188
|
+
Example rate request:
|
189
|
+
{
|
190
|
+
"origin": {"postal_code": "10001", "country": "US"},
|
191
|
+
"destination": {"postal_code": "90210", "country": "US"},
|
192
|
+
"packages": [{"weight": 2.5, "dimensions": {"length": 10, "width": 8, "height": 6}}]
|
193
|
+
}
|
194
|
+
"""
|
195
|
+
|
196
|
+
try:
|
197
|
+
# Analyze scraped content
|
198
|
+
analysis = analyze_carrier_documentation(
|
199
|
+
carrier_name="swiftship_web",
|
200
|
+
documentation_source=mock_scraped_content,
|
201
|
+
source_type="text"
|
202
|
+
)
|
203
|
+
|
204
|
+
print(f"ā URL analysis successful: {analysis['success']}")
|
205
|
+
print(f"ā Found {len(analysis['analysis']['endpoints'])} endpoints")
|
206
|
+
print(f"ā Auth methods detected: {analysis['analysis']['auth_methods']}")
|
207
|
+
|
208
|
+
# Extract patterns from similar carriers
|
209
|
+
patterns = extract_carrier_patterns(
|
210
|
+
similar_carriers=["ups", "fedex", "canadapost"],
|
211
|
+
pattern_type="all"
|
212
|
+
)
|
213
|
+
|
214
|
+
print(f"ā Extracted patterns from {len(patterns['analyzed_carriers'])} carriers")
|
215
|
+
print(f"ā Found {len(patterns['best_practices'])} best practices")
|
216
|
+
|
217
|
+
# Generate schemas from the scraped documentation
|
218
|
+
schema_result = generate_carrier_schema(
|
219
|
+
carrier_name="swiftship_web",
|
220
|
+
api_documentation=mock_scraped_content,
|
221
|
+
schema_type="complete"
|
222
|
+
)
|
223
|
+
|
224
|
+
print(f"ā Generated {len(schema_result['classes'])} schema classes")
|
225
|
+
|
226
|
+
return True
|
227
|
+
|
228
|
+
except Exception as e:
|
229
|
+
print(f"ā URL scraping integration test failed: {e}")
|
230
|
+
return False
|
231
|
+
|
232
|
+
|
233
|
+
def test_pdf_documentation_integration():
|
234
|
+
"""Test building integration from PDF documentation."""
|
235
|
+
print("\n=== Testing PDF Documentation Integration ===")
|
236
|
+
|
237
|
+
# Simulate PDF content (in real scenario, this would be extracted from PDF)
|
238
|
+
mock_pdf_content = """
|
239
|
+
SwiftShip API Documentation v2.0
|
240
|
+
|
241
|
+
Page 1: Introduction
|
242
|
+
Welcome to SwiftShip API. This REST API allows you to integrate shipping functionality.
|
243
|
+
|
244
|
+
Page 2: Authentication
|
245
|
+
API Key Authentication required. Include your API key in the Authorization header:
|
246
|
+
Authorization: Bearer YOUR_API_KEY
|
247
|
+
|
248
|
+
Page 3: Rate Calculation
|
249
|
+
Endpoint: POST /api/v2/calculate-rates
|
250
|
+
Description: Calculate shipping rates for packages
|
251
|
+
|
252
|
+
Request Format:
|
253
|
+
{
|
254
|
+
"shipper_address": {
|
255
|
+
"street": "123 Main St",
|
256
|
+
"city": "New York",
|
257
|
+
"state": "NY",
|
258
|
+
"postal_code": "10001",
|
259
|
+
"country": "US"
|
260
|
+
},
|
261
|
+
"recipient_address": {
|
262
|
+
"street": "456 Oak Ave",
|
263
|
+
"city": "Los Angeles",
|
264
|
+
"state": "CA",
|
265
|
+
"postal_code": "90210",
|
266
|
+
"country": "US"
|
267
|
+
},
|
268
|
+
"packages": [
|
269
|
+
{
|
270
|
+
"weight_kg": 1.5,
|
271
|
+
"length_cm": 20,
|
272
|
+
"width_cm": 15,
|
273
|
+
"height_cm": 10
|
274
|
+
}
|
275
|
+
]
|
276
|
+
}
|
277
|
+
|
278
|
+
Page 4: Shipment Creation
|
279
|
+
Endpoint: POST /api/v2/shipments
|
280
|
+
Description: Create a new shipment and generate shipping label
|
281
|
+
|
282
|
+
Page 5: Tracking
|
283
|
+
Endpoint: GET /api/v2/track/{tracking_number}
|
284
|
+
Description: Get real-time tracking information
|
285
|
+
"""
|
286
|
+
|
287
|
+
try:
|
288
|
+
# Analyze PDF content
|
289
|
+
analysis = analyze_carrier_documentation(
|
290
|
+
carrier_name="swiftship_pdf",
|
291
|
+
documentation_source=mock_pdf_content,
|
292
|
+
source_type="text" # Using text since we don't have actual PDF parsing
|
293
|
+
)
|
294
|
+
|
295
|
+
print(f"ā PDF analysis successful: {analysis['success']}")
|
296
|
+
print(f"ā Found {len(analysis['analysis']['endpoints'])} endpoints")
|
297
|
+
print(f"ā Auth methods: {analysis['analysis']['auth_methods']}")
|
298
|
+
|
299
|
+
# Generate mappings based on PDF documentation
|
300
|
+
api_endpoints = {
|
301
|
+
"rates": "https://api.swiftship.com/api/v2/calculate-rates",
|
302
|
+
"shipments": "https://api.swiftship.com/api/v2/shipments",
|
303
|
+
"tracking": "https://api.swiftship.com/api/v2/track"
|
304
|
+
}
|
305
|
+
|
306
|
+
mapping_result = generate_carrier_mappings(
|
307
|
+
carrier_name="swiftship_pdf",
|
308
|
+
api_endpoints=api_endpoints,
|
309
|
+
operation_type="complete"
|
310
|
+
)
|
311
|
+
|
312
|
+
print(f"ā Generated {len(mapping_result['generated_mappings'])} mapping types")
|
313
|
+
|
314
|
+
# Generate comprehensive tests
|
315
|
+
test_data = {
|
316
|
+
"operations": ["rates", "shipments", "tracking"],
|
317
|
+
"test_addresses": {
|
318
|
+
"domestic": {"country": "US", "postal_code": "10001"},
|
319
|
+
"international": {"country": "CA", "postal_code": "M5V 3A1"}
|
320
|
+
}
|
321
|
+
}
|
322
|
+
|
323
|
+
test_result = generate_integration_tests(
|
324
|
+
carrier_name="swiftship_pdf",
|
325
|
+
test_data=test_data,
|
326
|
+
test_type="complete"
|
327
|
+
)
|
328
|
+
|
329
|
+
print(f"ā Generated {len(test_result['generated_tests'])} test categories")
|
330
|
+
|
331
|
+
return True
|
332
|
+
|
333
|
+
except Exception as e:
|
334
|
+
print(f"ā PDF documentation integration test failed: {e}")
|
335
|
+
return False
|
336
|
+
|
337
|
+
|
338
|
+
def test_mixed_source_integration():
|
339
|
+
"""Test building integration from multiple sources."""
|
340
|
+
print("\n=== Testing Mixed Source Integration ===")
|
341
|
+
|
342
|
+
try:
|
343
|
+
# Analyze an existing carrier first
|
344
|
+
existing_analysis = analyze_existing_connector("ups", "all")
|
345
|
+
print(f"ā Analyzed existing UPS connector: {len(existing_analysis['files'])} files")
|
346
|
+
|
347
|
+
# Extract patterns from multiple carriers
|
348
|
+
patterns = extract_carrier_patterns(
|
349
|
+
similar_carriers=["ups", "fedex", "dhl_express"],
|
350
|
+
pattern_type="all"
|
351
|
+
)
|
352
|
+
print(f"ā Extracted patterns from {len(patterns['analyzed_carriers'])} carriers")
|
353
|
+
|
354
|
+
# Create a complex integration config
|
355
|
+
complex_config = {
|
356
|
+
"carrier_name": "complexship",
|
357
|
+
"operations": ["rates", "shipments", "tracking", "pickup", "manifests"],
|
358
|
+
"auth_type": "OAUTH2",
|
359
|
+
"api_base_url": "https://api.complexship.com/v1",
|
360
|
+
"special_requirements": [
|
361
|
+
"Multi-piece shipments",
|
362
|
+
"International customs",
|
363
|
+
"Hazmat handling",
|
364
|
+
"Signature required"
|
365
|
+
],
|
366
|
+
"test_mode": True
|
367
|
+
}
|
368
|
+
|
369
|
+
# Assemble complete integration
|
370
|
+
result = assemble_complete_integration(
|
371
|
+
carrier_name="complexship",
|
372
|
+
integration_config=complex_config
|
373
|
+
)
|
374
|
+
|
375
|
+
print(f"ā Complex integration generated: {result['integration_complete']}")
|
376
|
+
print(f"ā Generated {len(result['generated_files'])} file types")
|
377
|
+
print(f"ā Project structure: {result['project_structure']['root']}")
|
378
|
+
|
379
|
+
# Print next steps
|
380
|
+
print("\nš Next Steps:")
|
381
|
+
for step in result['next_steps']:
|
382
|
+
print(f" - {step}")
|
383
|
+
|
384
|
+
return True
|
385
|
+
|
386
|
+
except Exception as e:
|
387
|
+
print(f"ā Mixed source integration test failed: {e}")
|
388
|
+
return False
|
389
|
+
|
390
|
+
|
391
|
+
def test_real_carrier_scenarios():
|
392
|
+
"""Test with realistic carrier scenarios."""
|
393
|
+
print("\n=== Testing Real Carrier Scenarios ===")
|
394
|
+
|
395
|
+
scenarios = [
|
396
|
+
{
|
397
|
+
"name": "European Carrier with VAT",
|
398
|
+
"carrier": "europost",
|
399
|
+
"complexity": "high",
|
400
|
+
"requirements": [
|
401
|
+
"VAT calculations",
|
402
|
+
"Customs documentation",
|
403
|
+
"Multi-language support",
|
404
|
+
"GDPR compliance"
|
405
|
+
]
|
406
|
+
},
|
407
|
+
{
|
408
|
+
"name": "Regional LTL Carrier",
|
409
|
+
"carrier": "regional_freight",
|
410
|
+
"complexity": "medium",
|
411
|
+
"requirements": [
|
412
|
+
"Weight-based pricing",
|
413
|
+
"Terminal locations",
|
414
|
+
"Pickup scheduling",
|
415
|
+
"Freight classifications"
|
416
|
+
]
|
417
|
+
},
|
418
|
+
{
|
419
|
+
"name": "E-commerce Last Mile",
|
420
|
+
"carrier": "lastmile_express",
|
421
|
+
"complexity": "low",
|
422
|
+
"requirements": [
|
423
|
+
"Simple API key auth",
|
424
|
+
"Standard package sizes",
|
425
|
+
"Basic tracking",
|
426
|
+
"Delivery windows"
|
427
|
+
]
|
428
|
+
}
|
429
|
+
]
|
430
|
+
|
431
|
+
success_count = 0
|
432
|
+
|
433
|
+
for scenario in scenarios:
|
434
|
+
print(f"\nš Testing: {scenario['name']}")
|
435
|
+
|
436
|
+
try:
|
437
|
+
# Generate integration for this scenario
|
438
|
+
config = {
|
439
|
+
"carrier_name": scenario["carrier"],
|
440
|
+
"operations": ["rates", "shipments", "tracking"],
|
441
|
+
"complexity": scenario["complexity"],
|
442
|
+
"special_requirements": scenario["requirements"],
|
443
|
+
"test_mode": True
|
444
|
+
}
|
445
|
+
|
446
|
+
result = assemble_complete_integration(
|
447
|
+
carrier_name=scenario["carrier"],
|
448
|
+
integration_config=config
|
449
|
+
)
|
450
|
+
|
451
|
+
if result["integration_complete"]:
|
452
|
+
print(f" ā {scenario['name']} integration successful")
|
453
|
+
success_count += 1
|
454
|
+
else:
|
455
|
+
print(f" ā ļø {scenario['name']} integration incomplete")
|
456
|
+
|
457
|
+
except Exception as e:
|
458
|
+
print(f" ā {scenario['name']} failed: {e}")
|
459
|
+
|
460
|
+
print(f"\nš Scenario Results: {success_count}/{len(scenarios)} successful")
|
461
|
+
return success_count == len(scenarios)
|
462
|
+
|
463
|
+
|
464
|
+
def main():
|
465
|
+
"""Run all real-world integration tests."""
|
466
|
+
print("š Starting Real-World Carrier Integration Tests")
|
467
|
+
print("=" * 60)
|
468
|
+
|
469
|
+
tests = [
|
470
|
+
("OpenAPI Specification", test_openapi_integration),
|
471
|
+
("URL Scraping", test_url_scraping_integration),
|
472
|
+
("PDF Documentation", test_pdf_documentation_integration),
|
473
|
+
("Mixed Sources", test_mixed_source_integration),
|
474
|
+
("Real Carrier Scenarios", test_real_carrier_scenarios),
|
475
|
+
]
|
476
|
+
|
477
|
+
passed = 0
|
478
|
+
failed = 0
|
479
|
+
|
480
|
+
for test_name, test_func in tests:
|
481
|
+
try:
|
482
|
+
print(f"\nš Running: {test_name}")
|
483
|
+
if test_func():
|
484
|
+
print(f"ā
{test_name}: PASSED")
|
485
|
+
passed += 1
|
486
|
+
else:
|
487
|
+
print(f"ā {test_name}: FAILED")
|
488
|
+
failed += 1
|
489
|
+
except Exception as e:
|
490
|
+
print(f"š„ {test_name}: CRASHED - {e}")
|
491
|
+
failed += 1
|
492
|
+
|
493
|
+
print("\n" + "=" * 60)
|
494
|
+
print(f"š Final Results: {passed} passed, {failed} failed")
|
495
|
+
|
496
|
+
if failed == 0:
|
497
|
+
print("š All real-world integration tests passed!")
|
498
|
+
print("\n⨠The ADK agent can handle:")
|
499
|
+
print(" ā
OpenAPI/Swagger specifications")
|
500
|
+
print(" ā
Web scraped documentation")
|
501
|
+
print(" ā
PDF documentation files")
|
502
|
+
print(" ā
Mixed source inputs")
|
503
|
+
print(" ā
Complex carrier requirements")
|
504
|
+
print("\nš Ready for production use!")
|
505
|
+
else:
|
506
|
+
print("ā ļø Some tests failed. Review the errors above.")
|
507
|
+
|
508
|
+
return failed == 0
|
509
|
+
|
510
|
+
|
511
|
+
if __name__ == "__main__":
|
512
|
+
success = main()
|
513
|
+
sys.exit(0 if success else 1)
|
File without changes
|