robosystems-client 0.1.9__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.
Potentially problematic release.
This version of robosystems-client might be problematic. Click here for more details.
- robosystems_client/__init__.py +14 -0
- robosystems_client/api/__init__.py +1 -0
- robosystems_client/api/agent/__init__.py +1 -0
- robosystems_client/api/agent/query_financial_agent.py +423 -0
- robosystems_client/api/auth/__init__.py +1 -0
- robosystems_client/api/auth/check_password_strength.py +172 -0
- robosystems_client/api/auth/complete_sso_auth.py +177 -0
- robosystems_client/api/auth/generate_sso_token.py +174 -0
- robosystems_client/api/auth/get_captcha_config.py +87 -0
- robosystems_client/api/auth/get_current_auth_user.py +220 -0
- robosystems_client/api/auth/get_password_policy.py +134 -0
- robosystems_client/api/auth/login_user.py +181 -0
- robosystems_client/api/auth/logout_user.py +169 -0
- robosystems_client/api/auth/refresh_session.py +174 -0
- robosystems_client/api/auth/register_user.py +189 -0
- robosystems_client/api/auth/sso_login.py +177 -0
- robosystems_client/api/auth/sso_token_exchange.py +181 -0
- robosystems_client/api/backup/__init__.py +1 -0
- robosystems_client/api/backup/create_backup.py +401 -0
- robosystems_client/api/backup/export_backup.py +225 -0
- robosystems_client/api/backup/get_backup_download_url.py +258 -0
- robosystems_client/api/backup/get_backup_stats.py +182 -0
- robosystems_client/api/backup/kuzu_backup_health.py +202 -0
- robosystems_client/api/backup/list_backups.py +217 -0
- robosystems_client/api/backup/restore_backup.py +401 -0
- robosystems_client/api/billing/__init__.py +1 -0
- robosystems_client/api/billing/get_available_subscription_plans_v1_graph_id_billing_available_plans_get.py +198 -0
- robosystems_client/api/billing/get_credit_billing_info_v1_graph_id_billing_credits_get.py +210 -0
- robosystems_client/api/billing/get_current_graph_bill.py +285 -0
- robosystems_client/api/billing/get_graph_billing_history.py +329 -0
- robosystems_client/api/billing/get_graph_monthly_bill.py +315 -0
- robosystems_client/api/billing/get_graph_pricing_info_v1_graph_id_billing_pricing_get.py +198 -0
- robosystems_client/api/billing/get_graph_subscription_v1_graph_id_billing_subscription_get.py +198 -0
- robosystems_client/api/billing/get_graph_usage_details.py +350 -0
- robosystems_client/api/billing/upgrade_graph_subscription_v1_graph_id_billing_subscription_upgrade_post.py +216 -0
- robosystems_client/api/connections/__init__.py +1 -0
- robosystems_client/api/connections/create_connection.py +327 -0
- robosystems_client/api/connections/create_link_token.py +281 -0
- robosystems_client/api/connections/delete_connection.py +278 -0
- robosystems_client/api/connections/exchange_link_token.py +301 -0
- robosystems_client/api/connections/get_connection.py +262 -0
- robosystems_client/api/connections/get_connection_options.py +285 -0
- robosystems_client/api/connections/init_o_auth.py +230 -0
- robosystems_client/api/connections/list_connections.py +314 -0
- robosystems_client/api/connections/oauth_callback.py +318 -0
- robosystems_client/api/connections/sync_connection.py +362 -0
- robosystems_client/api/create/__init__.py +1 -0
- robosystems_client/api/create/create_graph.py +375 -0
- robosystems_client/api/create/get_available_extensions.py +134 -0
- robosystems_client/api/credits_/__init__.py +1 -0
- robosystems_client/api/credits_/check_credit_balance.py +299 -0
- robosystems_client/api/credits_/check_storage_limits.py +249 -0
- robosystems_client/api/credits_/get_credit_summary.py +245 -0
- robosystems_client/api/credits_/get_storage_usage.py +279 -0
- robosystems_client/api/credits_/list_credit_transactions.py +392 -0
- robosystems_client/api/graph_analytics/__init__.py +1 -0
- robosystems_client/api/graph_analytics/get_graph_metrics.py +285 -0
- robosystems_client/api/graph_analytics/get_graph_usage_stats.py +329 -0
- robosystems_client/api/graph_status/__init__.py +1 -0
- robosystems_client/api/graph_status/get_database_health.py +273 -0
- robosystems_client/api/graph_status/get_database_info.py +277 -0
- robosystems_client/api/mcp/__init__.py +1 -0
- robosystems_client/api/mcp/call_mcp_tool.py +432 -0
- robosystems_client/api/mcp/list_mcp_tools.py +265 -0
- robosystems_client/api/operations/__init__.py +1 -0
- robosystems_client/api/operations/cancel_operation.py +246 -0
- robosystems_client/api/operations/get_operation_status.py +273 -0
- robosystems_client/api/operations/stream_operation_events.py +415 -0
- robosystems_client/api/query/__init__.py +1 -0
- robosystems_client/api/query/execute_cypher_query.py +482 -0
- robosystems_client/api/schema/__init__.py +1 -0
- robosystems_client/api/schema/export_graph_schema.py +239 -0
- robosystems_client/api/schema/get_graph_schema_info.py +277 -0
- robosystems_client/api/schema/list_schema_extensions.py +216 -0
- robosystems_client/api/schema/validate_schema.py +326 -0
- robosystems_client/api/service_offerings/__init__.py +1 -0
- robosystems_client/api/service_offerings/get_service_offerings.py +197 -0
- robosystems_client/api/status/__init__.py +1 -0
- robosystems_client/api/status/get_mcp_health.py +136 -0
- robosystems_client/api/status/get_service_status.py +134 -0
- robosystems_client/api/user/__init__.py +1 -0
- robosystems_client/api/user/create_user_api_key.py +205 -0
- robosystems_client/api/user/get_all_credit_summaries.py +256 -0
- robosystems_client/api/user/get_current_user.py +187 -0
- robosystems_client/api/user/get_user_graphs.py +187 -0
- robosystems_client/api/user/list_user_api_keys.py +187 -0
- robosystems_client/api/user/revoke_user_api_key.py +209 -0
- robosystems_client/api/user/select_user_graph.py +213 -0
- robosystems_client/api/user/update_user.py +205 -0
- robosystems_client/api/user/update_user_api_key.py +218 -0
- robosystems_client/api/user/update_user_password.py +218 -0
- robosystems_client/api/user_analytics/__init__.py +1 -0
- robosystems_client/api/user_analytics/get_detailed_user_analytics.py +222 -0
- robosystems_client/api/user_analytics/get_user_usage_overview.py +187 -0
- robosystems_client/api/user_limits/__init__.py +1 -0
- robosystems_client/api/user_limits/get_user_limits.py +190 -0
- robosystems_client/api/user_limits/get_user_usage.py +187 -0
- robosystems_client/api/user_subscriptions/__init__.py +1 -0
- robosystems_client/api/user_subscriptions/cancel_shared_repository_subscription.py +209 -0
- robosystems_client/api/user_subscriptions/get_repository_credits.py +206 -0
- robosystems_client/api/user_subscriptions/get_shared_repository_credits.py +193 -0
- robosystems_client/api/user_subscriptions/get_user_shared_subscriptions.py +213 -0
- robosystems_client/api/user_subscriptions/subscribe_to_shared_repository.py +214 -0
- robosystems_client/api/user_subscriptions/upgrade_shared_repository_subscription.py +228 -0
- robosystems_client/client.py +278 -0
- robosystems_client/errors.py +16 -0
- robosystems_client/extensions/README.md +611 -0
- robosystems_client/extensions/__init__.py +108 -0
- robosystems_client/extensions/auth_integration.py +210 -0
- robosystems_client/extensions/extensions.py +170 -0
- robosystems_client/extensions/operation_client.py +368 -0
- robosystems_client/extensions/query_client.py +375 -0
- robosystems_client/extensions/sse_client.py +520 -0
- robosystems_client/extensions/tests/__init__.py +1 -0
- robosystems_client/extensions/tests/test_integration.py +490 -0
- robosystems_client/extensions/tests/test_unit.py +560 -0
- robosystems_client/extensions/utils.py +526 -0
- robosystems_client/models/__init__.py +379 -0
- robosystems_client/models/account_info.py +79 -0
- robosystems_client/models/add_on_credit_info.py +119 -0
- robosystems_client/models/agent_message.py +68 -0
- robosystems_client/models/agent_request.py +132 -0
- robosystems_client/models/agent_request_context_type_0.py +44 -0
- robosystems_client/models/agent_response.py +132 -0
- robosystems_client/models/agent_response_metadata_type_0.py +44 -0
- robosystems_client/models/api_key_info.py +134 -0
- robosystems_client/models/api_keys_response.py +74 -0
- robosystems_client/models/auth_response.py +82 -0
- robosystems_client/models/auth_response_user.py +44 -0
- robosystems_client/models/available_extension.py +78 -0
- robosystems_client/models/available_extensions_response.py +73 -0
- robosystems_client/models/backup_create_request.py +117 -0
- robosystems_client/models/backup_export_request.py +72 -0
- robosystems_client/models/backup_list_response.py +90 -0
- robosystems_client/models/backup_response.py +200 -0
- robosystems_client/models/backup_restore_request.py +81 -0
- robosystems_client/models/backup_stats_response.py +156 -0
- robosystems_client/models/backup_stats_response_backup_formats.py +44 -0
- robosystems_client/models/cancel_operation_response_canceloperation.py +44 -0
- robosystems_client/models/cancellation_response.py +76 -0
- robosystems_client/models/check_credit_balance_response_checkcreditbalance.py +44 -0
- robosystems_client/models/connection_options_response.py +82 -0
- robosystems_client/models/connection_provider_info.py +203 -0
- robosystems_client/models/connection_provider_info_auth_type.py +11 -0
- robosystems_client/models/connection_provider_info_provider.py +10 -0
- robosystems_client/models/connection_response.py +149 -0
- robosystems_client/models/connection_response_metadata.py +44 -0
- robosystems_client/models/connection_response_provider.py +10 -0
- robosystems_client/models/create_api_key_request.py +82 -0
- robosystems_client/models/create_api_key_response.py +74 -0
- robosystems_client/models/create_connection_request.py +179 -0
- robosystems_client/models/create_connection_request_provider.py +10 -0
- robosystems_client/models/create_graph_request.py +183 -0
- robosystems_client/models/credit_check_request.py +82 -0
- robosystems_client/models/credit_summary.py +128 -0
- robosystems_client/models/credit_summary_response.py +140 -0
- robosystems_client/models/credits_summary_response.py +122 -0
- robosystems_client/models/credits_summary_response_credits_by_addon_item.py +44 -0
- robosystems_client/models/custom_schema_definition.py +194 -0
- robosystems_client/models/custom_schema_definition_metadata.py +49 -0
- robosystems_client/models/custom_schema_definition_nodes_item.py +44 -0
- robosystems_client/models/custom_schema_definition_relationships_item.py +44 -0
- robosystems_client/models/cypher_query_request.py +128 -0
- robosystems_client/models/cypher_query_request_parameters_type_0.py +44 -0
- robosystems_client/models/database_health_response.py +181 -0
- robosystems_client/models/database_info_response.py +191 -0
- robosystems_client/models/detailed_transactions_response.py +124 -0
- robosystems_client/models/detailed_transactions_response_date_range.py +44 -0
- robosystems_client/models/detailed_transactions_response_summary.py +59 -0
- robosystems_client/models/enhanced_credit_transaction_response.py +192 -0
- robosystems_client/models/enhanced_credit_transaction_response_metadata.py +44 -0
- robosystems_client/models/error_response.py +145 -0
- robosystems_client/models/exchange_token_request.py +116 -0
- robosystems_client/models/exchange_token_request_metadata_type_0.py +44 -0
- robosystems_client/models/get_all_credit_summaries_response_getallcreditsummaries.py +44 -0
- robosystems_client/models/get_backup_download_url_response_getbackupdownloadurl.py +44 -0
- robosystems_client/models/get_current_auth_user_response_getcurrentauthuser.py +44 -0
- robosystems_client/models/get_current_graph_bill_response_getcurrentgraphbill.py +44 -0
- robosystems_client/models/get_graph_billing_history_response_getgraphbillinghistory.py +44 -0
- robosystems_client/models/get_graph_monthly_bill_response_getgraphmonthlybill.py +44 -0
- robosystems_client/models/get_graph_schema_info_response_getgraphschemainfo.py +44 -0
- robosystems_client/models/get_graph_usage_details_response_getgraphusagedetails.py +44 -0
- robosystems_client/models/get_mcp_health_response_getmcphealth.py +44 -0
- robosystems_client/models/get_operation_status_response_getoperationstatus.py +44 -0
- robosystems_client/models/get_storage_usage_response_getstorageusage.py +44 -0
- robosystems_client/models/graph_info.py +92 -0
- robosystems_client/models/graph_metadata.py +105 -0
- robosystems_client/models/graph_metrics_response.py +188 -0
- robosystems_client/models/graph_metrics_response_estimated_size.py +44 -0
- robosystems_client/models/graph_metrics_response_health_status.py +44 -0
- robosystems_client/models/graph_metrics_response_node_counts.py +44 -0
- robosystems_client/models/graph_metrics_response_relationship_counts.py +44 -0
- robosystems_client/models/graph_usage_response.py +116 -0
- robosystems_client/models/graph_usage_response_query_statistics.py +44 -0
- robosystems_client/models/graph_usage_response_recent_activity.py +44 -0
- robosystems_client/models/graph_usage_response_storage_usage.py +44 -0
- robosystems_client/models/health_status.py +110 -0
- robosystems_client/models/health_status_details_type_0.py +44 -0
- robosystems_client/models/http_validation_error.py +75 -0
- robosystems_client/models/initial_entity_data.py +212 -0
- robosystems_client/models/kuzu_backup_health_response_kuzubackuphealth.py +44 -0
- robosystems_client/models/link_token_request.py +174 -0
- robosystems_client/models/link_token_request_options_type_0.py +44 -0
- robosystems_client/models/link_token_request_provider_type_0.py +10 -0
- robosystems_client/models/list_connections_provider_type_0.py +10 -0
- robosystems_client/models/list_schema_extensions_response_listschemaextensions.py +44 -0
- robosystems_client/models/login_request.py +68 -0
- robosystems_client/models/logout_user_response_logoutuser.py +44 -0
- robosystems_client/models/mcp_tool_call.py +84 -0
- robosystems_client/models/mcp_tool_call_arguments.py +44 -0
- robosystems_client/models/mcp_tools_response.py +74 -0
- robosystems_client/models/mcp_tools_response_tools_item.py +44 -0
- robosystems_client/models/o_auth_callback_request.py +130 -0
- robosystems_client/models/o_auth_init_request.py +128 -0
- robosystems_client/models/o_auth_init_request_additional_params_type_0.py +44 -0
- robosystems_client/models/o_auth_init_response.py +78 -0
- robosystems_client/models/password_check_request.py +82 -0
- robosystems_client/models/password_check_response.py +112 -0
- robosystems_client/models/password_check_response_character_types.py +44 -0
- robosystems_client/models/password_policy_response.py +66 -0
- robosystems_client/models/password_policy_response_policy.py +44 -0
- robosystems_client/models/plaid_connection_config.py +209 -0
- robosystems_client/models/plaid_connection_config_accounts_type_0_item.py +44 -0
- robosystems_client/models/plaid_connection_config_institution_type_0.py +44 -0
- robosystems_client/models/quick_books_connection_config.py +92 -0
- robosystems_client/models/register_request.py +98 -0
- robosystems_client/models/repository_credits_response.py +101 -0
- robosystems_client/models/repository_plan.py +10 -0
- robosystems_client/models/repository_type.py +10 -0
- robosystems_client/models/response_mode.py +11 -0
- robosystems_client/models/schema_export_response.py +163 -0
- robosystems_client/models/schema_export_response_data_stats_type_0.py +44 -0
- robosystems_client/models/schema_export_response_schema_definition_type_0.py +44 -0
- robosystems_client/models/schema_validation_request.py +142 -0
- robosystems_client/models/schema_validation_request_schema_definition_type_0.py +44 -0
- robosystems_client/models/schema_validation_response.py +227 -0
- robosystems_client/models/schema_validation_response_compatibility_type_0.py +44 -0
- robosystems_client/models/schema_validation_response_stats_type_0.py +44 -0
- robosystems_client/models/sec_connection_config.py +82 -0
- robosystems_client/models/sso_complete_request.py +60 -0
- robosystems_client/models/sso_exchange_request.py +90 -0
- robosystems_client/models/sso_exchange_response.py +78 -0
- robosystems_client/models/sso_login_request.py +60 -0
- robosystems_client/models/sso_token_response.py +78 -0
- robosystems_client/models/storage_limit_response.py +149 -0
- robosystems_client/models/subscription_info.py +180 -0
- robosystems_client/models/subscription_info_metadata.py +44 -0
- robosystems_client/models/subscription_request.py +89 -0
- robosystems_client/models/subscription_response.py +82 -0
- robosystems_client/models/success_response.py +112 -0
- robosystems_client/models/success_response_data_type_0.py +44 -0
- robosystems_client/models/sync_connection_request.py +106 -0
- robosystems_client/models/sync_connection_request_sync_options_type_0.py +44 -0
- robosystems_client/models/sync_connection_response_syncconnection.py +44 -0
- robosystems_client/models/tier_upgrade_request.py +62 -0
- robosystems_client/models/transaction_summary_response.py +126 -0
- robosystems_client/models/update_api_key_request.py +92 -0
- robosystems_client/models/update_password_request.py +76 -0
- robosystems_client/models/update_user_request.py +92 -0
- robosystems_client/models/upgrade_subscription_request.py +82 -0
- robosystems_client/models/user_analytics_response.py +132 -0
- robosystems_client/models/user_analytics_response_api_usage.py +44 -0
- robosystems_client/models/user_analytics_response_graph_usage.py +44 -0
- robosystems_client/models/user_analytics_response_limits.py +44 -0
- robosystems_client/models/user_analytics_response_recent_activity_item.py +44 -0
- robosystems_client/models/user_analytics_response_user_info.py +44 -0
- robosystems_client/models/user_graph_summary.py +134 -0
- robosystems_client/models/user_graphs_response.py +96 -0
- robosystems_client/models/user_limits_response.py +95 -0
- robosystems_client/models/user_response.py +132 -0
- robosystems_client/models/user_subscriptions_response.py +90 -0
- robosystems_client/models/user_usage_response.py +90 -0
- robosystems_client/models/user_usage_response_graphs.py +44 -0
- robosystems_client/models/user_usage_summary_response.py +130 -0
- robosystems_client/models/user_usage_summary_response_usage_vs_limits.py +44 -0
- robosystems_client/models/validation_error.py +88 -0
- robosystems_client/py.typed +1 -0
- robosystems_client/sdk-config.yaml +5 -0
- robosystems_client/types.py +54 -0
- robosystems_client-0.1.9.dist-info/METADATA +302 -0
- robosystems_client-0.1.9.dist-info/RECORD +282 -0
- robosystems_client-0.1.9.dist-info/WHEEL +4 -0
|
@@ -0,0 +1,611 @@
|
|
|
1
|
+
# RoboSystems Python Client Extensions
|
|
2
|
+
|
|
3
|
+
🚀 **Production-Ready Extensions** for the RoboSystems Financial Knowledge Graph API
|
|
4
|
+
|
|
5
|
+
[](https://www.python.org/downloads/)
|
|
6
|
+
[](https://opensource.org/licenses/MIT)
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
The RoboSystems Python Client Extensions provide enhanced functionality for the auto-generated Python Client, adding:
|
|
11
|
+
|
|
12
|
+
- **Server-Sent Events (SSE)** streaming with automatic reconnection
|
|
13
|
+
- **Smart Query Execution** with automatic strategy selection
|
|
14
|
+
- **Operation Monitoring** for long-running operations
|
|
15
|
+
- **Connection Pooling** and intelligent resource management
|
|
16
|
+
- **Result Processing** and format conversion utilities
|
|
17
|
+
- **Caching** with TTL and LRU eviction
|
|
18
|
+
- **Full Async/Await Support** throughout
|
|
19
|
+
|
|
20
|
+
## 🚀 Quick Start
|
|
21
|
+
|
|
22
|
+
### Installation
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
# Install the extensions (part of the main client)
|
|
26
|
+
pip install robosystems-client
|
|
27
|
+
|
|
28
|
+
# Optional dependencies for enhanced features
|
|
29
|
+
pip install httpx pandas # For SSE and DataFrame support
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### Basic Usage
|
|
33
|
+
|
|
34
|
+
```python
|
|
35
|
+
from robosystems_client.extensions import create_production_extensions
|
|
36
|
+
|
|
37
|
+
# Initialize with API key
|
|
38
|
+
extensions = create_production_extensions("your-api-key-here")
|
|
39
|
+
|
|
40
|
+
# Execute a simple query
|
|
41
|
+
result = extensions.execute_query(
|
|
42
|
+
graph_id="your_graph_id",
|
|
43
|
+
query="MATCH (c:Company) RETURN c.name, c.revenue LIMIT 10"
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
print(f"Found {result.row_count} companies")
|
|
47
|
+
for company in result.data:
|
|
48
|
+
print(f"- {company['name']}: ${company['revenue']:,}")
|
|
49
|
+
|
|
50
|
+
# Clean up
|
|
51
|
+
extensions.close()
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Streaming Large Results
|
|
55
|
+
|
|
56
|
+
```python
|
|
57
|
+
# Stream large datasets efficiently
|
|
58
|
+
query = "MATCH (t:Transaction) RETURN t.id, t.amount, t.timestamp"
|
|
59
|
+
|
|
60
|
+
for transaction in extensions.stream_query("your_graph_id", query, chunk_size=1000):
|
|
61
|
+
# Process each transaction as it arrives
|
|
62
|
+
process_transaction(transaction)
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Async Support
|
|
66
|
+
|
|
67
|
+
```python
|
|
68
|
+
import asyncio
|
|
69
|
+
from robosystems_client.extensions import AsyncRoboSystemsExtensions
|
|
70
|
+
|
|
71
|
+
async def main():
|
|
72
|
+
extensions = AsyncRoboSystemsExtensions(config)
|
|
73
|
+
|
|
74
|
+
# Async query execution
|
|
75
|
+
result = await extensions.execute_query("graph_id", "MATCH (n) RETURN COUNT(n)")
|
|
76
|
+
print(f"Total nodes: {result.data[0]['COUNT(n)']}")
|
|
77
|
+
|
|
78
|
+
# Async streaming
|
|
79
|
+
async for row in extensions.stream_query("graph_id", "MATCH (n) RETURN n"):
|
|
80
|
+
await process_row_async(row)
|
|
81
|
+
|
|
82
|
+
await extensions.close()
|
|
83
|
+
|
|
84
|
+
asyncio.run(main())
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## 🔐 Authentication
|
|
88
|
+
|
|
89
|
+
### API Key Authentication (Recommended)
|
|
90
|
+
|
|
91
|
+
```python
|
|
92
|
+
from robosystems_client.extensions import AuthenticatedExtensions
|
|
93
|
+
|
|
94
|
+
extensions = AuthenticatedExtensions(
|
|
95
|
+
api_key="your-api-key-here",
|
|
96
|
+
base_url="https://api.robosystems.ai"
|
|
97
|
+
)
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### Cookie Authentication
|
|
101
|
+
|
|
102
|
+
```python
|
|
103
|
+
from robosystems_client.extensions import CookieAuthExtensions
|
|
104
|
+
|
|
105
|
+
extensions = CookieAuthExtensions(
|
|
106
|
+
cookies={"auth-token": "your-cookie-token"},
|
|
107
|
+
base_url="https://api.robosystems.ai"
|
|
108
|
+
)
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### JWT Token Authentication
|
|
112
|
+
|
|
113
|
+
```python
|
|
114
|
+
from robosystems_client.extensions import TokenExtensions
|
|
115
|
+
|
|
116
|
+
extensions = TokenExtensions(
|
|
117
|
+
token="your-jwt-token",
|
|
118
|
+
base_url="https://api.robosystems.ai"
|
|
119
|
+
)
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### Environment-Specific Configurations
|
|
123
|
+
|
|
124
|
+
```python
|
|
125
|
+
from robosystems_client.extensions import create_extensions
|
|
126
|
+
|
|
127
|
+
# Production
|
|
128
|
+
prod_ext = create_extensions(
|
|
129
|
+
'api_key',
|
|
130
|
+
api_key=os.getenv('ROBOSYSTEMS_API_KEY'),
|
|
131
|
+
base_url="https://api.robosystems.ai"
|
|
132
|
+
)
|
|
133
|
+
|
|
134
|
+
# Development
|
|
135
|
+
dev_ext = create_extensions(
|
|
136
|
+
'api_key',
|
|
137
|
+
api_key="dev-key-123",
|
|
138
|
+
base_url="http://localhost:8000"
|
|
139
|
+
)
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
## 🛠 Advanced Features
|
|
143
|
+
|
|
144
|
+
### Query Builder
|
|
145
|
+
|
|
146
|
+
Build complex Cypher queries programmatically:
|
|
147
|
+
|
|
148
|
+
```python
|
|
149
|
+
from robosystems_client.extensions import QueryBuilder
|
|
150
|
+
|
|
151
|
+
builder = QueryBuilder()
|
|
152
|
+
query, params = (builder
|
|
153
|
+
.match("(c:Company)-[:HAS_TRANSACTION]->(t:Transaction)")
|
|
154
|
+
.match("(c)-[:LOCATED_IN]->(l:Location)")
|
|
155
|
+
.where("c.revenue > $min_revenue")
|
|
156
|
+
.where("l.country = $country")
|
|
157
|
+
.return_("c.name", "c.revenue", "COUNT(t) as tx_count", "l.city")
|
|
158
|
+
.order_by("tx_count DESC", "c.revenue DESC")
|
|
159
|
+
.limit(50)
|
|
160
|
+
.with_param("min_revenue", 1000000)
|
|
161
|
+
.with_param("country", "USA")
|
|
162
|
+
.build())
|
|
163
|
+
|
|
164
|
+
print("Generated Query:")
|
|
165
|
+
print(query)
|
|
166
|
+
print("Parameters:", params)
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
### Query Validation & Cost Estimation
|
|
170
|
+
|
|
171
|
+
```python
|
|
172
|
+
from robosystems_client.extensions import validate_cypher_query, estimate_query_cost
|
|
173
|
+
|
|
174
|
+
# Validate syntax
|
|
175
|
+
validation = validate_cypher_query(query)
|
|
176
|
+
if not validation['valid']:
|
|
177
|
+
print("Query issues:", validation['issues'])
|
|
178
|
+
|
|
179
|
+
# Estimate complexity
|
|
180
|
+
cost = estimate_query_cost(query, params)
|
|
181
|
+
print(f"Complexity: {cost['complexity_category']} (score: {cost['complexity_score']})")
|
|
182
|
+
|
|
183
|
+
# Get optimization recommendations
|
|
184
|
+
for rec in cost['recommendations']:
|
|
185
|
+
print(f"💡 {rec}")
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
### Result Processing
|
|
189
|
+
|
|
190
|
+
Convert results to different formats:
|
|
191
|
+
|
|
192
|
+
```python
|
|
193
|
+
from robosystems_client.extensions import ResultProcessor
|
|
194
|
+
|
|
195
|
+
# Convert to JSON
|
|
196
|
+
json_output = ResultProcessor.to_json(result, pretty=True)
|
|
197
|
+
|
|
198
|
+
# Convert to CSV
|
|
199
|
+
csv_output = ResultProcessor.to_csv(result)
|
|
200
|
+
|
|
201
|
+
# Convert to pandas DataFrame (if pandas installed)
|
|
202
|
+
try:
|
|
203
|
+
df = ResultProcessor.to_dataframe(result)
|
|
204
|
+
print(df.head())
|
|
205
|
+
except ImportError:
|
|
206
|
+
print("pandas not installed")
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
### Caching
|
|
210
|
+
|
|
211
|
+
Cache expensive queries automatically:
|
|
212
|
+
|
|
213
|
+
```python
|
|
214
|
+
from robosystems_client.extensions import CacheManager
|
|
215
|
+
|
|
216
|
+
cache = CacheManager(max_size=100, ttl_seconds=300) # 5 minute TTL
|
|
217
|
+
|
|
218
|
+
# Cache is used automatically by extensions, or manually:
|
|
219
|
+
cached_result = cache.get("graph_id", query, parameters)
|
|
220
|
+
if not cached_result:
|
|
221
|
+
result = extensions.execute_query("graph_id", query, parameters)
|
|
222
|
+
cache.set("graph_id", query, result, parameters)
|
|
223
|
+
else:
|
|
224
|
+
print("Using cached result!")
|
|
225
|
+
|
|
226
|
+
# View cache statistics
|
|
227
|
+
print(cache.stats())
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
### Progress Tracking
|
|
231
|
+
|
|
232
|
+
Monitor long-running operations:
|
|
233
|
+
|
|
234
|
+
```python
|
|
235
|
+
from robosystems_client.extensions import ProgressTracker
|
|
236
|
+
|
|
237
|
+
def progress_handler(progress):
|
|
238
|
+
print(f"Step {progress.current_step}/{progress.total_steps}: {progress.message}")
|
|
239
|
+
if progress.percentage:
|
|
240
|
+
print(f"Progress: {progress.percentage}%")
|
|
241
|
+
|
|
242
|
+
# Monitor operation with progress callback
|
|
243
|
+
result = extensions.monitor_operation("operation_id", progress_handler)
|
|
244
|
+
print(f"Operation completed: {result.status}")
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
### SSE Streaming
|
|
248
|
+
|
|
249
|
+
Direct SSE connection for real-time events:
|
|
250
|
+
|
|
251
|
+
```python
|
|
252
|
+
from robosystems_client.extensions import SSEClient, SSEConfig, EventType
|
|
253
|
+
|
|
254
|
+
config = SSEConfig(base_url="https://api.robosystems.ai")
|
|
255
|
+
client = SSEClient(config)
|
|
256
|
+
|
|
257
|
+
# Set up event handlers
|
|
258
|
+
def handle_progress(data):
|
|
259
|
+
print(f"Progress: {data['message']}")
|
|
260
|
+
|
|
261
|
+
def handle_data_chunk(data):
|
|
262
|
+
print(f"Received {len(data.get('rows', []))} rows")
|
|
263
|
+
|
|
264
|
+
client.on(EventType.OPERATION_PROGRESS.value, handle_progress)
|
|
265
|
+
client.on(EventType.DATA_CHUNK.value, handle_data_chunk)
|
|
266
|
+
|
|
267
|
+
# Connect and monitor
|
|
268
|
+
client.connect("operation_id")
|
|
269
|
+
|
|
270
|
+
# Clean up
|
|
271
|
+
client.close()
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
## 📊 Examples
|
|
275
|
+
|
|
276
|
+
### Financial Data Analysis
|
|
277
|
+
|
|
278
|
+
```python
|
|
279
|
+
from robosystems_client.extensions import create_production_extensions, QueryBuilder
|
|
280
|
+
|
|
281
|
+
extensions = create_production_extensions(api_key)
|
|
282
|
+
|
|
283
|
+
# Find top performing companies by revenue growth
|
|
284
|
+
builder = QueryBuilder()
|
|
285
|
+
query, params = (builder
|
|
286
|
+
.match("(c:Company)-[:HAS_FINANCIAL_REPORT]->(r:FinancialReport)")
|
|
287
|
+
.where("r.year >= $start_year")
|
|
288
|
+
.where("c.revenue > $min_revenue")
|
|
289
|
+
.return_("c.name", "c.revenue", "r.year", "r.revenue_growth_rate")
|
|
290
|
+
.order_by("r.revenue_growth_rate DESC")
|
|
291
|
+
.limit(20)
|
|
292
|
+
.with_param("start_year", 2020)
|
|
293
|
+
.with_param("min_revenue", 10000000)
|
|
294
|
+
.build())
|
|
295
|
+
|
|
296
|
+
result = extensions.execute_query("financial_graph", query, params)
|
|
297
|
+
|
|
298
|
+
print("Top 20 Companies by Revenue Growth:")
|
|
299
|
+
for company in result.data:
|
|
300
|
+
print(f"- {company['name']}: {company['revenue_growth_rate']:.1f}% growth")
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
### Batch Processing with Streaming
|
|
304
|
+
|
|
305
|
+
```python
|
|
306
|
+
from robosystems_client.extensions import DataBatcher, format_duration
|
|
307
|
+
import time
|
|
308
|
+
|
|
309
|
+
# Process large transaction dataset in batches
|
|
310
|
+
batcher = DataBatcher(batch_size=5000, timeout_seconds=10.0)
|
|
311
|
+
total_processed = 0
|
|
312
|
+
start_time = time.time()
|
|
313
|
+
|
|
314
|
+
query = "MATCH (t:Transaction) WHERE t.amount > $min_amount RETURN t"
|
|
315
|
+
params = {"min_amount": 1000}
|
|
316
|
+
|
|
317
|
+
for transaction in extensions.stream_query("transactions_graph", query, params):
|
|
318
|
+
batch = batcher.add(transaction)
|
|
319
|
+
|
|
320
|
+
if batch:
|
|
321
|
+
# Process batch
|
|
322
|
+
process_transaction_batch(batch)
|
|
323
|
+
total_processed += len(batch)
|
|
324
|
+
|
|
325
|
+
if total_processed % 50000 == 0:
|
|
326
|
+
elapsed = time.time() - start_time
|
|
327
|
+
print(f"Processed {total_processed:,} transactions in {format_duration(int(elapsed * 1000))}")
|
|
328
|
+
|
|
329
|
+
# Process final batch
|
|
330
|
+
final_batch = batcher.flush()
|
|
331
|
+
if final_batch:
|
|
332
|
+
process_transaction_batch(final_batch)
|
|
333
|
+
total_processed += len(final_batch)
|
|
334
|
+
|
|
335
|
+
print(f"✅ Processed {total_processed:,} transactions total")
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
### Error Handling
|
|
339
|
+
|
|
340
|
+
```python
|
|
341
|
+
from robosystems_client.extensions import QueuedQueryError
|
|
342
|
+
|
|
343
|
+
try:
|
|
344
|
+
result = extensions.execute_query("graph_id", "COMPLEX LONG RUNNING QUERY")
|
|
345
|
+
print(f"Query completed: {len(result.data)} results")
|
|
346
|
+
|
|
347
|
+
except QueuedQueryError as e:
|
|
348
|
+
print(f"Query was queued at position {e.queue_info.queue_position}")
|
|
349
|
+
print(f"Estimated wait time: {e.queue_info.estimated_wait_seconds}s")
|
|
350
|
+
|
|
351
|
+
# Wait for completion or cancel
|
|
352
|
+
choice = input("Wait for completion? (y/n): ")
|
|
353
|
+
if choice.lower() == 'y':
|
|
354
|
+
result = extensions.monitor_operation(e.queue_info.operation_id)
|
|
355
|
+
print(f"Query completed: {result.status}")
|
|
356
|
+
else:
|
|
357
|
+
cancelled = extensions.cancel_operation(e.queue_info.operation_id)
|
|
358
|
+
print(f"Query cancelled: {cancelled}")
|
|
359
|
+
|
|
360
|
+
except Exception as e:
|
|
361
|
+
print(f"Query failed: {e}")
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
## ⚡ Performance Optimization
|
|
365
|
+
|
|
366
|
+
### Connection Pooling
|
|
367
|
+
|
|
368
|
+
Extensions automatically manage SSE connections with pooling:
|
|
369
|
+
|
|
370
|
+
```python
|
|
371
|
+
# Configure connection limits
|
|
372
|
+
config = RoboSystemsExtensionConfig(
|
|
373
|
+
max_retries=5,
|
|
374
|
+
retry_delay=2000, # 2 seconds
|
|
375
|
+
timeout=60
|
|
376
|
+
)
|
|
377
|
+
|
|
378
|
+
extensions = RoboSystemsExtensions(config)
|
|
379
|
+
```
|
|
380
|
+
|
|
381
|
+
### Query Optimization
|
|
382
|
+
|
|
383
|
+
Use query analysis tools:
|
|
384
|
+
|
|
385
|
+
```python
|
|
386
|
+
from robosystems_client.extensions import estimate_query_cost, validate_cypher_query
|
|
387
|
+
|
|
388
|
+
# Analyze before execution
|
|
389
|
+
query = "MATCH (c:Company) WHERE c.revenue > 1000000 RETURN c"
|
|
390
|
+
|
|
391
|
+
# Check syntax
|
|
392
|
+
validation = validate_cypher_query(query)
|
|
393
|
+
if not validation['valid']:
|
|
394
|
+
print("❌ Query has syntax errors:", validation['issues'])
|
|
395
|
+
|
|
396
|
+
# Estimate cost
|
|
397
|
+
cost = estimate_query_cost(query)
|
|
398
|
+
print(f"📊 Query complexity: {cost['complexity_category']}")
|
|
399
|
+
|
|
400
|
+
# Follow recommendations
|
|
401
|
+
for rec in cost['recommendations']:
|
|
402
|
+
print(f"💡 Optimization tip: {rec}")
|
|
403
|
+
|
|
404
|
+
# Execute only if reasonable complexity
|
|
405
|
+
if cost['complexity_category'] in ['low', 'medium']:
|
|
406
|
+
result = extensions.execute_query("graph_id", query)
|
|
407
|
+
else:
|
|
408
|
+
print("⚠️ Query may be too expensive - consider optimization")
|
|
409
|
+
```
|
|
410
|
+
|
|
411
|
+
### Caching Strategy
|
|
412
|
+
|
|
413
|
+
```python
|
|
414
|
+
# Set up tiered caching
|
|
415
|
+
schema_cache = CacheManager(max_size=10, ttl_seconds=3600) # 1 hour for schemas
|
|
416
|
+
query_cache = CacheManager(max_size=100, ttl_seconds=300) # 5 minutes for queries
|
|
417
|
+
results_cache = CacheManager(max_size=1000, ttl_seconds=60) # 1 minute for results
|
|
418
|
+
|
|
419
|
+
# Use appropriate cache based on query type
|
|
420
|
+
if "SCHEMA" in query.upper():
|
|
421
|
+
cache = schema_cache
|
|
422
|
+
elif any(keyword in query.upper() for keyword in ["COUNT", "SUM", "AVG"]):
|
|
423
|
+
cache = query_cache
|
|
424
|
+
else:
|
|
425
|
+
cache = results_cache
|
|
426
|
+
```
|
|
427
|
+
|
|
428
|
+
## 🧪 Testing
|
|
429
|
+
|
|
430
|
+
Run the test suite:
|
|
431
|
+
|
|
432
|
+
```bash
|
|
433
|
+
# Run all tests
|
|
434
|
+
python run_tests.py
|
|
435
|
+
|
|
436
|
+
# Or individual test suites
|
|
437
|
+
python -c "from robosystems_client.extensions.tests.test_unit import run_unit_tests; run_unit_tests()"
|
|
438
|
+
python -c "from robosystems_client.extensions.tests.test_integration import run_integration_tests; run_integration_tests()"
|
|
439
|
+
```
|
|
440
|
+
|
|
441
|
+
### Writing Tests
|
|
442
|
+
|
|
443
|
+
```python
|
|
444
|
+
from robosystems_client.extensions import AuthenticatedExtensions
|
|
445
|
+
from unittest.mock import Mock, patch
|
|
446
|
+
|
|
447
|
+
def test_query_execution():
|
|
448
|
+
extensions = AuthenticatedExtensions("test-key")
|
|
449
|
+
|
|
450
|
+
with patch('robosystems_client.extensions.auth_integration.sync_detailed') as mock_query:
|
|
451
|
+
# Mock successful response
|
|
452
|
+
mock_response = Mock()
|
|
453
|
+
mock_response.parsed.data = [{"count": 100}]
|
|
454
|
+
mock_query.return_value = mock_response
|
|
455
|
+
|
|
456
|
+
result = extensions.execute_cypher_query("test_graph", "MATCH (n) RETURN count(n)")
|
|
457
|
+
assert result["data"] == [{"count": 100}]
|
|
458
|
+
```
|
|
459
|
+
|
|
460
|
+
## 🔧 Configuration
|
|
461
|
+
|
|
462
|
+
### Environment Variables
|
|
463
|
+
|
|
464
|
+
```bash
|
|
465
|
+
# API Configuration
|
|
466
|
+
export ROBOSYSTEMS_API_URL="https://api.robosystems.ai"
|
|
467
|
+
export ROBOSYSTEMS_API_KEY="your-api-key"
|
|
468
|
+
export ROBOSYSTEMS_GRAPH_ID="your-graph-id"
|
|
469
|
+
|
|
470
|
+
# Connection Settings
|
|
471
|
+
export ROBOSYSTEMS_MAX_RETRIES="5"
|
|
472
|
+
export ROBOSYSTEMS_TIMEOUT="60"
|
|
473
|
+
export ROBOSYSTEMS_RETRY_DELAY="2000"
|
|
474
|
+
```
|
|
475
|
+
|
|
476
|
+
### Configuration Object
|
|
477
|
+
|
|
478
|
+
```python
|
|
479
|
+
from robosystems_client.extensions import RoboSystemsExtensionConfig
|
|
480
|
+
|
|
481
|
+
config = RoboSystemsExtensionConfig(
|
|
482
|
+
base_url="https://api.robosystems.ai",
|
|
483
|
+
headers={
|
|
484
|
+
"X-Custom-Header": "value",
|
|
485
|
+
"X-Client-Version": "1.0.0"
|
|
486
|
+
},
|
|
487
|
+
max_retries=3,
|
|
488
|
+
retry_delay=1500,
|
|
489
|
+
timeout=45
|
|
490
|
+
)
|
|
491
|
+
|
|
492
|
+
extensions = RoboSystemsExtensions(config)
|
|
493
|
+
```
|
|
494
|
+
|
|
495
|
+
## 📚 API Reference
|
|
496
|
+
|
|
497
|
+
### Core Classes
|
|
498
|
+
|
|
499
|
+
- **`RoboSystemsExtensions`** - Main extensions class
|
|
500
|
+
- **`AuthenticatedExtensions`** - API key authentication
|
|
501
|
+
- **`CookieAuthExtensions`** - Cookie authentication
|
|
502
|
+
- **`TokenExtensions`** - JWT token authentication
|
|
503
|
+
- **`AsyncRoboSystemsExtensions`** - Async version
|
|
504
|
+
|
|
505
|
+
### SSE Components
|
|
506
|
+
|
|
507
|
+
- **`SSEClient`** - Server-Sent Events client
|
|
508
|
+
- **`SSEConfig`** - SSE configuration
|
|
509
|
+
- **`EventType`** - Standard event types enum
|
|
510
|
+
|
|
511
|
+
### Query Components
|
|
512
|
+
|
|
513
|
+
- **`QueryClient`** - Enhanced query execution
|
|
514
|
+
- **`QueryBuilder`** - Programmatic query building
|
|
515
|
+
- **`QueryResult`** - Query result data structure
|
|
516
|
+
|
|
517
|
+
### Utilities
|
|
518
|
+
|
|
519
|
+
- **`ResultProcessor`** - Format conversion utilities
|
|
520
|
+
- **`CacheManager`** - Smart caching with LRU eviction
|
|
521
|
+
- **`ProgressTracker`** - Operation progress monitoring
|
|
522
|
+
- **`DataBatcher`** - Batch processing helper
|
|
523
|
+
|
|
524
|
+
### Functions
|
|
525
|
+
|
|
526
|
+
- **`validate_cypher_query(query)`** - Query syntax validation
|
|
527
|
+
- **`estimate_query_cost(query, params)`** - Complexity analysis
|
|
528
|
+
- **`format_duration(milliseconds)`** - Human-readable time formatting
|
|
529
|
+
- **`create_extensions(method, **kwargs)`** - Extensions factory
|
|
530
|
+
|
|
531
|
+
## 🐛 Troubleshooting
|
|
532
|
+
|
|
533
|
+
### Common Issues
|
|
534
|
+
|
|
535
|
+
**Import Errors**
|
|
536
|
+
```python
|
|
537
|
+
# Make sure all dependencies are installed
|
|
538
|
+
pip install httpx # For SSE support
|
|
539
|
+
pip install pandas # For DataFrame conversion (optional)
|
|
540
|
+
```
|
|
541
|
+
|
|
542
|
+
**Authentication Failures**
|
|
543
|
+
```python
|
|
544
|
+
# Verify API key is valid
|
|
545
|
+
extensions = AuthenticatedExtensions("your-api-key")
|
|
546
|
+
try:
|
|
547
|
+
result = extensions.execute_query("graph_id", "MATCH (n) RETURN count(n) LIMIT 1")
|
|
548
|
+
print("✅ Authentication successful")
|
|
549
|
+
except Exception as e:
|
|
550
|
+
print(f"❌ Auth failed: {e}")
|
|
551
|
+
```
|
|
552
|
+
|
|
553
|
+
**Connection Issues**
|
|
554
|
+
```python
|
|
555
|
+
# Check base URL and connectivity
|
|
556
|
+
import httpx
|
|
557
|
+
|
|
558
|
+
try:
|
|
559
|
+
response = httpx.get("https://api.robosystems.ai/health", timeout=10)
|
|
560
|
+
print(f"API Status: {response.status_code}")
|
|
561
|
+
except Exception as e:
|
|
562
|
+
print(f"Connection failed: {e}")
|
|
563
|
+
```
|
|
564
|
+
|
|
565
|
+
**SSE Streaming Issues**
|
|
566
|
+
```python
|
|
567
|
+
# Enable debug logging for SSE events
|
|
568
|
+
config = SSEConfig(base_url="https://api.robosystems.ai")
|
|
569
|
+
client = SSEClient(config)
|
|
570
|
+
|
|
571
|
+
def debug_handler(data):
|
|
572
|
+
print(f"SSE Event: {data}")
|
|
573
|
+
|
|
574
|
+
client.on("event", debug_handler)
|
|
575
|
+
```
|
|
576
|
+
|
|
577
|
+
### Debug Mode
|
|
578
|
+
|
|
579
|
+
```python
|
|
580
|
+
# Enable detailed logging
|
|
581
|
+
import logging
|
|
582
|
+
logging.basicConfig(level=logging.DEBUG)
|
|
583
|
+
|
|
584
|
+
# This will show internal HTTP requests and SSE events
|
|
585
|
+
extensions = AuthenticatedExtensions("your-key")
|
|
586
|
+
```
|
|
587
|
+
|
|
588
|
+
## 📄 License
|
|
589
|
+
|
|
590
|
+
MIT License - see [LICENSE](LICENSE) file for details.
|
|
591
|
+
|
|
592
|
+
## 🤝 Contributing
|
|
593
|
+
|
|
594
|
+
1. Fork the repository
|
|
595
|
+
2. Create a feature branch
|
|
596
|
+
3. Add tests for new functionality
|
|
597
|
+
4. Run the test suite: `python run_tests.py`
|
|
598
|
+
5. Submit a pull request
|
|
599
|
+
|
|
600
|
+
## 📞 Support
|
|
601
|
+
|
|
602
|
+
- **Documentation**: [docs.robosystems.ai](https://docs.robosystems.ai)
|
|
603
|
+
- **API Reference**: [api.robosystems.ai/docs](https://api.robosystems.ai/docs)
|
|
604
|
+
- **Issues**: [GitHub Issues](https://github.com/robosystems/python-sdk/issues)
|
|
605
|
+
- **Email**: support@robosystems.ai
|
|
606
|
+
|
|
607
|
+
---
|
|
608
|
+
|
|
609
|
+
**RoboSystems Python Client Extensions** - Production-ready streaming, monitoring, and query capabilities for financial knowledge graphs.
|
|
610
|
+
|
|
611
|
+
*Built with ❤️ by the RoboSystems team*
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
"""RoboSystems SDK Extensions for Python
|
|
2
|
+
|
|
3
|
+
Enhanced clients with SSE support for the RoboSystems API.
|
|
4
|
+
Provides seamless integration with streaming operations, queue management,
|
|
5
|
+
and advanced query capabilities.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from .sse_client import SSEClient, EventType, SSEEvent, SSEConfig
|
|
9
|
+
from .query_client import (
|
|
10
|
+
QueryClient,
|
|
11
|
+
QueryResult,
|
|
12
|
+
QueuedQueryResponse,
|
|
13
|
+
QueryRequest,
|
|
14
|
+
QueryOptions,
|
|
15
|
+
QueuedQueryError,
|
|
16
|
+
)
|
|
17
|
+
from .operation_client import (
|
|
18
|
+
OperationClient,
|
|
19
|
+
OperationStatus,
|
|
20
|
+
OperationProgress,
|
|
21
|
+
OperationResult,
|
|
22
|
+
)
|
|
23
|
+
from .extensions import (
|
|
24
|
+
RoboSystemsExtensions,
|
|
25
|
+
RoboSystemsExtensionConfig,
|
|
26
|
+
AsyncRoboSystemsExtensions,
|
|
27
|
+
)
|
|
28
|
+
from .utils import (
|
|
29
|
+
QueryBuilder,
|
|
30
|
+
ResultProcessor,
|
|
31
|
+
CacheManager,
|
|
32
|
+
ProgressTracker,
|
|
33
|
+
DataBatcher,
|
|
34
|
+
QueryStats,
|
|
35
|
+
ConnectionInfo,
|
|
36
|
+
estimate_query_cost,
|
|
37
|
+
format_duration,
|
|
38
|
+
validate_cypher_query,
|
|
39
|
+
)
|
|
40
|
+
from .auth_integration import (
|
|
41
|
+
AuthenticatedExtensions,
|
|
42
|
+
CookieAuthExtensions,
|
|
43
|
+
TokenExtensions,
|
|
44
|
+
create_extensions,
|
|
45
|
+
create_production_extensions,
|
|
46
|
+
create_development_extensions,
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
__all__ = [
|
|
50
|
+
# Core extension classes
|
|
51
|
+
"RoboSystemsExtensions",
|
|
52
|
+
"RoboSystemsExtensionConfig",
|
|
53
|
+
"AsyncRoboSystemsExtensions",
|
|
54
|
+
# SSE Client
|
|
55
|
+
"SSEClient",
|
|
56
|
+
"EventType",
|
|
57
|
+
"SSEEvent",
|
|
58
|
+
"SSEConfig",
|
|
59
|
+
# Query Client
|
|
60
|
+
"QueryClient",
|
|
61
|
+
"QueryResult",
|
|
62
|
+
"QueuedQueryResponse",
|
|
63
|
+
"QueryRequest",
|
|
64
|
+
"QueryOptions",
|
|
65
|
+
"QueuedQueryError",
|
|
66
|
+
# Operation Client
|
|
67
|
+
"OperationClient",
|
|
68
|
+
"OperationStatus",
|
|
69
|
+
"OperationProgress",
|
|
70
|
+
"OperationResult",
|
|
71
|
+
# Utilities
|
|
72
|
+
"QueryBuilder",
|
|
73
|
+
"ResultProcessor",
|
|
74
|
+
"CacheManager",
|
|
75
|
+
"ProgressTracker",
|
|
76
|
+
"DataBatcher",
|
|
77
|
+
"QueryStats",
|
|
78
|
+
"ConnectionInfo",
|
|
79
|
+
"estimate_query_cost",
|
|
80
|
+
"format_duration",
|
|
81
|
+
"validate_cypher_query",
|
|
82
|
+
# Authentication Integration
|
|
83
|
+
"AuthenticatedExtensions",
|
|
84
|
+
"CookieAuthExtensions",
|
|
85
|
+
"TokenExtensions",
|
|
86
|
+
"create_extensions",
|
|
87
|
+
"create_production_extensions",
|
|
88
|
+
"create_development_extensions",
|
|
89
|
+
]
|
|
90
|
+
|
|
91
|
+
# Create a default extensions instance
|
|
92
|
+
extensions = RoboSystemsExtensions()
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
# Export convenience functions
|
|
96
|
+
def monitor_operation(operation_id: str, on_progress=None):
|
|
97
|
+
"""Monitor an operation using the default extensions instance"""
|
|
98
|
+
return extensions.monitor_operation(operation_id, on_progress)
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
def execute_query(graph_id: str, query: str, parameters=None):
|
|
102
|
+
"""Execute a query using the default extensions instance"""
|
|
103
|
+
return extensions.query.query(graph_id, query, parameters)
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
def stream_query(graph_id: str, query: str, parameters=None, chunk_size=None):
|
|
107
|
+
"""Stream a query using the default extensions instance"""
|
|
108
|
+
return extensions.query.stream_query(graph_id, query, parameters, chunk_size)
|