telem-sdk 0.2.0__tar.gz → 0.2.2__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.
Files changed (33) hide show
  1. {telem_sdk-0.2.0 → telem_sdk-0.2.2}/PKG-INFO +2 -2
  2. {telem_sdk-0.2.0 → telem_sdk-0.2.2}/README.md +1 -1
  3. {telem_sdk-0.2.0 → telem_sdk-0.2.2}/telem/_base.py +5 -0
  4. {telem_sdk-0.2.0 → telem_sdk-0.2.2}/telem/_version.py +1 -1
  5. {telem_sdk-0.2.0 → telem_sdk-0.2.2}/telem/async_client.py +5 -0
  6. {telem_sdk-0.2.0 → telem_sdk-0.2.2}/telem/client.py +5 -0
  7. {telem_sdk-0.2.0 → telem_sdk-0.2.2}/telem/models.py +2 -0
  8. {telem_sdk-0.2.0 → telem_sdk-0.2.2}/telem/resources/monitors.py +46 -7
  9. {telem_sdk-0.2.0 → telem_sdk-0.2.2}/LICENSE +0 -0
  10. {telem_sdk-0.2.0 → telem_sdk-0.2.2}/pyproject.toml +0 -0
  11. {telem_sdk-0.2.0 → telem_sdk-0.2.2}/telem/__init__.py +0 -0
  12. {telem_sdk-0.2.0 → telem_sdk-0.2.2}/telem/_config_files.py +0 -0
  13. {telem_sdk-0.2.0 → telem_sdk-0.2.2}/telem/_normalize.py +0 -0
  14. {telem_sdk-0.2.0 → telem_sdk-0.2.2}/telem/_skills/telem-search/SKILL.md +0 -0
  15. {telem_sdk-0.2.0 → telem_sdk-0.2.2}/telem/_skills/telem-search/scripts/search.py +0 -0
  16. {telem_sdk-0.2.0 → telem_sdk-0.2.2}/telem/_version_advisory.py +0 -0
  17. {telem_sdk-0.2.0 → telem_sdk-0.2.2}/telem/config.py +0 -0
  18. {telem_sdk-0.2.0 → telem_sdk-0.2.2}/telem/errors.py +0 -0
  19. {telem_sdk-0.2.0 → telem_sdk-0.2.2}/telem/install_skill.py +0 -0
  20. {telem_sdk-0.2.0 → telem_sdk-0.2.2}/telem/integrations/__init__.py +0 -0
  21. {telem_sdk-0.2.0 → telem_sdk-0.2.2}/telem/integrations/_hermes_render.py +0 -0
  22. {telem_sdk-0.2.0 → telem_sdk-0.2.2}/telem/integrations/_hermes_state.py +0 -0
  23. {telem_sdk-0.2.0 → telem_sdk-0.2.2}/telem/integrations/_langchain_trajectory.py +0 -0
  24. {telem_sdk-0.2.0 → telem_sdk-0.2.2}/telem/integrations/_openai_trajectory.py +0 -0
  25. {telem_sdk-0.2.0 → telem_sdk-0.2.2}/telem/integrations/_tools.py +0 -0
  26. {telem_sdk-0.2.0 → telem_sdk-0.2.2}/telem/integrations/_trajectory_v5.py +0 -0
  27. {telem_sdk-0.2.0 → telem_sdk-0.2.2}/telem/integrations/_update_advisory.py +0 -0
  28. {telem_sdk-0.2.0 → telem_sdk-0.2.2}/telem/integrations/hermes.py +0 -0
  29. {telem_sdk-0.2.0 → telem_sdk-0.2.2}/telem/integrations/langchain.py +0 -0
  30. {telem_sdk-0.2.0 → telem_sdk-0.2.2}/telem/integrations/openai.py +0 -0
  31. {telem_sdk-0.2.0 → telem_sdk-0.2.2}/telem/py.typed +0 -0
  32. {telem_sdk-0.2.0 → telem_sdk-0.2.2}/telem/resources/__init__.py +0 -0
  33. {telem_sdk-0.2.0 → telem_sdk-0.2.2}/telem/resources/sessions.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: telem-sdk
3
- Version: 0.2.0
3
+ Version: 0.2.2
4
4
  Summary: Python SDK for the Telem search orchestration API.
5
5
  License-Expression: Apache-2.0
6
6
  License-File: LICENSE
@@ -176,7 +176,7 @@ A monitor runs a query on a schedule. Poll it to get the results that are new si
176
176
  your last poll. `poll` returns a `SearchResponse`:
177
177
 
178
178
  ```python
179
- monitor = client.monitors.create("Nvidia files a new 8-K with the SEC", frequency="1h")
179
+ monitor = client.monitors.create("Nvidia files a new 8-K with the SEC", frequency="1h", ttl="7d")
180
180
  response = client.monitors.poll(monitor.id)
181
181
  client.monitors.update(monitor.id, status="paused")
182
182
  client.monitors.delete(monitor.id)
@@ -156,7 +156,7 @@ A monitor runs a query on a schedule. Poll it to get the results that are new si
156
156
  your last poll. `poll` returns a `SearchResponse`:
157
157
 
158
158
  ```python
