trendsagi 0.1.1__tar.gz → 0.1.3__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.
- {trendsagi-0.1.1/src/trendsagi.egg-info → trendsagi-0.1.3}/PKG-INFO +13 -9
- {trendsagi-0.1.1 → trendsagi-0.1.3}/README.md +12 -8
- {trendsagi-0.1.1 → trendsagi-0.1.3}/pyproject.toml +1 -1
- {trendsagi-0.1.1 → trendsagi-0.1.3}/src/trendsagi/client.py +8 -2
- {trendsagi-0.1.1 → trendsagi-0.1.3}/src/trendsagi/models.py +31 -22
- {trendsagi-0.1.1 → trendsagi-0.1.3/src/trendsagi.egg-info}/PKG-INFO +13 -9
- {trendsagi-0.1.1 → trendsagi-0.1.3}/LICENSE +0 -0
- {trendsagi-0.1.1 → trendsagi-0.1.3}/setup.cfg +0 -0
- {trendsagi-0.1.1 → trendsagi-0.1.3}/src/trendsagi/__init__.py +0 -0
- {trendsagi-0.1.1 → trendsagi-0.1.3}/src/trendsagi/exceptions.py +0 -0
- {trendsagi-0.1.1 → trendsagi-0.1.3}/src/trendsagi.egg-info/SOURCES.txt +0 -0
- {trendsagi-0.1.1 → trendsagi-0.1.3}/src/trendsagi.egg-info/dependency_links.txt +0 -0
- {trendsagi-0.1.1 → trendsagi-0.1.3}/src/trendsagi.egg-info/requires.txt +0 -0
- {trendsagi-0.1.1 → trendsagi-0.1.3}/src/trendsagi.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: trendsagi
|
3
|
-
Version: 0.1.
|
3
|
+
Version: 0.1.3
|
4
4
|
Summary: The official Python client for the TrendsAGI API.
|
5
5
|
Author-email: TrendsAGI <contact@trendsagi.com>
|
6
6
|
License: MIT License
|
@@ -96,9 +96,11 @@ We strongly recommend storing your API key as an environment variable to avoid c
|
|
96
96
|
export TRENDSAGI_API_KEY="your_api_key_here"
|
97
97
|
```
|
98
98
|
|
99
|
+
|
100
|
+
|
99
101
|
### Quickstart Example
|
100
102
|
|
101
|
-
This example demonstrates how to initialize the client and fetch the latest trending topics.
|
103
|
+
This example demonstrates how to initialize the client and fetch the latest trending topics, including new analytics fields.
|
102
104
|
|
103
105
|
```python
|
104
106
|
import os
|
@@ -119,9 +121,16 @@ try:
|
|
119
121
|
print("Fetching top 5 trending topics...")
|
120
122
|
response = client.get_trends(limit=5, period='24h')
|
121
123
|
|
122
|
-
print(f"\nFound {response.meta.total} total trends. Displaying the top {len(response.trends)}:")
|
124
|
+
print(f"\nFound {response.meta.total} total trends. Displaying the top {len(response.trends)} with new analytics:")
|
123
125
|
for trend in response.trends:
|
124
|
-
|
126
|
+
# --- START OF MODIFICATIONS ---
|
127
|
+
print(f"\n- Trend: '{trend.name}' (ID: {trend.id})")
|
128
|
+
print(f" - Current Volume: {trend.volume}")
|
129
|
+
print(f" - Overall Trend: {trend.overall_trend}")
|
130
|
+
print(f" - Avg. Velocity: {trend.average_velocity:.2f} posts/hr" if trend.average_velocity is not None else " - Avg. Velocity: N/A")
|
131
|
+
print(f" - Stability Score: {trend.trend_stability:.2f}" if trend.trend_stability is not None else " - Stability Score: N/A")
|
132
|
+
# --- END OF MODIFICATIONS ---
|
133
|
+
|
125
134
|
|
126
135
|
except exceptions.AuthenticationError:
|
127
136
|
print("Authentication failed. Please check your API key.")
|
@@ -138,8 +147,6 @@ except exceptions.TrendsAGIError as e:
|
|
138
147
|
Retrieve AI-generated insights for a specific trend, such as key themes, target audiences, and content ideas.
|
139
148
|
|
140
149
|
```python
|
141
|
-
# Assuming 'client' is an initialized TrendsAGIClient
|
142
|
-
# and you have a trend_id from a call to get_trends()
|
143
150
|
TREND_ID = 12345
|
144
151
|
|
145
152
|
try:
|
@@ -163,7 +170,6 @@ except exceptions.APIError as e:
|
|
163
170
|
### Perform a Deep Analysis on a Topic
|
164
171
|
|
165
172
|
```python
|
166
|
-
# Assuming 'client' is an initialized TrendsAGIClient
|
167
173
|
try:
|
168
174
|
print("\nPerforming deep analysis on 'artificial intelligence'...")
|
169
175
|
analysis = client.perform_deep_analysis(
|
@@ -185,7 +191,6 @@ except exceptions.APIError as e:
|
|
185
191
|
Add a user to your tracked market entities in the Intelligence Suite.
|
186
192
|
|
187
193
|
```python
|
188
|
-
# Assuming 'client' is an initialized TrendsAGIClient
|
189
194
|
try:
|
190
195
|
print("\nAdding a new X user to track...")
|
191
196
|
new_entity = client.create_tracked_x_user(
|
@@ -206,7 +211,6 @@ except exceptions.APIError as e:
|
|
206
211
|
Retrieve any active crisis events detected by the system.
|
207
212
|
|
208
213
|
```python
|
209
|
-
# Assuming 'client' is an initialized TrendsAGIClient
|
210
214
|
try:
|
211
215
|
print("\nChecking for active crisis events...")
|
212
216
|
crisis_response = client.get_crisis_events(status='active', limit=5)
|
@@ -56,9 +56,11 @@ We strongly recommend storing your API key as an environment variable to avoid c
|
|
56
56
|
export TRENDSAGI_API_KEY="your_api_key_here"
|
57
57
|
```
|
58
58
|
|
59
|
+
|
60
|
+
|
59
61
|
### Quickstart Example
|
60
62
|
|
61
|
-
This example demonstrates how to initialize the client and fetch the latest trending topics.
|
63
|
+
This example demonstrates how to initialize the client and fetch the latest trending topics, including new analytics fields.
|
62
64
|
|
63
65
|
```python
|
64
66
|
import os
|
@@ -79,9 +81,16 @@ try:
|
|
79
81
|
print("Fetching top 5 trending topics...")
|
80
82
|
response = client.get_trends(limit=5, period='24h')
|
81
83
|
|
82
|
-
print(f"\nFound {response.meta.total} total trends. Displaying the top {len(response.trends)}:")
|
84
|
+
print(f"\nFound {response.meta.total} total trends. Displaying the top {len(response.trends)} with new analytics:")
|
83
85
|
for trend in response.trends:
|
84
|
-
|
86
|
+
# --- START OF MODIFICATIONS ---
|
87
|
+
print(f"\n- Trend: '{trend.name}' (ID: {trend.id})")
|
88
|
+
print(f" - Current Volume: {trend.volume}")
|
89
|
+
print(f" - Overall Trend: {trend.overall_trend}")
|
90
|
+
print(f" - Avg. Velocity: {trend.average_velocity:.2f} posts/hr" if trend.average_velocity is not None else " - Avg. Velocity: N/A")
|
91
|
+
print(f" - Stability Score: {trend.trend_stability:.2f}" if trend.trend_stability is not None else " - Stability Score: N/A")
|
92
|
+
# --- END OF MODIFICATIONS ---
|
93
|
+
|
85
94
|
|
86
95
|
except exceptions.AuthenticationError:
|
87
96
|
print("Authentication failed. Please check your API key.")
|
@@ -98,8 +107,6 @@ except exceptions.TrendsAGIError as e:
|
|
98
107
|
Retrieve AI-generated insights for a specific trend, such as key themes, target audiences, and content ideas.
|
99
108
|
|
100
109
|
```python
|
101
|
-
# Assuming 'client' is an initialized TrendsAGIClient
|
102
|
-
# and you have a trend_id from a call to get_trends()
|
103
110
|
TREND_ID = 12345
|
104
111
|
|
105
112
|
try:
|
@@ -123,7 +130,6 @@ except exceptions.APIError as e:
|
|
123
130
|
### Perform a Deep Analysis on a Topic
|
124
131
|
|
125
132
|
```python
|
126
|
-
# Assuming 'client' is an initialized TrendsAGIClient
|
127
133
|
try:
|
128
134
|
print("\nPerforming deep analysis on 'artificial intelligence'...")
|
129
135
|
analysis = client.perform_deep_analysis(
|
@@ -145,7 +151,6 @@ except exceptions.APIError as e:
|
|
145
151
|
Add a user to your tracked market entities in the Intelligence Suite.
|
146
152
|
|
147
153
|
```python
|
148
|
-
# Assuming 'client' is an initialized TrendsAGIClient
|
149
154
|
try:
|
150
155
|
print("\nAdding a new X user to track...")
|
151
156
|
new_entity = client.create_tracked_x_user(
|
@@ -166,7 +171,6 @@ except exceptions.APIError as e:
|
|
166
171
|
Retrieve any active crisis events detected by the system.
|
167
172
|
|
168
173
|
```python
|
169
|
-
# Assuming 'client' is an initialized TrendsAGIClient
|
170
174
|
try:
|
171
175
|
print("\nChecking for active crisis events...")
|
172
176
|
crisis_response = client.get_crisis_events(status='active', limit=5)
|
@@ -57,6 +57,9 @@ class TrendsAGIClient:
|
|
57
57
|
|
58
58
|
# --- Trends & Insights Methods ---
|
59
59
|
|
60
|
+
# --- START OF FIX ---
|
61
|
+
# Added start_date and end_date to the function signature.
|
62
|
+
# The `locals()` trick will automatically pick them up and add them to params if they are not None.
|
60
63
|
def get_trends(
|
61
64
|
self,
|
62
65
|
search: Optional[str] = None,
|
@@ -65,8 +68,11 @@ class TrendsAGIClient:
|
|
65
68
|
limit: int = 20,
|
66
69
|
offset: int = 0,
|
67
70
|
period: str = '24h',
|
68
|
-
category: Optional[str] = None
|
71
|
+
category: Optional[str] = None,
|
72
|
+
start_date: Optional[str] = None,
|
73
|
+
end_date: Optional[str] = None
|
69
74
|
) -> models.TrendListResponse:
|
75
|
+
# --- END OF FIX ---
|
70
76
|
"""
|
71
77
|
Retrieve a list of currently trending topics.
|
72
78
|
"""
|
@@ -140,7 +146,7 @@ class TrendsAGIClient:
|
|
140
146
|
source_trend_query: Optional[str] = None, priority: Optional[str] = None, status: str = 'new'
|
141
147
|
) -> models.RecommendationListResponse:
|
142
148
|
"""
|
143
|
-
Get actionable recommendations generated for the
|
149
|
+
Get actionable recommendations generated for the.
|
144
150
|
"""
|
145
151
|
params = {
|
146
152
|
"limit": limit, "offset": offset, "type": recommendation_type,
|
@@ -18,6 +18,8 @@ class PaginationMeta(OrmBaseModel):
|
|
18
18
|
order: Optional[str] = None
|
19
19
|
search: Optional[str] = None
|
20
20
|
category: Optional[str] = None
|
21
|
+
start_date: Optional[date] = None
|
22
|
+
end_date: Optional[date] = None
|
21
23
|
|
22
24
|
# --- Trends & Insights Models ---
|
23
25
|
class TrendItem(OrmBaseModel):
|
@@ -30,6 +32,9 @@ class TrendItem(OrmBaseModel):
|
|
30
32
|
growth: Optional[float] = None
|
31
33
|
previous_volume: Optional[int] = None
|
32
34
|
absolute_change: Optional[int] = None
|
35
|
+
average_velocity: Optional[float] = Field(None, description="Average velocity (posts/hour) over recent snapshots.")
|
36
|
+
trend_stability: Optional[float] = Field(None, description="Standard deviation of volume over recent snapshots. Lower is more stable.")
|
37
|
+
overall_trend: Optional[str] = Field(None, description="Qualitative assessment of the trend's direction (growing, declining, stable).")
|
33
38
|
|
34
39
|
class TrendListResponse(OrmBaseModel):
|
35
40
|
trends: List[TrendItem]
|
@@ -54,7 +59,7 @@ class TrendDetail(TrendItem):
|
|
54
59
|
class TrendDataPoint(OrmBaseModel):
|
55
60
|
date: datetime
|
56
61
|
volume: Optional[int] = None
|
57
|
-
|
62
|
+
velocity_per_hour: Optional[float] = None # Corrected from growth_rate to match API docs
|
58
63
|
|
59
64
|
class TrendAnalytics(OrmBaseModel):
|
60
65
|
trend_id: int
|
@@ -107,6 +112,8 @@ class ReportMeta(OrmBaseModel):
|
|
107
112
|
time_period: str
|
108
113
|
start_date: Optional[str] = None
|
109
114
|
end_date: Optional[str] = None
|
115
|
+
usage_count: Optional[int] = None
|
116
|
+
usage_limit: Optional[int] = None
|
110
117
|
|
111
118
|
class CustomReport(OrmBaseModel):
|
112
119
|
columns: List[str]
|
@@ -175,33 +182,36 @@ class CrisisEventListResponse(OrmBaseModel):
|
|
175
182
|
events: List[CrisisEvent]
|
176
183
|
meta: PaginationMeta
|
177
184
|
|
178
|
-
class DeepAnalysisSentiment(OrmBaseModel):
|
179
|
-
overall_sentiment_category: str
|
180
|
-
positive_nuances: List[str]
|
181
|
-
negative_nuances: List[str]
|
182
|
-
neutral_aspects: List[str]
|
183
|
-
|
184
|
-
class DeepAnalysisActionableInsights(OrmBaseModel):
|
185
|
-
marketing_pr: List[str]
|
186
|
-
product_development: List[str]
|
187
|
-
crm_strategy: List[str]
|
188
|
-
|
189
185
|
class DeepAnalysisRelatedTrend(OrmBaseModel):
|
190
186
|
id: str
|
191
187
|
name: str
|
192
188
|
|
189
|
+
# --- START OF FINAL FIX ---
|
190
|
+
# This model is updated to be a flat structure, removing the nested sub-models.
|
191
|
+
# It now directly matches the simplified dictionary being sent by the server.
|
193
192
|
class DeepAnalysis(OrmBaseModel):
|
194
193
|
query_analyzed: str
|
195
194
|
generated_at: datetime
|
196
195
|
llm_model_used: str
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
196
|
+
|
197
|
+
# These fields are now simple types, not nested models.
|
198
|
+
executive_summary_and_key_findings: Dict[str, Any]
|
199
|
+
nuanced_sentiment_analysis: Dict[str, Any]
|
200
|
+
market_drivers_and_causal_factors: List[str]
|
201
|
+
identified_risks_and_mitigation: List[Dict[str, Any]]
|
202
|
+
actionable_strategic_recommendations: Dict[str, Any]
|
203
|
+
|
204
|
+
# The following fields were missing from the client model but are present in the server response.
|
205
|
+
# Add them here to prevent validation errors.
|
206
|
+
overall_summary: Optional[str] = None
|
207
|
+
key_findings: Optional[List[str]] = None
|
208
|
+
sentiment_analysis: Optional[Dict[str, Any]] = None
|
209
|
+
causal_factors: Optional[List[str]] = None
|
210
|
+
emerging_sub_topics: Optional[List[str]] = None
|
211
|
+
future_outlook_and_predictions: Optional[List[str]] = None
|
212
|
+
actionable_insights_for_roles: Optional[Dict[str, Any]] = None
|
213
|
+
related_trends: Optional[List[DeepAnalysisRelatedTrend]] = None
|
214
|
+
# --- END OF FINAL FIX ---
|
205
215
|
|
206
216
|
# --- User & Account Management Models ---
|
207
217
|
class TopicInterest(OrmBaseModel):
|
@@ -268,14 +278,13 @@ class SubscriptionPlan(OrmBaseModel):
|
|
268
278
|
class ComponentStatus(OrmBaseModel):
|
269
279
|
name: str
|
270
280
|
status: str
|
271
|
-
description: str
|
281
|
+
# description: str # This field was in the server schema but not the client; remove or add as needed.
|
272
282
|
|
273
283
|
class StatusPage(OrmBaseModel):
|
274
284
|
overall_status: str
|
275
285
|
last_updated: datetime
|
276
286
|
components: List[ComponentStatus]
|
277
287
|
|
278
|
-
# NEW: Model for API Status History
|
279
288
|
class StatusHistoryResponse(OrmBaseModel):
|
280
289
|
uptime_percentages: Dict[str, float]
|
281
290
|
daily_statuses: Dict[str, Dict[str, str]]
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: trendsagi
|
3
|
-
Version: 0.1.
|
3
|
+
Version: 0.1.3
|
4
4
|
Summary: The official Python client for the TrendsAGI API.
|
5
5
|
Author-email: TrendsAGI <contact@trendsagi.com>
|
6
6
|
License: MIT License
|
@@ -96,9 +96,11 @@ We strongly recommend storing your API key as an environment variable to avoid c
|
|
96
96
|
export TRENDSAGI_API_KEY="your_api_key_here"
|
97
97
|
```
|
98
98
|
|
99
|
+
|
100
|
+
|
99
101
|
### Quickstart Example
|
100
102
|
|
101
|
-
This example demonstrates how to initialize the client and fetch the latest trending topics.
|
103
|
+
This example demonstrates how to initialize the client and fetch the latest trending topics, including new analytics fields.
|
102
104
|
|
103
105
|
```python
|
104
106
|
import os
|
@@ -119,9 +121,16 @@ try:
|
|
119
121
|
print("Fetching top 5 trending topics...")
|
120
122
|
response = client.get_trends(limit=5, period='24h')
|
121
123
|
|
122
|
-
print(f"\nFound {response.meta.total} total trends. Displaying the top {len(response.trends)}:")
|
124
|
+
print(f"\nFound {response.meta.total} total trends. Displaying the top {len(response.trends)} with new analytics:")
|
123
125
|
for trend in response.trends:
|
124
|
-
|
126
|
+
# --- START OF MODIFICATIONS ---
|
127
|
+
print(f"\n- Trend: '{trend.name}' (ID: {trend.id})")
|
128
|
+
print(f" - Current Volume: {trend.volume}")
|
129
|
+
print(f" - Overall Trend: {trend.overall_trend}")
|
130
|
+
print(f" - Avg. Velocity: {trend.average_velocity:.2f} posts/hr" if trend.average_velocity is not None else " - Avg. Velocity: N/A")
|
131
|
+
print(f" - Stability Score: {trend.trend_stability:.2f}" if trend.trend_stability is not None else " - Stability Score: N/A")
|
132
|
+
# --- END OF MODIFICATIONS ---
|
133
|
+
|
125
134
|
|
126
135
|
except exceptions.AuthenticationError:
|
127
136
|
print("Authentication failed. Please check your API key.")
|
@@ -138,8 +147,6 @@ except exceptions.TrendsAGIError as e:
|
|
138
147
|
Retrieve AI-generated insights for a specific trend, such as key themes, target audiences, and content ideas.
|
139
148
|
|
140
149
|
```python
|
141
|
-
# Assuming 'client' is an initialized TrendsAGIClient
|
142
|
-
# and you have a trend_id from a call to get_trends()
|
143
150
|
TREND_ID = 12345
|
144
151
|
|
145
152
|
try:
|
@@ -163,7 +170,6 @@ except exceptions.APIError as e:
|
|
163
170
|
### Perform a Deep Analysis on a Topic
|
164
171
|
|
165
172
|
```python
|
166
|
-
# Assuming 'client' is an initialized TrendsAGIClient
|
167
173
|
try:
|
168
174
|
print("\nPerforming deep analysis on 'artificial intelligence'...")
|
169
175
|
analysis = client.perform_deep_analysis(
|
@@ -185,7 +191,6 @@ except exceptions.APIError as e:
|
|
185
191
|
Add a user to your tracked market entities in the Intelligence Suite.
|
186
192
|
|
187
193
|
```python
|
188
|
-
# Assuming 'client' is an initialized TrendsAGIClient
|
189
194
|
try:
|
190
195
|
print("\nAdding a new X user to track...")
|
191
196
|
new_entity = client.create_tracked_x_user(
|
@@ -206,7 +211,6 @@ except exceptions.APIError as e:
|
|
206
211
|
Retrieve any active crisis events detected by the system.
|
207
212
|
|
208
213
|
```python
|
209
|
-
# Assuming 'client' is an initialized TrendsAGIClient
|
210
214
|
try:
|
211
215
|
print("\nChecking for active crisis events...")
|
212
216
|
crisis_response = client.get_crisis_events(status='active', limit=5)
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|