trendsagi 0.1.2__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: trendsagi
3
- Version: 0.1.2
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
- print(f"- ID: {trend.id}, Name: '{trend.name}', Volume: {trend.volume}")
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
- print(f"- ID: {trend.id}, Name: '{trend.name}', Volume: {trend.volume}")
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)
@@ -6,7 +6,7 @@ build-backend = "setuptools.build_meta"
6
6
 
7
7
  [project]
8
8
  name = "trendsagi"
9
- version = "0.1.2"
9
+ version = "0.1.3"
10
10
  authors = [
11
11
  { name="TrendsAGI", email="contact@trendsagi.com" },
12
12
  ]
@@ -18,12 +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 OF FIX ---
22
- # Add these optional fields to match the updated server response.
23
- # They will be populated when a custom date range is used.
24
21
  start_date: Optional[date] = None
25
22
  end_date: Optional[date] = None
26
- # --- END OF FIX ---
27
23
 
28
24
  # --- Trends & Insights Models ---
29
25
  class TrendItem(OrmBaseModel):
@@ -36,6 +32,9 @@ class TrendItem(OrmBaseModel):
36
32
  growth: Optional[float] = None
37
33
  previous_volume: Optional[int] = None
38
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).")
39
38
 
40
39
  class TrendListResponse(OrmBaseModel):
41
40
  trends: List[TrendItem]
@@ -60,7 +59,7 @@ class TrendDetail(TrendItem):
60
59
  class TrendDataPoint(OrmBaseModel):
61
60
  date: datetime
62
61
  volume: Optional[int] = None
63
- growth_rate: Optional[float] = None
62
+ velocity_per_hour: Optional[float] = None # Corrected from growth_rate to match API docs
64
63
 
65
64
  class TrendAnalytics(OrmBaseModel):
66
65
  trend_id: int
@@ -113,6 +112,8 @@ class ReportMeta(OrmBaseModel):
113
112
  time_period: str
114
113
  start_date: Optional[str] = None
115
114
  end_date: Optional[str] = None
115
+ usage_count: Optional[int] = None
116
+ usage_limit: Optional[int] = None
116
117
 
117
118
  class CustomReport(OrmBaseModel):
118
119
  columns: List[str]
@@ -181,33 +182,36 @@ class CrisisEventListResponse(OrmBaseModel):
181
182
  events: List[CrisisEvent]
182
183
  meta: PaginationMeta
183
184
 
184
- class DeepAnalysisSentiment(OrmBaseModel):
185
- overall_sentiment_category: str
186
- positive_nuances: List[str]
187
- negative_nuances: List[str]
188
- neutral_aspects: List[str]
189
-
190
- class DeepAnalysisActionableInsights(OrmBaseModel):
191
- marketing_pr: List[str]
192
- product_development: List[str]
193
- crm_strategy: List[str]
194
-
195
185
  class DeepAnalysisRelatedTrend(OrmBaseModel):
196
186
  id: str
197
187
  name: str
198
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.
199
192
  class DeepAnalysis(OrmBaseModel):
200
193
  query_analyzed: str
201
194
  generated_at: datetime
202
195
  llm_model_used: str
203
- overall_summary: str
204
- key_findings: List[str]
205
- sentiment_analysis: DeepAnalysisSentiment
206
- causal_factors: List[str]
207
- emerging_sub_topics: List[str]
208
- future_outlook_and_predictions: List[str]
209
- actionable_insights_for_roles: DeepAnalysisActionableInsights
210
- related_trends: List[DeepAnalysisRelatedTrend]
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 ---
211
215
 
212
216
  # --- User & Account Management Models ---
213
217
  class TopicInterest(OrmBaseModel):
@@ -274,14 +278,13 @@ class SubscriptionPlan(OrmBaseModel):
274
278
  class ComponentStatus(OrmBaseModel):
275
279
  name: str
276
280
  status: str
277
- description: str
281
+ # description: str # This field was in the server schema but not the client; remove or add as needed.
278
282
 
279
283
  class StatusPage(OrmBaseModel):
280
284
  overall_status: str
281
285
  last_updated: datetime
282
286
  components: List[ComponentStatus]
283
287
 
284
- # NEW: Model for API Status History
285
288
  class StatusHistoryResponse(OrmBaseModel):
286
289
  uptime_percentages: Dict[str, float]
287
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.2
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
- print(f"- ID: {trend.id}, Name: '{trend.name}', Volume: {trend.volume}")
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