profound 0.7.0__tar.gz → 0.10.0__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.
- profound-0.10.0/.release-please-manifest.json +3 -0
- {profound-0.7.0 → profound-0.10.0}/CHANGELOG.md +42 -0
- {profound-0.7.0 → profound-0.10.0}/PKG-INFO +4 -5
- {profound-0.7.0 → profound-0.10.0}/README.md +2 -2
- {profound-0.7.0 → profound-0.10.0}/api.md +2 -0
- {profound-0.7.0 → profound-0.10.0}/pyproject.toml +3 -4
- {profound-0.7.0 → profound-0.10.0}/src/profound/_models.py +37 -15
- {profound-0.7.0 → profound-0.10.0}/src/profound/_streaming.py +4 -6
- {profound-0.7.0 → profound-0.10.0}/src/profound/_utils/_sync.py +3 -31
- {profound-0.7.0 → profound-0.10.0}/src/profound/_utils/_utils.py +1 -1
- {profound-0.7.0 → profound-0.10.0}/src/profound/_version.py +1 -1
- {profound-0.7.0 → profound-0.10.0}/src/profound/resources/organizations/categories.py +79 -0
- {profound-0.7.0 → profound-0.10.0}/src/profound/resources/reports.py +8 -4
- {profound-0.7.0 → profound-0.10.0}/src/profound/types/organizations/__init__.py +1 -0
- profound-0.10.0/src/profound/types/organizations/category_assets_response.py +26 -0
- {profound-0.7.0 → profound-0.10.0}/src/profound/types/report_result.py +2 -2
- {profound-0.7.0 → profound-0.10.0}/src/profound/types/report_sentiment_params.py +4 -2
- {profound-0.7.0 → profound-0.10.0}/tests/api_resources/organizations/test_categories.py +85 -0
- {profound-0.7.0 → profound-0.10.0}/tests/test_client.py +198 -164
- {profound-0.7.0 → profound-0.10.0}/tests/test_models.py +4 -4
- profound-0.7.0/.release-please-manifest.json +0 -3
- {profound-0.7.0 → profound-0.10.0}/.gitignore +0 -0
- {profound-0.7.0 → profound-0.10.0}/CONTRIBUTING.md +0 -0
- {profound-0.7.0 → profound-0.10.0}/LICENSE +0 -0
- {profound-0.7.0 → profound-0.10.0}/SECURITY.md +0 -0
- {profound-0.7.0 → profound-0.10.0}/bin/check-release-environment +0 -0
- {profound-0.7.0 → profound-0.10.0}/bin/publish-pypi +0 -0
- {profound-0.7.0 → profound-0.10.0}/examples/.keep +0 -0
- {profound-0.7.0 → profound-0.10.0}/noxfile.py +0 -0
- {profound-0.7.0 → profound-0.10.0}/release-please-config.json +0 -0
- {profound-0.7.0 → profound-0.10.0}/requirements-dev.lock +0 -0
- {profound-0.7.0 → profound-0.10.0}/requirements.lock +0 -0
- {profound-0.7.0 → profound-0.10.0}/src/profound/__init__.py +0 -0
- {profound-0.7.0 → profound-0.10.0}/src/profound/_base_client.py +0 -0
- {profound-0.7.0 → profound-0.10.0}/src/profound/_client.py +0 -0
- {profound-0.7.0 → profound-0.10.0}/src/profound/_compat.py +0 -0
- {profound-0.7.0 → profound-0.10.0}/src/profound/_constants.py +0 -0
- {profound-0.7.0 → profound-0.10.0}/src/profound/_exceptions.py +0 -0
- {profound-0.7.0 → profound-0.10.0}/src/profound/_files.py +0 -0
- {profound-0.7.0 → profound-0.10.0}/src/profound/_qs.py +0 -0
- {profound-0.7.0 → profound-0.10.0}/src/profound/_resource.py +0 -0
- {profound-0.7.0 → profound-0.10.0}/src/profound/_response.py +0 -0
- {profound-0.7.0 → profound-0.10.0}/src/profound/_types.py +0 -0
- {profound-0.7.0 → profound-0.10.0}/src/profound/_utils/__init__.py +0 -0
- {profound-0.7.0 → profound-0.10.0}/src/profound/_utils/_compat.py +0 -0
- {profound-0.7.0 → profound-0.10.0}/src/profound/_utils/_datetime_parse.py +0 -0
- {profound-0.7.0 → profound-0.10.0}/src/profound/_utils/_logs.py +0 -0
- {profound-0.7.0 → profound-0.10.0}/src/profound/_utils/_proxy.py +0 -0
- {profound-0.7.0 → profound-0.10.0}/src/profound/_utils/_reflection.py +0 -0
- {profound-0.7.0 → profound-0.10.0}/src/profound/_utils/_resources_proxy.py +0 -0
- {profound-0.7.0 → profound-0.10.0}/src/profound/_utils/_streams.py +0 -0
- {profound-0.7.0 → profound-0.10.0}/src/profound/_utils/_transform.py +0 -0
- {profound-0.7.0 → profound-0.10.0}/src/profound/_utils/_typing.py +0 -0
- {profound-0.7.0 → profound-0.10.0}/src/profound/lib/.keep +0 -0
- {profound-0.7.0 → profound-0.10.0}/src/profound/py.typed +0 -0
- {profound-0.7.0 → profound-0.10.0}/src/profound/resources/__init__.py +0 -0
- {profound-0.7.0 → profound-0.10.0}/src/profound/resources/logs/__init__.py +0 -0
- {profound-0.7.0 → profound-0.10.0}/src/profound/resources/logs/logs.py +0 -0
- {profound-0.7.0 → profound-0.10.0}/src/profound/resources/logs/raw.py +0 -0
- {profound-0.7.0 → profound-0.10.0}/src/profound/resources/organizations/__init__.py +0 -0
- {profound-0.7.0 → profound-0.10.0}/src/profound/resources/organizations/organizations.py +0 -0
- {profound-0.7.0 → profound-0.10.0}/src/profound/resources/prompts.py +0 -0
- {profound-0.7.0 → profound-0.10.0}/src/profound/types/__init__.py +0 -0
- {profound-0.7.0 → profound-0.10.0}/src/profound/types/logs/__init__.py +0 -0
- {profound-0.7.0 → profound-0.10.0}/src/profound/types/logs/raw_bots_params.py +0 -0
- {profound-0.7.0 → profound-0.10.0}/src/profound/types/logs/raw_bots_response.py +0 -0
- {profound-0.7.0 → profound-0.10.0}/src/profound/types/logs/raw_logs_params.py +0 -0
- {profound-0.7.0 → profound-0.10.0}/src/profound/types/logs/raw_logs_response.py +0 -0
- {profound-0.7.0 → profound-0.10.0}/src/profound/types/organization_domains_response.py +0 -0
- {profound-0.7.0 → profound-0.10.0}/src/profound/types/organization_models_response.py +0 -0
- {profound-0.7.0 → profound-0.10.0}/src/profound/types/organization_regions_response.py +0 -0
- {profound-0.7.0 → profound-0.10.0}/src/profound/types/organizations/category_list_response.py +0 -0
- {profound-0.7.0 → profound-0.10.0}/src/profound/types/organizations/category_prompts_response.py +0 -0
- {profound-0.7.0 → profound-0.10.0}/src/profound/types/organizations/category_tags_response.py +0 -0
- {profound-0.7.0 → profound-0.10.0}/src/profound/types/organizations/category_topics_response.py +0 -0
- {profound-0.7.0 → profound-0.10.0}/src/profound/types/organizations/org_item.py +0 -0
- {profound-0.7.0 → profound-0.10.0}/src/profound/types/prompt_answers_params.py +0 -0
- {profound-0.7.0 → profound-0.10.0}/src/profound/types/prompt_answers_response.py +0 -0
- {profound-0.7.0 → profound-0.10.0}/src/profound/types/report_citations_params.py +0 -0
- {profound-0.7.0 → profound-0.10.0}/src/profound/types/report_citations_response.py +0 -0
- {profound-0.7.0 → profound-0.10.0}/src/profound/types/report_info.py +0 -0
- {profound-0.7.0 → profound-0.10.0}/src/profound/types/report_response.py +0 -0
- {profound-0.7.0 → profound-0.10.0}/src/profound/types/report_visibility_params.py +0 -0
- {profound-0.7.0 → profound-0.10.0}/src/profound/types/shared/__init__.py +0 -0
- {profound-0.7.0 → profound-0.10.0}/src/profound/types/shared/pagination.py +0 -0
- {profound-0.7.0 → profound-0.10.0}/src/profound/types/shared_params/__init__.py +0 -0
- {profound-0.7.0 → profound-0.10.0}/src/profound/types/shared_params/pagination.py +0 -0
- {profound-0.7.0 → profound-0.10.0}/tests/__init__.py +0 -0
- {profound-0.7.0 → profound-0.10.0}/tests/api_resources/__init__.py +0 -0
- {profound-0.7.0 → profound-0.10.0}/tests/api_resources/logs/__init__.py +0 -0
- {profound-0.7.0 → profound-0.10.0}/tests/api_resources/logs/test_raw.py +0 -0
- {profound-0.7.0 → profound-0.10.0}/tests/api_resources/organizations/__init__.py +0 -0
- {profound-0.7.0 → profound-0.10.0}/tests/api_resources/test_organizations.py +0 -0
- {profound-0.7.0 → profound-0.10.0}/tests/api_resources/test_prompts.py +0 -0
- {profound-0.7.0 → profound-0.10.0}/tests/api_resources/test_reports.py +0 -0
- {profound-0.7.0 → profound-0.10.0}/tests/conftest.py +0 -0
- {profound-0.7.0 → profound-0.10.0}/tests/sample_file.txt +0 -0
- {profound-0.7.0 → profound-0.10.0}/tests/test_deepcopy.py +0 -0
- {profound-0.7.0 → profound-0.10.0}/tests/test_extract_files.py +0 -0
- {profound-0.7.0 → profound-0.10.0}/tests/test_files.py +0 -0
- {profound-0.7.0 → profound-0.10.0}/tests/test_qs.py +0 -0
- {profound-0.7.0 → profound-0.10.0}/tests/test_required_args.py +0 -0
- {profound-0.7.0 → profound-0.10.0}/tests/test_response.py +0 -0
- {profound-0.7.0 → profound-0.10.0}/tests/test_streaming.py +0 -0
- {profound-0.7.0 → profound-0.10.0}/tests/test_transform.py +0 -0
- {profound-0.7.0 → profound-0.10.0}/tests/test_utils/test_datetime_parse.py +0 -0
- {profound-0.7.0 → profound-0.10.0}/tests/test_utils/test_proxy.py +0 -0
- {profound-0.7.0 → profound-0.10.0}/tests/test_utils/test_typing.py +0 -0
- {profound-0.7.0 → profound-0.10.0}/tests/utils.py +0 -0
|
@@ -1,5 +1,47 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.10.0 (2025-11-20)
|
|
4
|
+
|
|
5
|
+
Full Changelog: [v0.9.1...v0.10.0](https://github.com/cooper-square-technologies/profound-python-sdk/compare/v0.9.1...v0.10.0)
|
|
6
|
+
|
|
7
|
+
### Features
|
|
8
|
+
|
|
9
|
+
* **api:** add assets endpoint ([8ec3780](https://github.com/cooper-square-technologies/profound-python-sdk/commit/8ec378015028d3d9b1ec4da7dd4a5e26f795e1a3))
|
|
10
|
+
|
|
11
|
+
## 0.9.1 (2025-11-13)
|
|
12
|
+
|
|
13
|
+
Full Changelog: [v0.9.0...v0.9.1](https://github.com/cooper-square-technologies/profound-python-sdk/compare/v0.9.0...v0.9.1)
|
|
14
|
+
|
|
15
|
+
## 0.9.0 (2025-11-12)
|
|
16
|
+
|
|
17
|
+
Full Changelog: [v0.8.0...v0.9.0](https://github.com/cooper-square-technologies/profound-python-sdk/compare/v0.8.0...v0.9.0)
|
|
18
|
+
|
|
19
|
+
### Features
|
|
20
|
+
|
|
21
|
+
* **api:** api update ([47d3e50](https://github.com/cooper-square-technologies/profound-python-sdk/commit/47d3e50261b0c6554bd6ce507932dd72d138cdab))
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
### Bug Fixes
|
|
25
|
+
|
|
26
|
+
* **client:** close streams without requiring full consumption ([9ae7af9](https://github.com/cooper-square-technologies/profound-python-sdk/commit/9ae7af92567de6cfbe7739b2a12470b4518420f5))
|
|
27
|
+
* compat with Python 3.14 ([a41771d](https://github.com/cooper-square-technologies/profound-python-sdk/commit/a41771db29daa4c0f73ac248c5794eff0394f999))
|
|
28
|
+
* **compat:** update signatures of `model_dump` and `model_dump_json` for Pydantic v1 ([e25c18a](https://github.com/cooper-square-technologies/profound-python-sdk/commit/e25c18a3d1d954cf005ea667c1d1cc1f2ed8f08d))
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
### Chores
|
|
32
|
+
|
|
33
|
+
* **internal/tests:** avoid race condition with implicit client cleanup ([48e555a](https://github.com/cooper-square-technologies/profound-python-sdk/commit/48e555a385eacdb968e459946e53806dff35a028))
|
|
34
|
+
* **internal:** grammar fix (it's -> its) ([8233893](https://github.com/cooper-square-technologies/profound-python-sdk/commit/82338939c32ee3997a20e30ee24aab86d97c5ec9))
|
|
35
|
+
* **package:** drop Python 3.8 support ([db71ed2](https://github.com/cooper-square-technologies/profound-python-sdk/commit/db71ed2ad307fb5cefba7dd30f4374c5bb94f10e))
|
|
36
|
+
|
|
37
|
+
## 0.8.0 (2025-10-28)
|
|
38
|
+
|
|
39
|
+
Full Changelog: [v0.7.0...v0.8.0](https://github.com/cooper-square-technologies/profound-python-sdk/compare/v0.7.0...v0.8.0)
|
|
40
|
+
|
|
41
|
+
### Features
|
|
42
|
+
|
|
43
|
+
* **api:** api update ([7958299](https://github.com/cooper-square-technologies/profound-python-sdk/commit/7958299a1156ad45de08e406fd0d520c32dac51c))
|
|
44
|
+
|
|
3
45
|
## 0.7.0 (2025-10-27)
|
|
4
46
|
|
|
5
47
|
Full Changelog: [v0.6.0...v0.7.0](https://github.com/cooper-square-technologies/profound-python-sdk/compare/v0.6.0...v0.7.0)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: profound
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.10.0
|
|
4
4
|
Summary: The official Python library for the profound API
|
|
5
5
|
Project-URL: Homepage, https://github.com/cooper-square-technologies/profound-python-sdk
|
|
6
6
|
Project-URL: Repository, https://github.com/cooper-square-technologies/profound-python-sdk
|
|
@@ -13,7 +13,6 @@ Classifier: Operating System :: Microsoft :: Windows
|
|
|
13
13
|
Classifier: Operating System :: OS Independent
|
|
14
14
|
Classifier: Operating System :: POSIX
|
|
15
15
|
Classifier: Operating System :: POSIX :: Linux
|
|
16
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
17
16
|
Classifier: Programming Language :: Python :: 3.9
|
|
18
17
|
Classifier: Programming Language :: Python :: 3.10
|
|
19
18
|
Classifier: Programming Language :: Python :: 3.11
|
|
@@ -21,7 +20,7 @@ Classifier: Programming Language :: Python :: 3.12
|
|
|
21
20
|
Classifier: Programming Language :: Python :: 3.13
|
|
22
21
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
23
22
|
Classifier: Typing :: Typed
|
|
24
|
-
Requires-Python: >=3.
|
|
23
|
+
Requires-Python: >=3.9
|
|
25
24
|
Requires-Dist: anyio<5,>=3.5.0
|
|
26
25
|
Requires-Dist: distro<2,>=1.7.0
|
|
27
26
|
Requires-Dist: httpx<1,>=0.23.0
|
|
@@ -38,7 +37,7 @@ Description-Content-Type: text/markdown
|
|
|
38
37
|
<!-- prettier-ignore -->
|
|
39
38
|
[)](https://pypi.org/project/profound/)
|
|
40
39
|
|
|
41
|
-
The Profound Python library provides convenient access to the Profound REST API from any Python 3.
|
|
40
|
+
The Profound Python library provides convenient access to the Profound REST API from any Python 3.9+
|
|
42
41
|
application. The library includes type definitions for all request params and response fields,
|
|
43
42
|
and offers both synchronous and asynchronous clients powered by [httpx](https://github.com/encode/httpx).
|
|
44
43
|
|
|
@@ -408,7 +407,7 @@ print(profound.__version__)
|
|
|
408
407
|
|
|
409
408
|
## Requirements
|
|
410
409
|
|
|
411
|
-
Python 3.
|
|
410
|
+
Python 3.9 or higher.
|
|
412
411
|
|
|
413
412
|
## Contributing
|
|
414
413
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<!-- prettier-ignore -->
|
|
4
4
|
[)](https://pypi.org/project/profound/)
|
|
5
5
|
|
|
6
|
-
The Profound Python library provides convenient access to the Profound REST API from any Python 3.
|
|
6
|
+
The Profound Python library provides convenient access to the Profound REST API from any Python 3.9+
|
|
7
7
|
application. The library includes type definitions for all request params and response fields,
|
|
8
8
|
and offers both synchronous and asynchronous clients powered by [httpx](https://github.com/encode/httpx).
|
|
9
9
|
|
|
@@ -373,7 +373,7 @@ print(profound.__version__)
|
|
|
373
373
|
|
|
374
374
|
## Requirements
|
|
375
375
|
|
|
376
|
-
Python 3.
|
|
376
|
+
Python 3.9 or higher.
|
|
377
377
|
|
|
378
378
|
## Contributing
|
|
379
379
|
|
|
@@ -30,6 +30,7 @@ Types:
|
|
|
30
30
|
from profound.types.organizations import (
|
|
31
31
|
OrgItem,
|
|
32
32
|
CategoryListResponse,
|
|
33
|
+
CategoryAssetsResponse,
|
|
33
34
|
CategoryPromptsResponse,
|
|
34
35
|
CategoryTagsResponse,
|
|
35
36
|
CategoryTopicsResponse,
|
|
@@ -39,6 +40,7 @@ from profound.types.organizations import (
|
|
|
39
40
|
Methods:
|
|
40
41
|
|
|
41
42
|
- <code title="get /v1/org/categories">client.organizations.categories.<a href="./src/profound/resources/organizations/categories.py">list</a>() -> <a href="./src/profound/types/organizations/category_list_response.py">CategoryListResponse</a></code>
|
|
43
|
+
- <code title="get /v1/org/categories/{category_id}/assets">client.organizations.categories.<a href="./src/profound/resources/organizations/categories.py">assets</a>(category_id) -> <a href="./src/profound/types/organizations/category_assets_response.py">CategoryAssetsResponse</a></code>
|
|
42
44
|
- <code title="get /v1/org/categories/{category_id}/prompts">client.organizations.categories.<a href="./src/profound/resources/organizations/categories.py">prompts</a>(category_id) -> <a href="./src/profound/types/organizations/category_prompts_response.py">CategoryPromptsResponse</a></code>
|
|
43
45
|
- <code title="get /v1/org/categories/{category_id}/tags">client.organizations.categories.<a href="./src/profound/resources/organizations/categories.py">tags</a>(category_id) -> <a href="./src/profound/types/organizations/category_tags_response.py">CategoryTagsResponse</a></code>
|
|
44
46
|
- <code title="get /v1/org/categories/{category_id}/topics">client.organizations.categories.<a href="./src/profound/resources/organizations/categories.py">topics</a>(category_id) -> <a href="./src/profound/types/organizations/category_topics_response.py">CategoryTopicsResponse</a></code>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "profound"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.10.0"
|
|
4
4
|
description = "The official Python library for the profound API"
|
|
5
5
|
dynamic = ["readme"]
|
|
6
6
|
license = "Apache-2.0"
|
|
@@ -15,11 +15,10 @@ dependencies = [
|
|
|
15
15
|
"distro>=1.7.0, <2",
|
|
16
16
|
"sniffio",
|
|
17
17
|
]
|
|
18
|
-
requires-python = ">= 3.
|
|
18
|
+
requires-python = ">= 3.9"
|
|
19
19
|
classifiers = [
|
|
20
20
|
"Typing :: Typed",
|
|
21
21
|
"Intended Audience :: Developers",
|
|
22
|
-
"Programming Language :: Python :: 3.8",
|
|
23
22
|
"Programming Language :: Python :: 3.9",
|
|
24
23
|
"Programming Language :: Python :: 3.10",
|
|
25
24
|
"Programming Language :: Python :: 3.11",
|
|
@@ -141,7 +140,7 @@ filterwarnings = [
|
|
|
141
140
|
# there are a couple of flags that are still disabled by
|
|
142
141
|
# default in strict mode as they are experimental and niche.
|
|
143
142
|
typeCheckingMode = "strict"
|
|
144
|
-
pythonVersion = "3.
|
|
143
|
+
pythonVersion = "3.9"
|
|
145
144
|
|
|
146
145
|
exclude = [
|
|
147
146
|
"_dev",
|
|
@@ -2,6 +2,7 @@ from __future__ import annotations
|
|
|
2
2
|
|
|
3
3
|
import os
|
|
4
4
|
import inspect
|
|
5
|
+
import weakref
|
|
5
6
|
from typing import TYPE_CHECKING, Any, Type, Union, Generic, TypeVar, Callable, Optional, cast
|
|
6
7
|
from datetime import date, datetime
|
|
7
8
|
from typing_extensions import (
|
|
@@ -256,15 +257,16 @@ class BaseModel(pydantic.BaseModel):
|
|
|
256
257
|
mode: Literal["json", "python"] | str = "python",
|
|
257
258
|
include: IncEx | None = None,
|
|
258
259
|
exclude: IncEx | None = None,
|
|
260
|
+
context: Any | None = None,
|
|
259
261
|
by_alias: bool | None = None,
|
|
260
262
|
exclude_unset: bool = False,
|
|
261
263
|
exclude_defaults: bool = False,
|
|
262
264
|
exclude_none: bool = False,
|
|
265
|
+
exclude_computed_fields: bool = False,
|
|
263
266
|
round_trip: bool = False,
|
|
264
267
|
warnings: bool | Literal["none", "warn", "error"] = True,
|
|
265
|
-
context: dict[str, Any] | None = None,
|
|
266
|
-
serialize_as_any: bool = False,
|
|
267
268
|
fallback: Callable[[Any], Any] | None = None,
|
|
269
|
+
serialize_as_any: bool = False,
|
|
268
270
|
) -> dict[str, Any]:
|
|
269
271
|
"""Usage docs: https://docs.pydantic.dev/2.4/concepts/serialization/#modelmodel_dump
|
|
270
272
|
|
|
@@ -272,16 +274,24 @@ class BaseModel(pydantic.BaseModel):
|
|
|
272
274
|
|
|
273
275
|
Args:
|
|
274
276
|
mode: The mode in which `to_python` should run.
|
|
275
|
-
If mode is 'json', the
|
|
276
|
-
If mode is 'python', the
|
|
277
|
-
include: A
|
|
278
|
-
exclude: A
|
|
277
|
+
If mode is 'json', the output will only contain JSON serializable types.
|
|
278
|
+
If mode is 'python', the output may contain non-JSON-serializable Python objects.
|
|
279
|
+
include: A set of fields to include in the output.
|
|
280
|
+
exclude: A set of fields to exclude from the output.
|
|
281
|
+
context: Additional context to pass to the serializer.
|
|
279
282
|
by_alias: Whether to use the field's alias in the dictionary key if defined.
|
|
280
|
-
exclude_unset: Whether to exclude fields that
|
|
281
|
-
exclude_defaults: Whether to exclude fields that are set to their default value
|
|
282
|
-
exclude_none: Whether to exclude fields that have a value of `None
|
|
283
|
-
|
|
284
|
-
|
|
283
|
+
exclude_unset: Whether to exclude fields that have not been explicitly set.
|
|
284
|
+
exclude_defaults: Whether to exclude fields that are set to their default value.
|
|
285
|
+
exclude_none: Whether to exclude fields that have a value of `None`.
|
|
286
|
+
exclude_computed_fields: Whether to exclude computed fields.
|
|
287
|
+
While this can be useful for round-tripping, it is usually recommended to use the dedicated
|
|
288
|
+
`round_trip` parameter instead.
|
|
289
|
+
round_trip: If True, dumped values should be valid as input for non-idempotent types such as Json[T].
|
|
290
|
+
warnings: How to handle serialization errors. False/"none" ignores them, True/"warn" logs errors,
|
|
291
|
+
"error" raises a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError].
|
|
292
|
+
fallback: A function to call when an unknown value is encountered. If not provided,
|
|
293
|
+
a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError] error is raised.
|
|
294
|
+
serialize_as_any: Whether to serialize fields with duck-typing serialization behavior.
|
|
285
295
|
|
|
286
296
|
Returns:
|
|
287
297
|
A dictionary representation of the model.
|
|
@@ -298,6 +308,8 @@ class BaseModel(pydantic.BaseModel):
|
|
|
298
308
|
raise ValueError("serialize_as_any is only supported in Pydantic v2")
|
|
299
309
|
if fallback is not None:
|
|
300
310
|
raise ValueError("fallback is only supported in Pydantic v2")
|
|
311
|
+
if exclude_computed_fields != False:
|
|
312
|
+
raise ValueError("exclude_computed_fields is only supported in Pydantic v2")
|
|
301
313
|
dumped = super().dict( # pyright: ignore[reportDeprecated]
|
|
302
314
|
include=include,
|
|
303
315
|
exclude=exclude,
|
|
@@ -314,15 +326,17 @@ class BaseModel(pydantic.BaseModel):
|
|
|
314
326
|
self,
|
|
315
327
|
*,
|
|
316
328
|
indent: int | None = None,
|
|
329
|
+
ensure_ascii: bool = False,
|
|
317
330
|
include: IncEx | None = None,
|
|
318
331
|
exclude: IncEx | None = None,
|
|
332
|
+
context: Any | None = None,
|
|
319
333
|
by_alias: bool | None = None,
|
|
320
334
|
exclude_unset: bool = False,
|
|
321
335
|
exclude_defaults: bool = False,
|
|
322
336
|
exclude_none: bool = False,
|
|
337
|
+
exclude_computed_fields: bool = False,
|
|
323
338
|
round_trip: bool = False,
|
|
324
339
|
warnings: bool | Literal["none", "warn", "error"] = True,
|
|
325
|
-
context: dict[str, Any] | None = None,
|
|
326
340
|
fallback: Callable[[Any], Any] | None = None,
|
|
327
341
|
serialize_as_any: bool = False,
|
|
328
342
|
) -> str:
|
|
@@ -354,6 +368,10 @@ class BaseModel(pydantic.BaseModel):
|
|
|
354
368
|
raise ValueError("serialize_as_any is only supported in Pydantic v2")
|
|
355
369
|
if fallback is not None:
|
|
356
370
|
raise ValueError("fallback is only supported in Pydantic v2")
|
|
371
|
+
if ensure_ascii != False:
|
|
372
|
+
raise ValueError("ensure_ascii is only supported in Pydantic v2")
|
|
373
|
+
if exclude_computed_fields != False:
|
|
374
|
+
raise ValueError("exclude_computed_fields is only supported in Pydantic v2")
|
|
357
375
|
return super().json( # type: ignore[reportDeprecated]
|
|
358
376
|
indent=indent,
|
|
359
377
|
include=include,
|
|
@@ -573,6 +591,9 @@ class CachedDiscriminatorType(Protocol):
|
|
|
573
591
|
__discriminator__: DiscriminatorDetails
|
|
574
592
|
|
|
575
593
|
|
|
594
|
+
DISCRIMINATOR_CACHE: weakref.WeakKeyDictionary[type, DiscriminatorDetails] = weakref.WeakKeyDictionary()
|
|
595
|
+
|
|
596
|
+
|
|
576
597
|
class DiscriminatorDetails:
|
|
577
598
|
field_name: str
|
|
578
599
|
"""The name of the discriminator field in the variant class, e.g.
|
|
@@ -615,8 +636,9 @@ class DiscriminatorDetails:
|
|
|
615
636
|
|
|
616
637
|
|
|
617
638
|
def _build_discriminated_union_meta(*, union: type, meta_annotations: tuple[Any, ...]) -> DiscriminatorDetails | None:
|
|
618
|
-
|
|
619
|
-
|
|
639
|
+
cached = DISCRIMINATOR_CACHE.get(union)
|
|
640
|
+
if cached is not None:
|
|
641
|
+
return cached
|
|
620
642
|
|
|
621
643
|
discriminator_field_name: str | None = None
|
|
622
644
|
|
|
@@ -669,7 +691,7 @@ def _build_discriminated_union_meta(*, union: type, meta_annotations: tuple[Any,
|
|
|
669
691
|
discriminator_field=discriminator_field_name,
|
|
670
692
|
discriminator_alias=discriminator_alias,
|
|
671
693
|
)
|
|
672
|
-
|
|
694
|
+
DISCRIMINATOR_CACHE.setdefault(union, details)
|
|
673
695
|
return details
|
|
674
696
|
|
|
675
697
|
|
|
@@ -57,9 +57,8 @@ class Stream(Generic[_T]):
|
|
|
57
57
|
for sse in iterator:
|
|
58
58
|
yield process_data(data=sse.json(), cast_to=cast_to, response=response)
|
|
59
59
|
|
|
60
|
-
#
|
|
61
|
-
|
|
62
|
-
...
|
|
60
|
+
# As we might not fully consume the response stream, we need to close it explicitly
|
|
61
|
+
response.close()
|
|
63
62
|
|
|
64
63
|
def __enter__(self) -> Self:
|
|
65
64
|
return self
|
|
@@ -121,9 +120,8 @@ class AsyncStream(Generic[_T]):
|
|
|
121
120
|
async for sse in iterator:
|
|
122
121
|
yield process_data(data=sse.json(), cast_to=cast_to, response=response)
|
|
123
122
|
|
|
124
|
-
#
|
|
125
|
-
|
|
126
|
-
...
|
|
123
|
+
# As we might not fully consume the response stream, we need to close it explicitly
|
|
124
|
+
await response.aclose()
|
|
127
125
|
|
|
128
126
|
async def __aenter__(self) -> Self:
|
|
129
127
|
return self
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
-
import sys
|
|
4
3
|
import asyncio
|
|
5
4
|
import functools
|
|
6
|
-
import
|
|
7
|
-
from typing import Any, TypeVar, Callable, Awaitable
|
|
5
|
+
from typing import TypeVar, Callable, Awaitable
|
|
8
6
|
from typing_extensions import ParamSpec
|
|
9
7
|
|
|
10
8
|
import anyio
|
|
@@ -15,34 +13,11 @@ T_Retval = TypeVar("T_Retval")
|
|
|
15
13
|
T_ParamSpec = ParamSpec("T_ParamSpec")
|
|
16
14
|
|
|
17
15
|
|
|
18
|
-
if sys.version_info >= (3, 9):
|
|
19
|
-
_asyncio_to_thread = asyncio.to_thread
|
|
20
|
-
else:
|
|
21
|
-
# backport of https://docs.python.org/3/library/asyncio-task.html#asyncio.to_thread
|
|
22
|
-
# for Python 3.8 support
|
|
23
|
-
async def _asyncio_to_thread(
|
|
24
|
-
func: Callable[T_ParamSpec, T_Retval], /, *args: T_ParamSpec.args, **kwargs: T_ParamSpec.kwargs
|
|
25
|
-
) -> Any:
|
|
26
|
-
"""Asynchronously run function *func* in a separate thread.
|
|
27
|
-
|
|
28
|
-
Any *args and **kwargs supplied for this function are directly passed
|
|
29
|
-
to *func*. Also, the current :class:`contextvars.Context` is propagated,
|
|
30
|
-
allowing context variables from the main thread to be accessed in the
|
|
31
|
-
separate thread.
|
|
32
|
-
|
|
33
|
-
Returns a coroutine that can be awaited to get the eventual result of *func*.
|
|
34
|
-
"""
|
|
35
|
-
loop = asyncio.events.get_running_loop()
|
|
36
|
-
ctx = contextvars.copy_context()
|
|
37
|
-
func_call = functools.partial(ctx.run, func, *args, **kwargs)
|
|
38
|
-
return await loop.run_in_executor(None, func_call)
|
|
39
|
-
|
|
40
|
-
|
|
41
16
|
async def to_thread(
|
|
42
17
|
func: Callable[T_ParamSpec, T_Retval], /, *args: T_ParamSpec.args, **kwargs: T_ParamSpec.kwargs
|
|
43
18
|
) -> T_Retval:
|
|
44
19
|
if sniffio.current_async_library() == "asyncio":
|
|
45
|
-
return await
|
|
20
|
+
return await asyncio.to_thread(func, *args, **kwargs)
|
|
46
21
|
|
|
47
22
|
return await anyio.to_thread.run_sync(
|
|
48
23
|
functools.partial(func, *args, **kwargs),
|
|
@@ -53,10 +28,7 @@ async def to_thread(
|
|
|
53
28
|
def asyncify(function: Callable[T_ParamSpec, T_Retval]) -> Callable[T_ParamSpec, Awaitable[T_Retval]]:
|
|
54
29
|
"""
|
|
55
30
|
Take a blocking function and create an async one that receives the same
|
|
56
|
-
positional and keyword arguments.
|
|
57
|
-
asyncio.to_thread to run the function in a separate thread. For python version
|
|
58
|
-
3.8, it uses locally defined copy of the asyncio.to_thread function which was
|
|
59
|
-
introduced in python 3.9.
|
|
31
|
+
positional and keyword arguments.
|
|
60
32
|
|
|
61
33
|
Usage:
|
|
62
34
|
|
|
@@ -133,7 +133,7 @@ def is_given(obj: _T | NotGiven | Omit) -> TypeGuard[_T]:
|
|
|
133
133
|
# Type safe methods for narrowing types with TypeVars.
|
|
134
134
|
# The default narrowing for isinstance(obj, dict) is dict[unknown, unknown],
|
|
135
135
|
# however this cause Pyright to rightfully report errors. As we know we don't
|
|
136
|
-
# care about the contained types we can safely use `object` in
|
|
136
|
+
# care about the contained types we can safely use `object` in its place.
|
|
137
137
|
#
|
|
138
138
|
# There are two separate functions defined, `is_*` and `is_*_t` for different use cases.
|
|
139
139
|
# `is_*` is for when you're dealing with an unknown input
|
|
@@ -16,6 +16,7 @@ from ..._response import (
|
|
|
16
16
|
from ..._base_client import make_request_options
|
|
17
17
|
from ...types.organizations.category_list_response import CategoryListResponse
|
|
18
18
|
from ...types.organizations.category_tags_response import CategoryTagsResponse
|
|
19
|
+
from ...types.organizations.category_assets_response import CategoryAssetsResponse
|
|
19
20
|
from ...types.organizations.category_topics_response import CategoryTopicsResponse
|
|
20
21
|
from ...types.organizations.category_prompts_response import CategoryPromptsResponse
|
|
21
22
|
|
|
@@ -61,6 +62,39 @@ class CategoriesResource(SyncAPIResource):
|
|
|
61
62
|
cast_to=CategoryListResponse,
|
|
62
63
|
)
|
|
63
64
|
|
|
65
|
+
def assets(
|
|
66
|
+
self,
|
|
67
|
+
category_id: str,
|
|
68
|
+
*,
|
|
69
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
70
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
71
|
+
extra_headers: Headers | None = None,
|
|
72
|
+
extra_query: Query | None = None,
|
|
73
|
+
extra_body: Body | None = None,
|
|
74
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
75
|
+
) -> CategoryAssetsResponse:
|
|
76
|
+
"""
|
|
77
|
+
Get Category Assets
|
|
78
|
+
|
|
79
|
+
Args:
|
|
80
|
+
extra_headers: Send extra headers
|
|
81
|
+
|
|
82
|
+
extra_query: Add additional query parameters to the request
|
|
83
|
+
|
|
84
|
+
extra_body: Add additional JSON properties to the request
|
|
85
|
+
|
|
86
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
87
|
+
"""
|
|
88
|
+
if not category_id:
|
|
89
|
+
raise ValueError(f"Expected a non-empty value for `category_id` but received {category_id!r}")
|
|
90
|
+
return self._get(
|
|
91
|
+
f"/v1/org/categories/{category_id}/assets",
|
|
92
|
+
options=make_request_options(
|
|
93
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
94
|
+
),
|
|
95
|
+
cast_to=CategoryAssetsResponse,
|
|
96
|
+
)
|
|
97
|
+
|
|
64
98
|
def prompts(
|
|
65
99
|
self,
|
|
66
100
|
category_id: str,
|
|
@@ -200,6 +234,39 @@ class AsyncCategoriesResource(AsyncAPIResource):
|
|
|
200
234
|
cast_to=CategoryListResponse,
|
|
201
235
|
)
|
|
202
236
|
|
|
237
|
+
async def assets(
|
|
238
|
+
self,
|
|
239
|
+
category_id: str,
|
|
240
|
+
*,
|
|
241
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
242
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
243
|
+
extra_headers: Headers | None = None,
|
|
244
|
+
extra_query: Query | None = None,
|
|
245
|
+
extra_body: Body | None = None,
|
|
246
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
247
|
+
) -> CategoryAssetsResponse:
|
|
248
|
+
"""
|
|
249
|
+
Get Category Assets
|
|
250
|
+
|
|
251
|
+
Args:
|
|
252
|
+
extra_headers: Send extra headers
|
|
253
|
+
|
|
254
|
+
extra_query: Add additional query parameters to the request
|
|
255
|
+
|
|
256
|
+
extra_body: Add additional JSON properties to the request
|
|
257
|
+
|
|
258
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
259
|
+
"""
|
|
260
|
+
if not category_id:
|
|
261
|
+
raise ValueError(f"Expected a non-empty value for `category_id` but received {category_id!r}")
|
|
262
|
+
return await self._get(
|
|
263
|
+
f"/v1/org/categories/{category_id}/assets",
|
|
264
|
+
options=make_request_options(
|
|
265
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
266
|
+
),
|
|
267
|
+
cast_to=CategoryAssetsResponse,
|
|
268
|
+
)
|
|
269
|
+
|
|
203
270
|
async def prompts(
|
|
204
271
|
self,
|
|
205
272
|
category_id: str,
|
|
@@ -307,6 +374,9 @@ class CategoriesResourceWithRawResponse:
|
|
|
307
374
|
self.list = to_raw_response_wrapper(
|
|
308
375
|
categories.list,
|
|
309
376
|
)
|
|
377
|
+
self.assets = to_raw_response_wrapper(
|
|
378
|
+
categories.assets,
|
|
379
|
+
)
|
|
310
380
|
self.prompts = to_raw_response_wrapper(
|
|
311
381
|
categories.prompts,
|
|
312
382
|
)
|
|
@@ -325,6 +395,9 @@ class AsyncCategoriesResourceWithRawResponse:
|
|
|
325
395
|
self.list = async_to_raw_response_wrapper(
|
|
326
396
|
categories.list,
|
|
327
397
|
)
|
|
398
|
+
self.assets = async_to_raw_response_wrapper(
|
|
399
|
+
categories.assets,
|
|
400
|
+
)
|
|
328
401
|
self.prompts = async_to_raw_response_wrapper(
|
|
329
402
|
categories.prompts,
|
|
330
403
|
)
|
|
@@ -343,6 +416,9 @@ class CategoriesResourceWithStreamingResponse:
|
|
|
343
416
|
self.list = to_streamed_response_wrapper(
|
|
344
417
|
categories.list,
|
|
345
418
|
)
|
|
419
|
+
self.assets = to_streamed_response_wrapper(
|
|
420
|
+
categories.assets,
|
|
421
|
+
)
|
|
346
422
|
self.prompts = to_streamed_response_wrapper(
|
|
347
423
|
categories.prompts,
|
|
348
424
|
)
|
|
@@ -361,6 +437,9 @@ class AsyncCategoriesResourceWithStreamingResponse:
|
|
|
361
437
|
self.list = async_to_streamed_response_wrapper(
|
|
362
438
|
categories.list,
|
|
363
439
|
)
|
|
440
|
+
self.assets = async_to_streamed_response_wrapper(
|
|
441
|
+
categories.assets,
|
|
442
|
+
)
|
|
364
443
|
self.prompts = async_to_streamed_response_wrapper(
|
|
365
444
|
categories.prompts,
|
|
366
445
|
)
|
|
@@ -134,10 +134,12 @@ class ReportsResource(SyncAPIResource):
|
|
|
134
134
|
*,
|
|
135
135
|
category_id: str,
|
|
136
136
|
end_date: Union[str, datetime],
|
|
137
|
-
metrics: List[Literal["positive", "negative"]],
|
|
137
|
+
metrics: List[Literal["positive", "negative", "occurrences"]],
|
|
138
138
|
start_date: Union[str, datetime],
|
|
139
139
|
date_interval: Literal["day", "week", "month", "year"] | Omit = omit,
|
|
140
|
-
dimensions: List[
|
|
140
|
+
dimensions: List[
|
|
141
|
+
Literal["theme", "date", "region", "topic", "model", "asset_name", "tag", "prompt", "sentiment_type"]
|
|
142
|
+
]
|
|
141
143
|
| Omit = omit,
|
|
142
144
|
filters: Iterable[report_sentiment_params.Filter] | Omit = omit,
|
|
143
145
|
order_by: Dict[str, Literal["asc", "desc"]] | Omit = omit,
|
|
@@ -396,10 +398,12 @@ class AsyncReportsResource(AsyncAPIResource):
|
|
|
396
398
|
*,
|
|
397
399
|
category_id: str,
|
|
398
400
|
end_date: Union[str, datetime],
|
|
399
|
-
metrics: List[Literal["positive", "negative"]],
|
|
401
|
+
metrics: List[Literal["positive", "negative", "occurrences"]],
|
|
400
402
|
start_date: Union[str, datetime],
|
|
401
403
|
date_interval: Literal["day", "week", "month", "year"] | Omit = omit,
|
|
402
|
-
dimensions: List[
|
|
404
|
+
dimensions: List[
|
|
405
|
+
Literal["theme", "date", "region", "topic", "model", "asset_name", "tag", "prompt", "sentiment_type"]
|
|
406
|
+
]
|
|
403
407
|
| Omit = omit,
|
|
404
408
|
filters: Iterable[report_sentiment_params.Filter] | Omit = omit,
|
|
405
409
|
order_by: Dict[str, Literal["asc", "desc"]] | Omit = omit,
|
|
@@ -5,5 +5,6 @@ from __future__ import annotations
|
|
|
5
5
|
from .org_item import OrgItem as OrgItem
|
|
6
6
|
from .category_list_response import CategoryListResponse as CategoryListResponse
|
|
7
7
|
from .category_tags_response import CategoryTagsResponse as CategoryTagsResponse
|
|
8
|
+
from .category_assets_response import CategoryAssetsResponse as CategoryAssetsResponse
|
|
8
9
|
from .category_topics_response import CategoryTopicsResponse as CategoryTopicsResponse
|
|
9
10
|
from .category_prompts_response import CategoryPromptsResponse as CategoryPromptsResponse
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from typing import List, Optional
|
|
4
|
+
from datetime import datetime
|
|
5
|
+
from typing_extensions import TypeAlias
|
|
6
|
+
|
|
7
|
+
from ..._models import BaseModel
|
|
8
|
+
|
|
9
|
+
__all__ = ["CategoryAssetsResponse", "CategoryAssetsResponseItem"]
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class CategoryAssetsResponseItem(BaseModel):
|
|
13
|
+
id: str
|
|
14
|
+
|
|
15
|
+
created_at: datetime
|
|
16
|
+
|
|
17
|
+
is_owned: bool
|
|
18
|
+
|
|
19
|
+
name: str
|
|
20
|
+
|
|
21
|
+
website: str
|
|
22
|
+
|
|
23
|
+
alternate_domains: Optional[List[str]] = None
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
CategoryAssetsResponse: TypeAlias = List[CategoryAssetsResponseItem]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
|
-
from typing import List
|
|
3
|
+
from typing import List, Union
|
|
4
4
|
|
|
5
5
|
from .._models import BaseModel
|
|
6
6
|
|
|
@@ -10,4 +10,4 @@ __all__ = ["ReportResult"]
|
|
|
10
10
|
class ReportResult(BaseModel):
|
|
11
11
|
dimensions: List[str]
|
|
12
12
|
|
|
13
|
-
metrics: List[float]
|
|
13
|
+
metrics: List[Union[float, int]]
|
|
@@ -32,7 +32,7 @@ class ReportSentimentParams(TypedDict, total=False):
|
|
|
32
32
|
Accepts formats: YYYY-MM-DD, YYYY-MM-DD HH:MM, or full ISO timestamp.
|
|
33
33
|
"""
|
|
34
34
|
|
|
35
|
-
metrics: Required[List[Literal["positive", "negative"]]]
|
|
35
|
+
metrics: Required[List[Literal["positive", "negative", "occurrences"]]]
|
|
36
36
|
|
|
37
37
|
start_date: Required[Annotated[Union[str, datetime], PropertyInfo(format="iso8601")]]
|
|
38
38
|
"""Start date for the report.
|
|
@@ -43,7 +43,9 @@ class ReportSentimentParams(TypedDict, total=False):
|
|
|
43
43
|
date_interval: Literal["day", "week", "month", "year"]
|
|
44
44
|
"""Date interval for the report. (only used with date dimension)"""
|
|
45
45
|
|
|
46
|
-
dimensions: List[
|
|
46
|
+
dimensions: List[
|
|
47
|
+
Literal["theme", "date", "region", "topic", "model", "asset_name", "tag", "prompt", "sentiment_type"]
|
|
48
|
+
]
|
|
47
49
|
"""Dimensions to group the report by."""
|
|
48
50
|
|
|
49
51
|
filters: Iterable[Filter]
|