159
- monitor = client.monitors.create("Nvidia files a new 8-K with the SEC", frequency="1h")
159
+ monitor = client.monitors.create("Nvidia files a new 8-K with the SEC", frequency="1h", ttl="7d")
160
160
  response = client.monitors.poll(monitor.id)
161
161
  client.monitors.update(monitor.id, status="paused")
162
162
  client.monitors.delete(monitor.id)
@@ -167,6 +167,7 @@ class BaseClient:
167
167
  topic: str | None = None,
168
168
  published_after: str | date | None = None,
169
169
  published_before: str | date | None = None,
170
+ include_domains: list[str] | None = None,
170
171
  ) -> dict[str, Any]:
171
172
  """Resolve call arguments against the client defaults into the wire ``search`` block.
172
173
 
@@ -250,6 +251,8 @@ class BaseClient:
250
251
  block["published_after"] = _iso(published_after)
251
252
  if published_before is not None:
252
253
  block["published_before"] = _iso(published_before)
254
+ if include_domains is not None:
255
+ block["include_domains"] = include_domains
253
256
  return block
254
257
 
255
258
  def _search_body(
@@ -269,6 +272,7 @@ class BaseClient:
269
272
  topic: str | None = None,
270
273
  published_after: str | date | None = None,
271
274
  published_before: str | date | None = None,
275
+ include_domains: list[str] | None = None,
272
276
  goal: str | None = None,
273
277
  context: str | None = None,
274
278
  session: str | None = None,
@@ -332,6 +336,7 @@ class BaseClient:
332
336
  topic=topic,
333
337
  published_after=published_after,
334
338
  published_before=published_before,
339
+ include_domains=include_domains,
335
340
  )
336
341
  if search:
337
342
  body["search"] = search
@@ -13,4 +13,4 @@ one-line change; if you are editing a version string anywhere else, something ha
13
13
  regressed back to the shape that caused that.
14
14
  """
15
15
 
16
- __version__ = "0.2.0"
16
+ __version__ = "0.2.2"
@@ -122,6 +122,7 @@ class AsyncTelem(BaseClient):
122
122
  topic: str | None = None,
123
123
  published_after: str | date | None = None,
124
124
  published_before: str | date | None = None,
125
+ include_domains: list[str] | None = None,
125
126
  goal: str | None = None,
126
127
  context: str | None = None,
127
128
  session: str | None = None,
@@ -157,6 +158,9 @@ class AsyncTelem(BaseClient):
157
158
  with no known publication date are kept.
158
159
  published_before: Only return results published before this date or
159
160
  date-time. A date with no time includes that whole day.
161
+ include_domains: Only return results from these domains, at most 20
162
+ hostnames such as ``"linkedin.com"``. A subdomain such as
163
+ ``"uk.linkedin.com"`` matches its domain.
160
164
  goal: Optional agent goal, merged into request metadata.
161
165
  context: Optional context string, merged into request metadata.
162
166
  session: Optional session id to continue an existing session.
@@ -180,6 +184,7 @@ class AsyncTelem(BaseClient):
180
184
  topic=topic,
181
185
  published_after=published_after,
182
186
  published_before=published_before,
187
+ include_domains=include_domains,
183
188
  goal=goal,
184
189
  context=context,
185
190
  session=session,
@@ -122,6 +122,7 @@ class Telem(BaseClient):
122
122
  topic: str | None = None,
123
123
  published_after: str | date | None = None,
124
124
  published_before: str | date | None = None,
125
+ include_domains: list[str] | None = None,
125
126
  goal: str | None = None,
126
127
  context: str | None = None,
127
128
  session: str | None = None,
@@ -157,6 +158,9 @@ class Telem(BaseClient):
157
158
  with no known publication date are kept.
158
159
  published_before: Only return results published before this date or
159
160
  date-time. A date with no time includes that whole day.
161
+ include_domains: Only return results from these domains, at most 20
162
+ hostnames such as ``"linkedin.com"``. A subdomain such as
163
+ ``"uk.linkedin.com"`` matches its domain.
160
164
  goal: Optional agent goal, merged into request metadata.
161
165
  context: Optional context string, merged into request metadata.
162
166
  session: Optional session id to continue an existing session.
@@ -180,6 +184,7 @@ class Telem(BaseClient):
180
184
  topic=topic,
181
185
  published_after=published_after,
182
186
  published_before=published_before,
187
+ include_domains=include_domains,
183
188
  goal=goal,
184
189
  context=context,
185
190
  session=session,
@@ -186,6 +186,8 @@ class Monitor(BaseModel):
186
186
  session_id: str
187
187
  created_at: str
188
188
  last_polled_at: str | None = None
189
+ #: When Telem deletes the monitor; ``None``: never.
190
+ expires_at: str | None = None
189
191
  webhook_url: str | None = None
190
192
  #: Signs the webhook deliveries. Only in the response that set ``webhook_url``.
