Python SDK for integrating with the EchoIntel AI API
Project description
EchoIntel Python SDK
Python SDK for integrating with the EchoIntel AI API. Provides forecasting, customer segmentation, inventory optimization, and other AI-powered analytics capabilities.
Installation
pip install echointel
Quick Start
Synchronous Client
from echointel import EchoIntelClient
# Initialize the client
client = EchoIntelClient(
customer_api_id="your-api-id",
secret="your-secret"
)
# Forecast revenue
result = client.forecast_revenue({
"sales": [...],
"forecast_period": 12
})
print(result)
Async Client
import asyncio
from echointel import AsyncEchoIntelClient
async def main():
async with AsyncEchoIntelClient(
customer_api_id="your-api-id",
secret="your-secret"
) as client:
result = await client.forecast_revenue({
"sales": [...],
"forecast_period": 12
})
print(result)
asyncio.run(main())
Configuration
The SDK can be configured via constructor arguments or environment variables:
| Constructor Argument | Environment Variable | Default |
|---|---|---|
base_url |
ECHOINTEL_API_URL |
https://ai.echosistema.live |
customer_api_id |
ECHOINTEL_CUSTOMER_API_ID |
- |
secret |
ECHOINTEL_SECRET |
- |
admin_secret |
ECHOINTEL_ADMIN_SECRET |
- |
timeout |
ECHOINTEL_TIMEOUT |
30 |
Using Environment Variables
export ECHOINTEL_CUSTOMER_API_ID="your-api-id"
export ECHOINTEL_SECRET="your-secret"
from echointel import EchoIntelClient
# Credentials are automatically loaded from environment
client = EchoIntelClient()
Available Endpoints
Forecasting
forecast_revenue(data)- Forecast revenueforecast_cost(data)- Forecast costforecast_cost_improved(data)- Improved cost forecastingforecast_units(data)- Forecast units/quantityforecast_cost_totus(data)- Totus algorithm forecasting
Inventory
inventory_optimization(data)- Optimize inventory levelsinventory_history_improved(data)- Analyze inventory history
Customer Analytics
customer_segmentation(data)- Segment customerscustomer_features(data)- Build customer featurescustomer_loyalty(data)- Calculate loyalty scorescustomer_rfm(data)- RFM analysiscustomer_clv_features(data)- CLV feature extractioncustomer_clv_forecast(data)- CLV forecasting
Churn Analysis
churn_risk(data)- Predict churn riskchurn_label(data)- Generate churn labels
NPS
nps(data)- Calculate Net Promoter Score
Propensity Modeling
propensity_buy_product(data)- Purchase propensitypropensity_respond_campaign(data)- Campaign response propensitypropensity_upgrade_plan(data)- Upgrade propensity
Recommendations
recommend_user_items(data)- User item recommendationsrecommend_similar_items(data)- Similar item recommendations
Cross-Sell & Upsell
cross_sell_matrix(data)- Cross-sell opportunity matrixupsell_suggestions(data)- Upsell suggestions
Dynamic Pricing
dynamic_pricing_recommend(data)- Pricing recommendations
Sentiment Analysis
sentiment_report(data)- Sentiment reportsentiment_realtime(data)- Real-time sentiment
Anomaly Detection
anomaly_transactions(data)- Transaction anomaliesanomaly_accounts(data)- Account anomaliesanomaly_graph(data)- Graph-based anomalies
Credit Risk
credit_risk_score(data)- Credit risk scorescredit_risk_explain(data)- Credit risk explanation
Marketing Attribution
channel_attribution(data)- Channel attributionuplift_model(data)- Uplift modeling
Customer Journey
journey_markov(data)- Markov chain analysisjourney_sequences(data)- Journey sequence analysis
NLP & Text Processing
nlp_analysis(data)- NLP analysis (Portuguese)nlp_analysis_en(data)- NLP analysis (English)nlp_excess_inventory_report(data)- Excess inventory reportsanitize_text(data)- Text sanitization
Admin Operations (requires admin_secret)
create_customer(data)- Create customerlist_customers(include_disabled=False)- List customersget_customer(customer_id)- Get customer detailsupdate_customer(customer_id, data)- Update customerdelete_customer(customer_id)- Delete customer
Error Handling
from echointel import (
EchoIntelClient,
EchoIntelException,
EchoIntelAuthenticationException,
EchoIntelValidationException,
)
client = EchoIntelClient()
try:
result = client.forecast_revenue(data)
except EchoIntelAuthenticationException as e:
print(f"Authentication failed: {e}")
except EchoIntelValidationException as e:
print(f"Validation error: {e}")
print(f"Field errors: {e.get_errors()}")
except EchoIntelException as e:
print(f"API error: {e}")
print(f"Status code: {e.status_code}")
Response Objects
The SDK provides typed response classes for structured data:
from echointel.responses import ForecastUnitsResponse
result = client.forecast_units(data)
response = ForecastUnitsResponse.from_dict(result)
print(f"Forecast period: {response.forecast_period}")
for forecast in response.forecasts:
print(f"Product: {forecast.product_code}")
print(f"Best algorithm: {forecast.best_algorithm}")
Route Resolver
Use the RouteResolver to work with API routes:
from echointel import RouteResolver
# Get all routes in a category
routes = RouteResolver.resolve(["forecasting"])
# Get specific routes
routes = RouteResolver.resolve(["forecasting.revenue", "customer.rfm"])
# Get all non-admin routes
routes = RouteResolver.resolve(["*"])
# List categories
categories = RouteResolver.categories()
# List endpoints in a category
endpoints = RouteResolver.endpoints("forecasting")
Requirements
- Python 3.10+
- httpx >= 0.24.0
- tenacity >= 8.0.0
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file echointel-1.0.0.tar.gz.
File metadata
- Download URL: echointel-1.0.0.tar.gz
- Upload date:
- Size: 19.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
438344ed90a076db691d6c88da8afcaed84eaed74c904136df3b9b0440b23114
|
|
| MD5 |
2f0c7a12cd0c2a9af1579cf183f6578e
|
|
| BLAKE2b-256 |
7df1efa86a39002203bd8d39fb67d78d5940f3d0f6488cae982a691f6f29cf25
|
File details
Details for the file echointel-1.0.0-py3-none-any.whl.
File metadata
- Download URL: echointel-1.0.0-py3-none-any.whl
- Upload date:
- Size: 32.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d38888fdda030aab587bf9bb2e5eaa6a414ddb5a59b18a80e932781eb9404f3d
|
|
| MD5 |
7b527d2ac4ffd1330efade98c2836725
|
|
| BLAKE2b-256 |
e0c4a4480ec74177cfab46790059bf4f1648cfafde84ecf95bbb73f8d528a2c9
|