telem-sdk 0.2.1__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.1 → telem_sdk-0.2.2}/PKG-INFO +1 -1
  2. {telem_sdk-0.2.1 → telem_sdk-0.2.2}/telem/_base.py +5 -0
  3. {telem_sdk-0.2.1 → telem_sdk-0.2.2}/telem/_version.py +1 -1
  4. {telem_sdk-0.2.1 → telem_sdk-0.2.2}/telem/async_client.py +5 -0
  5. {telem_sdk-0.2.1 → telem_sdk-0.2.2}/telem/client.py +5 -0
  6. {telem_sdk-0.2.1 → telem_sdk-0.2.2}/telem/resources/monitors.py +39 -7
  7. {telem_sdk-0.2.1 → telem_sdk-0.2.2}/LICENSE +0 -0
  8. {telem_sdk-0.2.1 → telem_sdk-0.2.2}/README.md +0 -0
  9. {telem_sdk-0.2.1 → telem_sdk-0.2.2}/pyproject.toml +0 -0
  10. {telem_sdk-0.2.1 → telem_sdk-0.2.2}/telem/__init__.py +0 -0
  11. {telem_sdk-0.2.1 → telem_sdk-0.2.2}/telem/_config_files.py +0 -0
  12. {telem_sdk-0.2.1 → telem_sdk-0.2.2}/telem/_normalize.py +0 -0
  13. {telem_sdk-0.2.1 → telem_sdk-0.2.2}/telem/_skills/telem-search/SKILL.md +0 -0
  14. {telem_sdk-0.2.1 → telem_sdk-0.2.2}/telem/_skills/telem-search/scripts/search.py +0 -0
  15. {telem_sdk-0.2.1 → telem_sdk-0.2.2}/telem/_version_advisory.py +0 -0
  16. {telem_sdk-0.2.1 → telem_sdk-0.2.2}/telem/config.py +0 -0
  17. {telem_sdk-0.2.1 → telem_sdk-0.2.2}/telem/errors.py +0 -0
  18. {telem_sdk-0.2.1 → telem_sdk-0.2.2}/telem/install_skill.py +0 -0
  19. {telem_sdk-0.2.1 → telem_sdk-0.2.2}/telem/integrations/__init__.py +0 -0
  20. {telem_sdk-0.2.1 → telem_sdk-0.2.2}/telem/integrations/_hermes_render.py +0 -0
  21. {telem_sdk-0.2.1 → telem_sdk-0.2.2}/telem/integrations/_hermes_state.py +0 -0
  22. {telem_sdk-0.2.1 → telem_sdk-0.2.2}/telem/integrations/_langchain_trajectory.py +0 -0
  23. {telem_sdk-0.2.1 → telem_sdk-0.2.2}/telem/integrations/_openai_trajectory.py +0 -0
  24. {telem_sdk-0.2.1 → telem_sdk-0.2.2}/telem/integrations/_tools.py +0 -0
  25. {telem_sdk-0.2.1 → telem_sdk-0.2.2}/telem/integrations/_trajectory_v5.py +0 -0
  26. {telem_sdk-0.2.1 → telem_sdk-0.2.2}/telem/integrations/_update_advisory.py +0 -0
  27. {telem_sdk-0.2.1 → telem_sdk-0.2.2}/telem/integrations/hermes.py +0 -0
  28. {telem_sdk-0.2.1 → telem_sdk-0.2.2}/telem/integrations/langchain.py +0 -0
  29. {telem_sdk-0.2.1 → telem_sdk-0.2.2}/telem/integrations/openai.py +0 -0
  30. {telem_sdk-0.2.1 → telem_sdk-0.2.2}/telem/models.py +0 -0
  31. {telem_sdk-0.2.1 → telem_sdk-0.2.2}/telem/py.typed +0 -0
  32. {telem_sdk-0.2.1 → telem_sdk-0.2.2}/telem/resources/__init__.py +0 -0
  33. {telem_sdk-0.2.1 → 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.1
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
@@ -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.1"
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,
@@ -17,12 +17,21 @@ 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
23
  ttl: str | None,
24
+ search: dict[str, Any] | None,
25
+ include_domains: list[str] | None,
24
26
  ) -> dict[str, Any]:
25
- 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}
26
35
  if metadata is not None:
27
36
  body["metadata"] = metadata
28
37
  if webhook_url is not None:
@@ -32,6 +41,19 @@ def _create_body(
32
41
  return body
33
42
 
34
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
+
35
57
  def _update_body(
36
58
  status: str | None,
37
59
  frequency: str | None,
@@ -99,26 +121,34 @@ class MonitorsResource:
99
121
  self,
100
122
  query: str,
101
123
  *,
102
- frequency: str,
124
+ frequency: str | None = None,
103
125
  metadata: dict[str, Any] | None = None,
104
126
  webhook_url: str | None = None,
105
127
  ttl: str | None = None,
128
+ search: dict[str, Any] | None = None,
129
+ include_domains: list[str] | None = None,
106
130
  ) -> Monitor:
107
131
  """Create a monitor. Telem runs ``query`` on the schedule.
108
132
 
109
133
  Args:
110
134
  query: What to watch for, as a plain sentence.
111
- 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.
112
137
  metadata: Request metadata (query lineage keys), as in a search.
113
138
  webhook_url: An ``https`` URL that receives the new results.
114
139
  ttl: Delete the monitor after this long, such as ``"12h"`` or ``"7d"``
115
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.
116
146
 
117
147
  Returns:
118
148
  The new :class:`Monitor`. With ``webhook_url``, its ``webhook_secret``
119
149
  signs the deliveries; Telem shows it only in this response.
120
150
  """
121
- body = _create_body(query, frequency, metadata, webhook_url, ttl)
151
+ body = _create_body(query, frequency, metadata, webhook_url, ttl, search, include_domains)
122
152
  return Monitor.model_validate(self._client._post("/v1/monitors", body))
123
153
 
124
154
  def list(self, *, limit: int | None = None) -> list[Monitor]:
@@ -191,13 +221,15 @@ class AsyncMonitorsResource:
191
221
  self,
192
222
  query: str,
193
223
  *,
194
- frequency: str,
224
+ frequency: str | None = None,
195
225
  metadata: dict[str, Any] | None = None,
196
226
  webhook_url: str | None = None,
197
227
  ttl: str | None = None,
228
+ search: dict[str, Any] | None = None,
229
+ include_domains: list[str] | None = None,
198
230
  ) -> Monitor:
199
231
  """Create a monitor. See :meth:`MonitorsResource.create`."""
200
- body = _create_body(query, frequency, metadata, webhook_url, ttl)
232
+ body = _create_body(query, frequency, metadata, webhook_url, ttl, search, include_domains)
201
233
  return Monitor.model_validate(await self._client._post("/v1/monitors", body))
202
234
 
203
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
File without changes
File without changes