191
193
  webhook_secret: str | None = None
@@ -17,18 +17,43 @@ if TYPE_CHECKING:
17
17
 
18
18
  def _create_body(
19
19
  query: str,
20
- frequency: str,
20
+ frequency: str | None,
21
21
  metadata: dict[str, Any] | None,
22
22
  webhook_url: str | None,
23
+ ttl: str | None,
24
+ search: dict[str, Any] | None,
25
+ include_domains: list[str] | None,
23
26
  ) -> dict[str, Any]:
24
- body: dict[str, Any] = {"query": query, "options": {"frequency": frequency}}
27
+ options: dict[str, Any] = {}
28
+ if frequency is not None:
29
+ options["frequency"] = frequency
30
+ if include_domains is not None:
31
+ options["include_domains"] = include_domains
32
+ if search is not None:
33
+ options["search"] = _search_block(search)
34
+ body: dict[str, Any] = {"query": query, "options": options}
25
35
  if metadata is not None:
26
36
  body["metadata"] = metadata
27
37
  if webhook_url is not None:
28
38
  body["webhook_url"] = webhook_url
39
+ if ttl is not None:
40
+ body["ttl"] = ttl
29
41
  return body
30
42
 
31
43
 
44
+ def _search_block(search: dict[str, Any]) -> dict[str, Any]:
45
+ """The monitor's search options for the wire: the keys of ``search()``, with
46
+ ``providers_include``/``providers_exclude`` as ``providers``. No client
47
+ default applies: a monitor's search is set on the monitor alone."""
48
+ block = {k: v for k, v in search.items() if not k.startswith("providers_")}
49
+ providers = {
50
+ k.removeprefix("providers_"): v for k, v in search.items() if k.startswith("providers_")
51
+ }
52
+ if providers:
53
+ block["providers"] = providers
54
+ return block
55
+
56
+
32
57
  def _update_body(
33
58
  status: str | None,
34
59
  frequency: str | None,
@@ -96,23 +121,34 @@ class MonitorsResource:
96
121
  self,
97
122
  query: str,
98
123
  *,
99
- frequency: str,
124
+ frequency: str | None = None,
100
125
  metadata: dict[str, Any] | None = None,
101
126
  webhook_url: str | None = None,
127
+ ttl: str | None = None,
128
+ search: dict[str, Any] | None = None,
129
+ include_domains: list[str] | None = None,
102
130
  ) -> Monitor:
103
131
  """Create a monitor. Telem runs ``query`` on the schedule.
104
132
 
105
133
  Args:
106
134
  query: What to watch for, as a plain sentence.
107
- frequency: ``"1h"``, ``"6h"``, ``"1d"`` or ``"7d"``.
135
+ frequency: ``"1h"``, ``"6h"``, ``"12h"``, ``"1d"`` or ``"7d"``. If you leave it
136
+ out, the monitor runs once a day.
108
137
  metadata: Request metadata (query lineage keys), as in a search.
109
138
  webhook_url: An ``https`` URL that receives the new results.
139
+ ttl: Delete the monitor after this long, such as ``"12h"`` or ``"7d"``
140
+ (at most ``"30d"``). Without it, the monitor never expires.
141
+ search: Also run a web search for ``query`` on the schedule, with these
142
+ search options, named as in :meth:`Telem.search`: ``num_results`` and ``tier``.
143
+ ``{}`` uses the defaults.
144
+ include_domains: Only results from these sites and their subdomains, such as
145
+ ``["sec.gov"]``, from every source of the monitor.
110
146
 
111
147
  Returns:
112
148
  The new :class:`Monitor`. With ``webhook_url``, its ``webhook_secret``
113
149
  signs the deliveries; Telem shows it only in this response.
114
150
  """
115
- body = _create_body(query, frequency, metadata, webhook_url)
151
+ body = _create_body(query, frequency, metadata, webhook_url, ttl, search, include_domains)
116
152
  return Monitor.model_validate(self._client._post("/v1/monitors", body))
117
153
 
118
154
  def list(self, *, limit: int | None = None) -> list[Monitor]:
@@ -185,12 +221,15 @@ class AsyncMonitorsResource:
185
221
  self,
186
222
  query: str,
187
223
  *,
188
- frequency: str,
224
+ frequency: str | None = None,
189
225
  metadata: dict[str, Any] | None = None,
190
226
  webhook_url: str | None = None,
227
+ ttl: str | None = None,
228
+ search: dict[str, Any] | None = None,
229
+ include_domains: list[str] | None = None,
191
230
  ) -> Monitor:
192
231
  """Create a monitor. See :meth:`MonitorsResource.create`."""
193
- body = _create_body(query, frequency, metadata, webhook_url)
232
+ body = _create_body(query, frequency, metadata, webhook_url, ttl, search, include_domains)
194
233
  return Monitor.model_validate(await self._client._post("/v1/monitors", body))
195
234
 
196
235
  async def list(self, *, limit: int | None = None) -> list[Monitor]:
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes