profound 0.1.0__py3-none-any.whl

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.

Potentially problematic release.


This version of profound might be problematic. Click here for more details.

Files changed (66) hide show
  1. profound/__init__.py +102 -0
  2. profound/_base_client.py +1995 -0
  3. profound/_client.py +448 -0
  4. profound/_compat.py +219 -0
  5. profound/_constants.py +14 -0
  6. profound/_exceptions.py +108 -0
  7. profound/_files.py +123 -0
  8. profound/_models.py +835 -0
  9. profound/_qs.py +150 -0
  10. profound/_resource.py +43 -0
  11. profound/_response.py +830 -0
  12. profound/_streaming.py +333 -0
  13. profound/_types.py +260 -0
  14. profound/_utils/__init__.py +64 -0
  15. profound/_utils/_compat.py +45 -0
  16. profound/_utils/_datetime_parse.py +136 -0
  17. profound/_utils/_logs.py +25 -0
  18. profound/_utils/_proxy.py +65 -0
  19. profound/_utils/_reflection.py +42 -0
  20. profound/_utils/_resources_proxy.py +24 -0
  21. profound/_utils/_streams.py +12 -0
  22. profound/_utils/_sync.py +86 -0
  23. profound/_utils/_transform.py +457 -0
  24. profound/_utils/_typing.py +156 -0
  25. profound/_utils/_utils.py +421 -0
  26. profound/_version.py +4 -0
  27. profound/lib/.keep +4 -0
  28. profound/py.typed +0 -0
  29. profound/resources/__init__.py +61 -0
  30. profound/resources/logs/__init__.py +33 -0
  31. profound/resources/logs/logs.py +102 -0
  32. profound/resources/logs/raw.py +511 -0
  33. profound/resources/organizations/__init__.py +33 -0
  34. profound/resources/organizations/categories.py +372 -0
  35. profound/resources/organizations/organizations.py +269 -0
  36. profound/resources/prompts.py +201 -0
  37. profound/resources/reports.py +609 -0
  38. profound/types/__init__.py +17 -0
  39. profound/types/info.py +13 -0
  40. profound/types/logs/__init__.py +8 -0
  41. profound/types/logs/raw_bots_params.py +111 -0
  42. profound/types/logs/raw_bots_response.py +45 -0
  43. profound/types/logs/raw_logs_params.py +99 -0
  44. profound/types/logs/raw_logs_response.py +39 -0
  45. profound/types/organization_domains_response.py +20 -0
  46. profound/types/organization_models_response.py +10 -0
  47. profound/types/organization_regions_response.py +10 -0
  48. profound/types/organizations/__init__.py +9 -0
  49. profound/types/organizations/category_list_response.py +10 -0
  50. profound/types/organizations/category_prompts_response.py +31 -0
  51. profound/types/organizations/category_tags_response.py +10 -0
  52. profound/types/organizations/category_topics_response.py +10 -0
  53. profound/types/organizations/org_item.py +11 -0
  54. profound/types/pagination_param.py +15 -0
  55. profound/types/prompt_answers_params.py +82 -0
  56. profound/types/prompt_answers_response.py +44 -0
  57. profound/types/report_citations_params.py +83 -0
  58. profound/types/report_citations_response.py +16 -0
  59. profound/types/report_sentiment_params.py +83 -0
  60. profound/types/report_visibility_params.py +83 -0
  61. profound/types/response.py +16 -0
  62. profound/types/result.py +13 -0
  63. profound-0.1.0.dist-info/METADATA +415 -0
  64. profound-0.1.0.dist-info/RECORD +66 -0
  65. profound-0.1.0.dist-info/WHEEL +4 -0
  66. profound-0.1.0.dist-info/licenses/LICENSE +201 -0
@@ -0,0 +1,511 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Any, Dict, List, Union, Iterable, cast
6
+ from datetime import datetime
7
+ from typing_extensions import Literal
8
+
9
+ import httpx
10
+
11
+ from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
12
+ from ..._utils import maybe_transform, async_maybe_transform
13
+ from ..._compat import cached_property
14
+ from ..._resource import SyncAPIResource, AsyncAPIResource
15
+ from ..._response import (
16
+ to_raw_response_wrapper,
17
+ to_streamed_response_wrapper,
18
+ async_to_raw_response_wrapper,
19
+ async_to_streamed_response_wrapper,
20
+ )
21
+ from ...types.logs import raw_bots_params, raw_logs_params
22
+ from ..._base_client import make_request_options
23
+ from ...types.pagination_param import PaginationParam
24
+ from ...types.logs.raw_bots_response import RawBotsResponse
25
+ from ...types.logs.raw_logs_response import RawLogsResponse
26
+
27
+ __all__ = ["RawResource", "AsyncRawResource"]
28
+
29
+
30
+ class RawResource(SyncAPIResource):
31
+ @cached_property
32
+ def with_raw_response(self) -> RawResourceWithRawResponse:
33
+ """
34
+ This property can be used as a prefix for any HTTP method call to return
35
+ the raw response object instead of the parsed content.
36
+
37
+ For more information, see https://www.github.com/cooper-square-technologies/profound-python-sdk#accessing-raw-response-data-eg-headers
38
+ """
39
+ return RawResourceWithRawResponse(self)
40
+
41
+ @cached_property
42
+ def with_streaming_response(self) -> RawResourceWithStreamingResponse:
43
+ """
44
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
45
+
46
+ For more information, see https://www.github.com/cooper-square-technologies/profound-python-sdk#with_streaming_response
47
+ """
48
+ return RawResourceWithStreamingResponse(self)
49
+
50
+ def bots(
51
+ self,
52
+ *,
53
+ domain: str,
54
+ metrics: List[Literal["count"]],
55
+ start_date: Union[str, datetime],
56
+ date_interval: Literal["day", "week", "month", "year"] | Omit = omit,
57
+ dimensions: List[
58
+ Literal[
59
+ "method",
60
+ "path",
61
+ "status_code",
62
+ "ip",
63
+ "user_agent",
64
+ "referer",
65
+ "query_params",
66
+ "bot_name",
67
+ "bot_provider",
68
+ "bot_types",
69
+ ]
70
+ ]
71
+ | Omit = omit,
72
+ end_date: Union[str, datetime] | Omit = omit,
73
+ filters: Iterable[raw_bots_params.Filter] | Omit = omit,
74
+ order_by: Dict[str, Literal["asc", "desc"]] | Omit = omit,
75
+ pagination: PaginationParam | Omit = omit,
76
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
77
+ # The extra values given here take precedence over values defined on the client or passed to this method.
78
+ extra_headers: Headers | None = None,
79
+ extra_query: Query | None = None,
80
+ extra_body: Body | None = None,
81
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
82
+ ) -> RawBotsResponse:
83
+ """
84
+ Get identified bot logs with filters
85
+
86
+ Args:
87
+ domain: Domain to query logs for.
88
+
89
+ start_date: Start date for logs. Accepts: YYYY-MM-DD, YYYY-MM-DD HH:MM, YYYY-MM-DD HH:MM:SS,
90
+ or full ISO timestamp.
91
+
92
+ date_interval: Date interval for the report. (only used with date dimension)
93
+
94
+ dimensions: Dimensions to group the report by.
95
+
96
+ end_date: End date for logs. Accepts same formats as start_date. Defaults to now if
97
+ omitted.
98
+
99
+ filters: List of filters to apply to the report. Each filter has an operator, field, and
100
+ value.
101
+
102
+ order_by: Custom ordering of the report results.
103
+
104
+ The order is a record of key-value pairs where:
105
+
106
+ - key is the field to order by, which can be a metric or dimension
107
+ - value is the direction of the order, either 'asc' for ascending or 'desc' for
108
+ descending.
109
+
110
+ When not specified, the default order is the first metric in the query
111
+ descending.
112
+
113
+ pagination: Pagination settings for the report results.
114
+
115
+ extra_headers: Send extra headers
116
+
117
+ extra_query: Add additional query parameters to the request
118
+
119
+ extra_body: Add additional JSON properties to the request
120
+
121
+ timeout: Override the client-level default timeout for this request, in seconds
122
+ """
123
+ return cast(
124
+ RawBotsResponse,
125
+ self._post(
126
+ "/v1/logs/raw/bots",
127
+ body=maybe_transform(
128
+ {
129
+ "domain": domain,
130
+ "metrics": metrics,
131
+ "start_date": start_date,
132
+ "date_interval": date_interval,
133
+ "dimensions": dimensions,
134
+ "end_date": end_date,
135
+ "filters": filters,
136
+ "order_by": order_by,
137
+ "pagination": pagination,
138
+ },
139
+ raw_bots_params.RawBotsParams,
140
+ ),
141
+ options=make_request_options(
142
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
143
+ ),
144
+ cast_to=cast(Any, RawBotsResponse), # Union types cannot be passed in as arguments in the type system
145
+ ),
146
+ )
147
+
148
+ def logs(
149
+ self,
150
+ *,
151
+ domain: str,
152
+ metrics: List[Literal["count"]],
153
+ start_date: Union[str, datetime],
154
+ date_interval: Literal["day", "week", "month", "year"] | Omit = omit,
155
+ dimensions: List[
156
+ Literal[
157
+ "timestamp",
158
+ "method",
159
+ "host",
160
+ "path",
161
+ "status_code",
162
+ "ip",
163
+ "user_agent",
164
+ "referer",
165
+ "bytes_sent",
166
+ "duration_ms",
167
+ "query_params",
168
+ ]
169
+ ]
170
+ | Omit = omit,
171
+ end_date: Union[str, datetime] | Omit = omit,
172
+ filters: Iterable[raw_logs_params.Filter] | Omit = omit,
173
+ order_by: Dict[str, Literal["asc", "desc"]] | Omit = omit,
174
+ pagination: PaginationParam | Omit = omit,
175
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
176
+ # The extra values given here take precedence over values defined on the client or passed to this method.
177
+ extra_headers: Headers | None = None,
178
+ extra_query: Query | None = None,
179
+ extra_body: Body | None = None,
180
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
181
+ ) -> RawLogsResponse:
182
+ """
183
+ Get all logs with filters
184
+
185
+ Args:
186
+ domain: Domain to query logs for.
187
+
188
+ start_date: Start date for logs. Accepts: YYYY-MM-DD, YYYY-MM-DD HH:MM, YYYY-MM-DD HH:MM:SS,
189
+ or full ISO timestamp.
190
+
191
+ date_interval: Date interval for the report. (only used with date dimension)
192
+
193
+ dimensions: Dimensions to group the report by.
194
+
195
+ end_date: End date for logs. Accepts same formats as start_date. Defaults to now if
196
+ omitted.
197
+
198
+ filters: List of filters to apply to the report. Each filter has an operator, field, and
199
+ value.
200
+
201
+ order_by: Custom ordering of the report results.
202
+
203
+ The order is a record of key-value pairs where:
204
+
205
+ - key is the field to order by, which can be a metric or dimension
206
+ - value is the direction of the order, either 'asc' for ascending or 'desc' for
207
+ descending.
208
+
209
+ When not specified, the default order is the first metric in the query
210
+ descending.
211
+
212
+ pagination: Pagination settings for the report results.
213
+
214
+ extra_headers: Send extra headers
215
+
216
+ extra_query: Add additional query parameters to the request
217
+
218
+ extra_body: Add additional JSON properties to the request
219
+
220
+ timeout: Override the client-level default timeout for this request, in seconds
221
+ """
222
+ return cast(
223
+ RawLogsResponse,
224
+ self._post(
225
+ "/v1/logs/raw",
226
+ body=maybe_transform(
227
+ {
228
+ "domain": domain,
229
+ "metrics": metrics,
230
+ "start_date": start_date,
231
+ "date_interval": date_interval,
232
+ "dimensions": dimensions,
233
+ "end_date": end_date,
234
+ "filters": filters,
235
+ "order_by": order_by,
236
+ "pagination": pagination,
237
+ },
238
+ raw_logs_params.RawLogsParams,
239
+ ),
240
+ options=make_request_options(
241
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
242
+ ),
243
+ cast_to=cast(Any, RawLogsResponse), # Union types cannot be passed in as arguments in the type system
244
+ ),
245
+ )
246
+
247
+
248
+ class AsyncRawResource(AsyncAPIResource):
249
+ @cached_property
250
+ def with_raw_response(self) -> AsyncRawResourceWithRawResponse:
251
+ """
252
+ This property can be used as a prefix for any HTTP method call to return
253
+ the raw response object instead of the parsed content.
254
+
255
+ For more information, see https://www.github.com/cooper-square-technologies/profound-python-sdk#accessing-raw-response-data-eg-headers
256
+ """
257
+ return AsyncRawResourceWithRawResponse(self)
258
+
259
+ @cached_property
260
+ def with_streaming_response(self) -> AsyncRawResourceWithStreamingResponse:
261
+ """
262
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
263
+
264
+ For more information, see https://www.github.com/cooper-square-technologies/profound-python-sdk#with_streaming_response
265
+ """
266
+ return AsyncRawResourceWithStreamingResponse(self)
267
+
268
+ async def bots(
269
+ self,
270
+ *,
271
+ domain: str,
272
+ metrics: List[Literal["count"]],
273
+ start_date: Union[str, datetime],
274
+ date_interval: Literal["day", "week", "month", "year"] | Omit = omit,
275
+ dimensions: List[
276
+ Literal[
277
+ "method",
278
+ "path",
279
+ "status_code",
280
+ "ip",
281
+ "user_agent",
282
+ "referer",
283
+ "query_params",
284
+ "bot_name",
285
+ "bot_provider",
286
+ "bot_types",
287
+ ]
288
+ ]
289
+ | Omit = omit,
290
+ end_date: Union[str, datetime] | Omit = omit,
291
+ filters: Iterable[raw_bots_params.Filter] | Omit = omit,
292
+ order_by: Dict[str, Literal["asc", "desc"]] | Omit = omit,
293
+ pagination: PaginationParam | Omit = omit,
294
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
295
+ # The extra values given here take precedence over values defined on the client or passed to this method.
296
+ extra_headers: Headers | None = None,
297
+ extra_query: Query | None = None,
298
+ extra_body: Body | None = None,
299
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
300
+ ) -> RawBotsResponse:
301
+ """
302
+ Get identified bot logs with filters
303
+
304
+ Args:
305
+ domain: Domain to query logs for.
306
+
307
+ start_date: Start date for logs. Accepts: YYYY-MM-DD, YYYY-MM-DD HH:MM, YYYY-MM-DD HH:MM:SS,
308
+ or full ISO timestamp.
309
+
310
+ date_interval: Date interval for the report. (only used with date dimension)
311
+
312
+ dimensions: Dimensions to group the report by.
313
+
314
+ end_date: End date for logs. Accepts same formats as start_date. Defaults to now if
315
+ omitted.
316
+
317
+ filters: List of filters to apply to the report. Each filter has an operator, field, and
318
+ value.
319
+
320
+ order_by: Custom ordering of the report results.
321
+
322
+ The order is a record of key-value pairs where:
323
+
324
+ - key is the field to order by, which can be a metric or dimension
325
+ - value is the direction of the order, either 'asc' for ascending or 'desc' for
326
+ descending.
327
+
328
+ When not specified, the default order is the first metric in the query
329
+ descending.
330
+
331
+ pagination: Pagination settings for the report results.
332
+
333
+ extra_headers: Send extra headers
334
+
335
+ extra_query: Add additional query parameters to the request
336
+
337
+ extra_body: Add additional JSON properties to the request
338
+
339
+ timeout: Override the client-level default timeout for this request, in seconds
340
+ """
341
+ return cast(
342
+ RawBotsResponse,
343
+ await self._post(
344
+ "/v1/logs/raw/bots",
345
+ body=await async_maybe_transform(
346
+ {
347
+ "domain": domain,
348
+ "metrics": metrics,
349
+ "start_date": start_date,
350
+ "date_interval": date_interval,
351
+ "dimensions": dimensions,
352
+ "end_date": end_date,
353
+ "filters": filters,
354
+ "order_by": order_by,
355
+ "pagination": pagination,
356
+ },
357
+ raw_bots_params.RawBotsParams,
358
+ ),
359
+ options=make_request_options(
360
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
361
+ ),
362
+ cast_to=cast(Any, RawBotsResponse), # Union types cannot be passed in as arguments in the type system
363
+ ),
364
+ )
365
+
366
+ async def logs(
367
+ self,
368
+ *,
369
+ domain: str,
370
+ metrics: List[Literal["count"]],
371
+ start_date: Union[str, datetime],
372
+ date_interval: Literal["day", "week", "month", "year"] | Omit = omit,
373
+ dimensions: List[
374
+ Literal[
375
+ "timestamp",
376
+ "method",
377
+ "host",
378
+ "path",
379
+ "status_code",
380
+ "ip",
381
+ "user_agent",
382
+ "referer",
383
+ "bytes_sent",
384
+ "duration_ms",
385
+ "query_params",
386
+ ]
387
+ ]
388
+ | Omit = omit,
389
+ end_date: Union[str, datetime] | Omit = omit,
390
+ filters: Iterable[raw_logs_params.Filter] | Omit = omit,
391
+ order_by: Dict[str, Literal["asc", "desc"]] | Omit = omit,
392
+ pagination: PaginationParam | Omit = omit,
393
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
394
+ # The extra values given here take precedence over values defined on the client or passed to this method.
395
+ extra_headers: Headers | None = None,
396
+ extra_query: Query | None = None,
397
+ extra_body: Body | None = None,
398
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
399
+ ) -> RawLogsResponse:
400
+ """
401
+ Get all logs with filters
402
+
403
+ Args:
404
+ domain: Domain to query logs for.
405
+
406
+ start_date: Start date for logs. Accepts: YYYY-MM-DD, YYYY-MM-DD HH:MM, YYYY-MM-DD HH:MM:SS,
407
+ or full ISO timestamp.
408
+
409
+ date_interval: Date interval for the report. (only used with date dimension)
410
+
411
+ dimensions: Dimensions to group the report by.
412
+
413
+ end_date: End date for logs. Accepts same formats as start_date. Defaults to now if
414
+ omitted.
415
+
416
+ filters: List of filters to apply to the report. Each filter has an operator, field, and
417
+ value.
418
+
419
+ order_by: Custom ordering of the report results.
420
+
421
+ The order is a record of key-value pairs where:
422
+
423
+ - key is the field to order by, which can be a metric or dimension
424
+ - value is the direction of the order, either 'asc' for ascending or 'desc' for
425
+ descending.
426
+
427
+ When not specified, the default order is the first metric in the query
428
+ descending.
429
+
430
+ pagination: Pagination settings for the report results.
431
+
432
+ extra_headers: Send extra headers
433
+
434
+ extra_query: Add additional query parameters to the request
435
+
436
+ extra_body: Add additional JSON properties to the request
437
+
438
+ timeout: Override the client-level default timeout for this request, in seconds
439
+ """
440
+ return cast(
441
+ RawLogsResponse,
442
+ await self._post(
443
+ "/v1/logs/raw",
444
+ body=await async_maybe_transform(
445
+ {
446
+ "domain": domain,
447
+ "metrics": metrics,
448
+ "start_date": start_date,
449
+ "date_interval": date_interval,
450
+ "dimensions": dimensions,
451
+ "end_date": end_date,
452
+ "filters": filters,
453
+ "order_by": order_by,
454
+ "pagination": pagination,
455
+ },
456
+ raw_logs_params.RawLogsParams,
457
+ ),
458
+ options=make_request_options(
459
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
460
+ ),
461
+ cast_to=cast(Any, RawLogsResponse), # Union types cannot be passed in as arguments in the type system
462
+ ),
463
+ )
464
+
465
+
466
+ class RawResourceWithRawResponse:
467
+ def __init__(self, raw: RawResource) -> None:
468
+ self._raw = raw
469
+
470
+ self.bots = to_raw_response_wrapper(
471
+ raw.bots,
472
+ )
473
+ self.logs = to_raw_response_wrapper(
474
+ raw.logs,
475
+ )
476
+
477
+
478
+ class AsyncRawResourceWithRawResponse:
479
+ def __init__(self, raw: AsyncRawResource) -> None:
480
+ self._raw = raw
481
+
482
+ self.bots = async_to_raw_response_wrapper(
483
+ raw.bots,
484
+ )
485
+ self.logs = async_to_raw_response_wrapper(
486
+ raw.logs,
487
+ )
488
+
489
+
490
+ class RawResourceWithStreamingResponse:
491
+ def __init__(self, raw: RawResource) -> None:
492
+ self._raw = raw
493
+
494
+ self.bots = to_streamed_response_wrapper(
495
+ raw.bots,
496
+ )
497
+ self.logs = to_streamed_response_wrapper(
498
+ raw.logs,
499
+ )
500
+
501
+
502
+ class AsyncRawResourceWithStreamingResponse:
503
+ def __init__(self, raw: AsyncRawResource) -> None:
504
+ self._raw = raw
505
+
506
+ self.bots = async_to_streamed_response_wrapper(
507
+ raw.bots,
508
+ )
509
+ self.logs = async_to_streamed_response_wrapper(
510
+ raw.logs,
511
+ )
@@ -0,0 +1,33 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from .categories import (
4
+ CategoriesResource,
5
+ AsyncCategoriesResource,
6
+ CategoriesResourceWithRawResponse,
7
+ AsyncCategoriesResourceWithRawResponse,
8
+ CategoriesResourceWithStreamingResponse,
9
+ AsyncCategoriesResourceWithStreamingResponse,
10
+ )
11
+ from .organizations import (
12
+ OrganizationsResource,
13
+ AsyncOrganizationsResource,
14
+ OrganizationsResourceWithRawResponse,
15
+ AsyncOrganizationsResourceWithRawResponse,
16
+ OrganizationsResourceWithStreamingResponse,
17
+ AsyncOrganizationsResourceWithStreamingResponse,
18
+ )
19
+
20
+ __all__ = [
21
+ "CategoriesResource",
22
+ "AsyncCategoriesResource",
23
+ "CategoriesResourceWithRawResponse",
24
+ "AsyncCategoriesResourceWithRawResponse",
25
+ "CategoriesResourceWithStreamingResponse",
26
+ "AsyncCategoriesResourceWithStreamingResponse",
27
+ "OrganizationsResource",
28
+ "AsyncOrganizationsResource",
29
+ "OrganizationsResourceWithRawResponse",
30
+ "AsyncOrganizationsResourceWithRawResponse",
31
+ "OrganizationsResourceWithStreamingResponse",
32
+ "AsyncOrganizationsResourceWithStreamingResponse",
33
+ ]