diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 26b1ce24..2b2b4fa9 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.50.0" + ".": "0.51.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index 789d6c71..2ddc3fba 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 75 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/profound/profound-877efb225a136be0aae8263a10935ef8b95f8385487840f27f3c83a401981af8.yml -openapi_spec_hash: 713311bd044cbfc0b31e25d7538f0bc3 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/profound/profound-30fae74d1df17644ef789b2de6080b0ad6a3fb63c6f64cdaec914267395d1a6a.yml +openapi_spec_hash: 835cfb97bbf14c31c152221350117f14 config_hash: 341368a8c64fae1694b7fad2df7c56e0 diff --git a/CHANGELOG.md b/CHANGELOG.md index 18f0cd5d..10568432 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,19 @@ # Changelog +## 0.51.0 (2026-06-25) + +Full Changelog: [v0.50.0...v0.51.0](https://github.com/cooper-square-technologies/profound-python-sdk/compare/v0.50.0...v0.51.0) + +### Features + +* **api:** api update ([afa40e4](https://github.com/cooper-square-technologies/profound-python-sdk/commit/afa40e42bb60bc81555759d7e2845d112fea30a9)) +* **api:** api update ([bb2a85d](https://github.com/cooper-square-technologies/profound-python-sdk/commit/bb2a85d5a029e323656569bc05736789b0503857)) +* **api:** api update ([90d8c7c](https://github.com/cooper-square-technologies/profound-python-sdk/commit/90d8c7c7a95dd2fd14cfbcc652e8a1a4178f2696)) +* **api:** api update ([5b6f4bd](https://github.com/cooper-square-technologies/profound-python-sdk/commit/5b6f4bd921006e33d4e32915e0c14218fa6d0a4c)) +* **api:** api update ([84612c6](https://github.com/cooper-square-technologies/profound-python-sdk/commit/84612c603c3b8993b441565b8fb04f343c38b303)) +* **api:** api update ([e5ec5f3](https://github.com/cooper-square-technologies/profound-python-sdk/commit/e5ec5f38cc317bc92859ca6efc1e9b812a7a1eb9)) +* **api:** api update ([25a1ba5](https://github.com/cooper-square-technologies/profound-python-sdk/commit/25a1ba52db42b607436eb0f84f7b1ba5f580b9e7)) + ## 0.50.0 (2026-06-18) Full Changelog: [v0.49.0...v0.50.0](https://github.com/cooper-square-technologies/profound-python-sdk/compare/v0.49.0...v0.50.0) diff --git a/pyproject.toml b/pyproject.toml index e087a6c5..93cac399 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "profound" -version = "0.50.0" +version = "0.51.0" description = "The official Python library for the profound API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/profound/_version.py b/src/profound/_version.py index 7e67227c..c822d831 100644 --- a/src/profound/_version.py +++ b/src/profound/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "profound" -__version__ = "0.50.0" # x-release-please-version +__version__ = "0.51.0" # x-release-please-version diff --git a/src/profound/resources/reports/reports.py b/src/profound/resources/reports/reports.py index 62245b32..c5839868 100644 --- a/src/profound/resources/reports/reports.py +++ b/src/profound/resources/reports/reports.py @@ -22,7 +22,7 @@ report_get_referrals_report_params, report_get_referrals_report_v2_params, ) -from ..._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given +from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from ..._utils import maybe_transform, async_maybe_transform from .accuracy import ( AccuracyResource, @@ -649,38 +649,21 @@ def query_sentiment_v2( *, asset_name: str, category_id: str, - end_date: str, - start_date: str, - claim_filters: Optional[report_query_sentiment_v2_params.ClaimFilters] | Omit = omit, - comparison_end_date: Optional[str] | Omit = omit, - comparison_start_date: Optional[str] | Omit = omit, - date_bucket: Optional[Literal["daily", "weekly", "monthly"]] | Omit = omit, - exclude_topic_ids: bool | Omit = omit, - group_by: Optional[ - List[ - Literal[ - "topic", "region", "platform", "prompt", "persona", "tag", "theme", "claim", "run", "competitor" - ] + end_date: Union[str, datetime], + metrics: List[Literal["sentiment", "occurrence"]], + start_date: Union[str, datetime], + comparison_end_date: Union[str, datetime, None] | Omit = omit, + comparison_start_date: Union[str, datetime, None] | Omit = omit, + date_interval: Literal["hour", "day", "week", "month", "quarter", "year", "relative_week"] | Omit = omit, + dimensions: List[ + Literal[ + "date", "topic", "region", "model", "prompt", "persona", "tag", "theme", "claim", "run", "asset_name" ] ] | Omit = omit, - include_no_persona: bool | Omit = omit, - include_no_tag: bool | Omit = omit, - limit: Optional[int] | Omit = omit, - metrics: Optional[List[Literal["sentiment", "occurrence"]]] | Omit = omit, - offset: int | Omit = omit, - owned_asset_names_to_exclude: SequenceNotStr[str] | Omit = omit, - persona_ids: Optional[SequenceNotStr[str]] | Omit = omit, - platform_ids: Optional[SequenceNotStr[str]] | Omit = omit, - prompt_ids: Optional[SequenceNotStr[str]] | Omit = omit, - region_ids: Optional[SequenceNotStr[str]] | Omit = omit, - run_ids: Optional[SequenceNotStr[str]] | Omit = omit, - sort_by: Optional[Literal["occurrence", "assessment_count", "positive_sentiment", "negative_sentiment"]] - | Omit = omit, - sort_direction: Literal["asc", "desc"] | Omit = omit, - tag_filter_type: Literal["all", "any"] | Omit = omit, - tag_ids: Optional[SequenceNotStr[str]] | Omit = omit, - topic_ids: Optional[SequenceNotStr[str]] | Omit = omit, + filters: Iterable[report_query_sentiment_v2_params.Filter] | Omit = omit, + order_by: Dict[str, Literal["asc", "desc"]] | Omit = omit, + pagination: Pagination | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -688,10 +671,32 @@ def query_sentiment_v2( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ReportQuerySentimentV2Response: - """ - Query Sentiment V2 + """Query Sentiment V2 Args: + end_date: End date for the report. + + Accepts formats: YYYY-MM-DD, YYYY-MM-DD HH:MM, or full + ISO timestamp. + + start_date: Start date for the report. Accepts formats: YYYY-MM-DD, YYYY-MM-DD HH:MM, or + full ISO timestamp. + + comparison_end_date: End of the previous period for delta computation. + + comparison_start_date: Start of the previous period for delta computation. + + date_interval: Date interval for the report. Only used when dimensions includes date. + + dimensions: Dimensions to group the report by. + + filters: List of filters to apply to the sentiment-v2 report. + + order_by: Custom ordering of report results. Dimension keys must also be present in + dimensions. The sentiment metric orders by positive_sentiment. + + pagination: Pagination settings for the report results. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -707,29 +712,15 @@ def query_sentiment_v2( "asset_name": asset_name, "category_id": category_id, "end_date": end_date, + "metrics": metrics, "start_date": start_date, - "claim_filters": claim_filters, "comparison_end_date": comparison_end_date, "comparison_start_date": comparison_start_date, - "date_bucket": date_bucket, - "exclude_topic_ids": exclude_topic_ids, - "group_by": group_by, - "include_no_persona": include_no_persona, - "include_no_tag": include_no_tag, - "limit": limit, - "metrics": metrics, - "offset": offset, - "owned_asset_names_to_exclude": owned_asset_names_to_exclude, - "persona_ids": persona_ids, - "platform_ids": platform_ids, - "prompt_ids": prompt_ids, - "region_ids": region_ids, - "run_ids": run_ids, - "sort_by": sort_by, - "sort_direction": sort_direction, - "tag_filter_type": tag_filter_type, - "tag_ids": tag_ids, - "topic_ids": topic_ids, + "date_interval": date_interval, + "dimensions": dimensions, + "filters": filters, + "order_by": order_by, + "pagination": pagination, }, report_query_sentiment_v2_params.ReportQuerySentimentV2Params, ), @@ -1816,38 +1807,21 @@ async def query_sentiment_v2( *, asset_name: str, category_id: str, - end_date: str, - start_date: str, - claim_filters: Optional[report_query_sentiment_v2_params.ClaimFilters] | Omit = omit, - comparison_end_date: Optional[str] | Omit = omit, - comparison_start_date: Optional[str] | Omit = omit, - date_bucket: Optional[Literal["daily", "weekly", "monthly"]] | Omit = omit, - exclude_topic_ids: bool | Omit = omit, - group_by: Optional[ - List[ - Literal[ - "topic", "region", "platform", "prompt", "persona", "tag", "theme", "claim", "run", "competitor" - ] + end_date: Union[str, datetime], + metrics: List[Literal["sentiment", "occurrence"]], + start_date: Union[str, datetime], + comparison_end_date: Union[str, datetime, None] | Omit = omit, + comparison_start_date: Union[str, datetime, None] | Omit = omit, + date_interval: Literal["hour", "day", "week", "month", "quarter", "year", "relative_week"] | Omit = omit, + dimensions: List[ + Literal[ + "date", "topic", "region", "model", "prompt", "persona", "tag", "theme", "claim", "run", "asset_name" ] ] | Omit = omit, - include_no_persona: bool | Omit = omit, - include_no_tag: bool | Omit = omit, - limit: Optional[int] | Omit = omit, - metrics: Optional[List[Literal["sentiment", "occurrence"]]] | Omit = omit, - offset: int | Omit = omit, - owned_asset_names_to_exclude: SequenceNotStr[str] | Omit = omit, - persona_ids: Optional[SequenceNotStr[str]] | Omit = omit, - platform_ids: Optional[SequenceNotStr[str]] | Omit = omit, - prompt_ids: Optional[SequenceNotStr[str]] | Omit = omit, - region_ids: Optional[SequenceNotStr[str]] | Omit = omit, - run_ids: Optional[SequenceNotStr[str]] | Omit = omit, - sort_by: Optional[Literal["occurrence", "assessment_count", "positive_sentiment", "negative_sentiment"]] - | Omit = omit, - sort_direction: Literal["asc", "desc"] | Omit = omit, - tag_filter_type: Literal["all", "any"] | Omit = omit, - tag_ids: Optional[SequenceNotStr[str]] | Omit = omit, - topic_ids: Optional[SequenceNotStr[str]] | Omit = omit, + filters: Iterable[report_query_sentiment_v2_params.Filter] | Omit = omit, + order_by: Dict[str, Literal["asc", "desc"]] | Omit = omit, + pagination: Pagination | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, @@ -1855,10 +1829,32 @@ async def query_sentiment_v2( extra_body: Body | None = None, timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ReportQuerySentimentV2Response: - """ - Query Sentiment V2 + """Query Sentiment V2 Args: + end_date: End date for the report. + + Accepts formats: YYYY-MM-DD, YYYY-MM-DD HH:MM, or full + ISO timestamp. + + start_date: Start date for the report. Accepts formats: YYYY-MM-DD, YYYY-MM-DD HH:MM, or + full ISO timestamp. + + comparison_end_date: End of the previous period for delta computation. + + comparison_start_date: Start of the previous period for delta computation. + + date_interval: Date interval for the report. Only used when dimensions includes date. + + dimensions: Dimensions to group the report by. + + filters: List of filters to apply to the sentiment-v2 report. + + order_by: Custom ordering of report results. Dimension keys must also be present in + dimensions. The sentiment metric orders by positive_sentiment. + + pagination: Pagination settings for the report results. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -1874,29 +1870,15 @@ async def query_sentiment_v2( "asset_name": asset_name, "category_id": category_id, "end_date": end_date, + "metrics": metrics, "start_date": start_date, - "claim_filters": claim_filters, "comparison_end_date": comparison_end_date, "comparison_start_date": comparison_start_date, - "date_bucket": date_bucket, - "exclude_topic_ids": exclude_topic_ids, - "group_by": group_by, - "include_no_persona": include_no_persona, - "include_no_tag": include_no_tag, - "limit": limit, - "metrics": metrics, - "offset": offset, - "owned_asset_names_to_exclude": owned_asset_names_to_exclude, - "persona_ids": persona_ids, - "platform_ids": platform_ids, - "prompt_ids": prompt_ids, - "region_ids": region_ids, - "run_ids": run_ids, - "sort_by": sort_by, - "sort_direction": sort_direction, - "tag_filter_type": tag_filter_type, - "tag_ids": tag_ids, - "topic_ids": topic_ids, + "date_interval": date_interval, + "dimensions": dimensions, + "filters": filters, + "order_by": order_by, + "pagination": pagination, }, report_query_sentiment_v2_params.ReportQuerySentimentV2Params, ), diff --git a/src/profound/types/report_query_sentiment_v2_params.py b/src/profound/types/report_query_sentiment_v2_params.py index 32f1b261..8080298c 100644 --- a/src/profound/types/report_query_sentiment_v2_params.py +++ b/src/profound/types/report_query_sentiment_v2_params.py @@ -2,12 +2,30 @@ from __future__ import annotations -from typing import List, Optional -from typing_extensions import Literal, Required, TypedDict +from typing import Dict, List, Union, Iterable +from datetime import datetime +from typing_extensions import Literal, Required, Annotated, TypeAlias, TypedDict from .._types import SequenceNotStr - -__all__ = ["ReportQuerySentimentV2Params", "ClaimFilters"] +from .._utils import PropertyInfo +from .shared_params.pagination import Pagination + +__all__ = [ + "ReportQuerySentimentV2Params", + "Filter", + "FilterSentimentV2ModelIDFilter", + "FilterSentimentV2RegionIDFilter", + "FilterSentimentV2TopicIDFilter", + "FilterSentimentV2PromptIDFilter", + "FilterSentimentV2PersonaIDFilter", + "FilterSentimentV2TagIDFilter", + "FilterSentimentV2RunIDFilter", + "FilterSentimentV2ThemeIDFilter", + "FilterSentimentV2ThemeFilter", + "FilterSentimentV2ClaimIDFilter", + "FilterSentimentV2ClaimFilter", + "FilterSentimentV2SentimentFilter", +] class ReportQuerySentimentV2Params(TypedDict, total=False): @@ -15,62 +33,179 @@ class ReportQuerySentimentV2Params(TypedDict, total=False): category_id: Required[str] - end_date: Required[str] + end_date: Required[Annotated[Union[str, datetime], PropertyInfo(format="iso8601")]] + """End date for the report. + + Accepts formats: YYYY-MM-DD, YYYY-MM-DD HH:MM, or full ISO timestamp. + """ - start_date: Required[str] + metrics: Required[List[Literal["sentiment", "occurrence"]]] - claim_filters: Optional[ClaimFilters] + start_date: Required[Annotated[Union[str, datetime], PropertyInfo(format="iso8601")]] + """Start date for the report. - comparison_end_date: Optional[str] + Accepts formats: YYYY-MM-DD, YYYY-MM-DD HH:MM, or full ISO timestamp. + """ - comparison_start_date: Optional[str] + comparison_end_date: Annotated[Union[str, datetime, None], PropertyInfo(format="iso8601")] + """End of the previous period for delta computation.""" - date_bucket: Optional[Literal["daily", "weekly", "monthly"]] + comparison_start_date: Annotated[Union[str, datetime, None], PropertyInfo(format="iso8601")] + """Start of the previous period for delta computation.""" - exclude_topic_ids: bool + date_interval: Literal["hour", "day", "week", "month", "quarter", "year", "relative_week"] + """Date interval for the report. Only used when dimensions includes date.""" - group_by: Optional[ - List[Literal["topic", "region", "platform", "prompt", "persona", "tag", "theme", "claim", "run", "competitor"]] + dimensions: List[ + Literal["date", "topic", "region", "model", "prompt", "persona", "tag", "theme", "claim", "run", "asset_name"] ] + """Dimensions to group the report by.""" + + filters: Iterable[Filter] + """List of filters to apply to the sentiment-v2 report.""" + + order_by: Dict[str, Literal["asc", "desc"]] + """Custom ordering of report results. + + Dimension keys must also be present in dimensions. The sentiment metric orders + by positive_sentiment. + """ + + pagination: Pagination + """Pagination settings for the report results.""" + + +class FilterSentimentV2ModelIDFilter(TypedDict, total=False): + field: Required[Literal["model_id"]] + + operator: Required[Literal["is", "not_is", "in", "not_in"]] + + value: Required[Union[str, SequenceNotStr[str]]] + + +class FilterSentimentV2RegionIDFilter(TypedDict, total=False): + field: Required[Literal["region_id"]] + + operator: Required[Literal["is", "not_is", "in", "not_in"]] + + value: Required[Union[str, SequenceNotStr[str]]] + + +class FilterSentimentV2TopicIDFilter(TypedDict, total=False): + field: Required[Literal["topic_id"]] + + operator: Required[Literal["is", "not_is", "in", "not_in"]] + + value: Required[Union[str, SequenceNotStr[str]]] + - include_no_persona: bool +class FilterSentimentV2PromptIDFilter(TypedDict, total=False): + field: Required[Literal["prompt_id"]] - include_no_tag: bool + operator: Required[Literal["is", "not_is", "in", "not_in"]] - limit: Optional[int] + value: Required[Union[str, SequenceNotStr[str]]] - metrics: Optional[List[Literal["sentiment", "occurrence"]]] - offset: int +class FilterSentimentV2PersonaIDFilter(TypedDict, total=False): + field: Required[Literal["persona_id"]] - owned_asset_names_to_exclude: SequenceNotStr[str] + operator: Required[Literal["is", "not_is", "in", "not_in"]] - persona_ids: Optional[SequenceNotStr[str]] + value: Required[Union[str, SequenceNotStr[str]]] - platform_ids: Optional[SequenceNotStr[str]] - prompt_ids: Optional[SequenceNotStr[str]] +class FilterSentimentV2TagIDFilter(TypedDict, total=False): + field: Required[Literal["tag_id"]] - region_ids: Optional[SequenceNotStr[str]] + operator: Required[Literal["is", "not_is", "in", "not_in"]] - run_ids: Optional[SequenceNotStr[str]] + value: Required[Union[str, SequenceNotStr[str]]] - sort_by: Optional[Literal["occurrence", "assessment_count", "positive_sentiment", "negative_sentiment"]] - sort_direction: Literal["asc", "desc"] +class FilterSentimentV2RunIDFilter(TypedDict, total=False): + field: Required[Literal["run_id"]] - tag_filter_type: Literal["all", "any"] + operator: Required[Literal["is", "not_is", "in", "not_in"]] + + value: Required[Union[str, SequenceNotStr[str]]] + + +class FilterSentimentV2ThemeIDFilter(TypedDict, total=False): + field: Required[Literal["theme_id"]] + + operator: Required[Literal["is", "not_is", "in", "not_in"]] + + value: Required[Union[str, SequenceNotStr[str]]] + + +class FilterSentimentV2ThemeFilter(TypedDict, total=False): + field: Required[Literal["theme"]] + + operator: Required[ + Literal[ + "is", + "not_is", + "in", + "not_in", + "contains", + "not_contains", + "matches", + "contains_case_insensitive", + "not_contains_case_insensitive", + ] + ] + + value: Required[Union[str, SequenceNotStr[str]]] + + +class FilterSentimentV2ClaimIDFilter(TypedDict, total=False): + field: Required[Literal["claim_id"]] + + operator: Required[Literal["is", "not_is", "in", "not_in"]] + + value: Required[Union[str, SequenceNotStr[str]]] + + +class FilterSentimentV2ClaimFilter(TypedDict, total=False): + field: Required[Literal["claim"]] + + operator: Required[ + Literal[ + "is", + "not_is", + "in", + "not_in", + "contains", + "not_contains", + "matches", + "contains_case_insensitive", + "not_contains_case_insensitive", + ] + ] - tag_ids: Optional[SequenceNotStr[str]] + value: Required[Union[str, SequenceNotStr[str]]] - topic_ids: Optional[SequenceNotStr[str]] +class FilterSentimentV2SentimentFilter(TypedDict, total=False): + field: Required[Literal["sentiment"]] -class ClaimFilters(TypedDict, total=False): - claim: Optional[str] + operator: Required[Literal["is", "not_is", "in", "not_in"]] - claim_id: Optional[str] + value: Required[Union[Literal["positive", "negative"], List[Literal["positive", "negative"]]]] - sentiment: Optional[Literal["positive", "negative"]] - theme_id: Optional[str] +Filter: TypeAlias = Union[ + FilterSentimentV2ModelIDFilter, + FilterSentimentV2RegionIDFilter, + FilterSentimentV2TopicIDFilter, + FilterSentimentV2PromptIDFilter, + FilterSentimentV2PersonaIDFilter, + FilterSentimentV2TagIDFilter, + FilterSentimentV2RunIDFilter, + FilterSentimentV2ThemeIDFilter, + FilterSentimentV2ThemeFilter, + FilterSentimentV2ClaimIDFilter, + FilterSentimentV2ClaimFilter, + FilterSentimentV2SentimentFilter, +] diff --git a/src/profound/types/report_query_sentiment_v2_response.py b/src/profound/types/report_query_sentiment_v2_response.py index 7b56db3a..6c423994 100644 --- a/src/profound/types/report_query_sentiment_v2_response.py +++ b/src/profound/types/report_query_sentiment_v2_response.py @@ -61,6 +61,12 @@ class DataScores(BaseModel): class DataGroupMetadata(BaseModel): asset_name: Optional[str] = None + child_count_matching: Optional[int] = None + + child_count_total: Optional[int] = None + + child_matches_search: Optional[bool] = None + claim: Optional[str] = None claim_id: Optional[str] = None @@ -69,6 +75,8 @@ class DataGroupMetadata(BaseModel): api_model_id: Optional[str] = FieldInfo(alias="model_id", default=None) + parent_matches_search: Optional[bool] = None + persona_id: Optional[str] = None prompt_id: Optional[str] = None diff --git a/src/profound/types/reports/accuracy_create_citation_analysis_response.py b/src/profound/types/reports/accuracy_create_citation_analysis_response.py index d72de660..231ebdfc 100644 --- a/src/profound/types/reports/accuracy_create_citation_analysis_response.py +++ b/src/profound/types/reports/accuracy_create_citation_analysis_response.py @@ -7,7 +7,23 @@ from ..._models import BaseModel -__all__ = ["AccuracyCreateCitationAnalysisResponse", "Claim"] +__all__ = ["AccuracyCreateCitationAnalysisResponse", "Claim", "ClaimEvidence"] + + +class ClaimEvidence(BaseModel): + """A single knowledge-base ground-truth snippet that refutes a claim's cluster. + + ``kb_name`` is the official knowledge base name; ``kb_path`` is the document + path within that knowledge base. ``kb_name`` is populated by the external API + layer (which can reach the knowledge-base service) and defaults to ``""`` + elsewhere. + """ + + kb_name: Optional[str] = FieldInfo(alias="kbName", default=None) + + kb_path: Optional[str] = FieldInfo(alias="kbPath", default=None) + + kb_snippet: Optional[str] = FieldInfo(alias="kbSnippet", default=None) class Claim(BaseModel): @@ -15,6 +31,11 @@ class Claim(BaseModel): ``attribute`` carries the cluster's canonical claim so the drawer can group claims the same way it groups sentiment attributes. + + ``reasoning`` and ``evidence`` mirror the cluster's FactCheck verdict: the + "why it's inaccurate" explanation plus the refuting knowledge-base snippets + surfaced in the Claim Analysis drawer. ``kb_path``/``kb_snippet`` are retained + as the cluster's single representative snippet for backward compatibility. """ attribute: str @@ -31,8 +52,16 @@ class Claim(BaseModel): snippet: str + evidence: Optional[List[ClaimEvidence]] = None + + kb_path: Optional[str] = FieldInfo(alias="kbPath", default=None) + + kb_snippet: Optional[str] = FieldInfo(alias="kbSnippet", default=None) + polarity: Optional[Literal["positive", "negative"]] = None + reasoning: Optional[str] = None + class AccuracyCreateCitationAnalysisResponse(BaseModel): domain: str diff --git a/src/profound/types/reports/accuracy_create_claim_citations_response.py b/src/profound/types/reports/accuracy_create_claim_citations_response.py index b3dcde3b..c7fbc20a 100644 --- a/src/profound/types/reports/accuracy_create_claim_citations_response.py +++ b/src/profound/types/reports/accuracy_create_claim_citations_response.py @@ -16,6 +16,8 @@ class Data(BaseModel): citation_share: float = FieldInfo(alias="citationShare") + domain_category: str = FieldInfo(alias="domainCategory") + hostname: str href: str diff --git a/src/profound/types/reports/accuracy_create_cluster_verification_pairs_response.py b/src/profound/types/reports/accuracy_create_cluster_verification_pairs_response.py index aaa99e43..bee2fbed 100644 --- a/src/profound/types/reports/accuracy_create_cluster_verification_pairs_response.py +++ b/src/profound/types/reports/accuracy_create_cluster_verification_pairs_response.py @@ -25,3 +25,5 @@ class Data(BaseModel): class AccuracyCreateClusterVerificationPairsResponse(BaseModel): data: List[Data] + + cluster_reasoning: Optional[str] = FieldInfo(alias="clusterReasoning", default=None) diff --git a/src/profound/types/reports/accuracy_create_inaccurate_clusters_response.py b/src/profound/types/reports/accuracy_create_inaccurate_clusters_response.py index e0519a3d..68eaac34 100644 --- a/src/profound/types/reports/accuracy_create_inaccurate_clusters_response.py +++ b/src/profound/types/reports/accuracy_create_inaccurate_clusters_response.py @@ -18,8 +18,6 @@ class Data(BaseModel): cluster_id: str = FieldInfo(alias="clusterId") - description: str - kb_path: str = FieldInfo(alias="kbPath") kb_snippet: str = FieldInfo(alias="kbSnippet") @@ -32,6 +30,8 @@ class Data(BaseModel): total_response_count: int = FieldInfo(alias="totalResponseCount") + description: Optional[str] = None + response_share_delta: Optional[float] = FieldInfo(alias="responseShareDelta", default=None) diff --git a/src/profound/types/reports/accuracy_create_inaccurate_themes_response.py b/src/profound/types/reports/accuracy_create_inaccurate_themes_response.py index 8b80b206..67ed51c4 100644 --- a/src/profound/types/reports/accuracy_create_inaccurate_themes_response.py +++ b/src/profound/types/reports/accuracy_create_inaccurate_themes_response.py @@ -10,8 +10,6 @@ class Data(BaseModel): - description: str - inaccurate_claim_count: int = FieldInfo(alias="inaccurateClaimCount") inaccurate_cluster_count: int = FieldInfo(alias="inaccurateClusterCount") @@ -30,6 +28,8 @@ class Data(BaseModel): total_response_count: int = FieldInfo(alias="totalResponseCount") + description: Optional[str] = None + response_share_delta: Optional[float] = FieldInfo(alias="responseShareDelta", default=None) diff --git a/tests/api_resources/test_reports.py b/tests/api_resources/test_reports.py index 54e7aa35..2f0f249f 100644 --- a/tests/api_resources/test_reports.py +++ b/tests/api_resources/test_reports.py @@ -456,8 +456,9 @@ def test_method_query_sentiment_v2(self, client: Profound) -> None: report = client.reports.query_sentiment_v2( asset_name="asset_name", category_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - end_date="end_date", - start_date="start_date", + end_date=parse_datetime("2019-12-27T18:11:19.117Z"), + metrics=["sentiment"], + start_date=parse_datetime("2019-12-27T18:11:19.117Z"), ) assert_matches_type(ReportQuerySentimentV2Response, report, path=["response"]) @@ -467,35 +468,25 @@ def test_method_query_sentiment_v2_with_all_params(self, client: Profound) -> No report = client.reports.query_sentiment_v2( asset_name="asset_name", category_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - end_date="end_date", - start_date="start_date", - claim_filters={ - "claim": "claim", - "claim_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - "sentiment": "positive", - "theme_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - }, - comparison_end_date="comparison_end_date", - comparison_start_date="comparison_start_date", - date_bucket="daily", - exclude_topic_ids=True, - group_by=["topic"], - include_no_persona=True, - include_no_tag=True, - limit=1, + end_date=parse_datetime("2019-12-27T18:11:19.117Z"), metrics=["sentiment"], - offset=0, - owned_asset_names_to_exclude=["string"], - persona_ids=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], - platform_ids=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], - prompt_ids=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], - region_ids=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], - run_ids=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], - sort_by="occurrence", - sort_direction="asc", - tag_filter_type="all", - tag_ids=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], - topic_ids=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], + start_date=parse_datetime("2019-12-27T18:11:19.117Z"), + comparison_end_date=parse_datetime("2019-12-27T18:11:19.117Z"), + comparison_start_date=parse_datetime("2019-12-27T18:11:19.117Z"), + date_interval="hour", + dimensions=["date"], + filters=[ + { + "field": "model_id", + "operator": "is", + "value": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + } + ], + order_by={"occurrence": "desc"}, + pagination={ + "limit": 1, + "offset": 0, + }, ) assert_matches_type(ReportQuerySentimentV2Response, report, path=["response"]) @@ -505,8 +496,9 @@ def test_raw_response_query_sentiment_v2(self, client: Profound) -> None: response = client.reports.with_raw_response.query_sentiment_v2( asset_name="asset_name", category_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - end_date="end_date", - start_date="start_date", + end_date=parse_datetime("2019-12-27T18:11:19.117Z"), + metrics=["sentiment"], + start_date=parse_datetime("2019-12-27T18:11:19.117Z"), ) assert response.is_closed is True @@ -520,8 +512,9 @@ def test_streaming_response_query_sentiment_v2(self, client: Profound) -> None: with client.reports.with_streaming_response.query_sentiment_v2( asset_name="asset_name", category_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - end_date="end_date", - start_date="start_date", + end_date=parse_datetime("2019-12-27T18:11:19.117Z"), + metrics=["sentiment"], + start_date=parse_datetime("2019-12-27T18:11:19.117Z"), ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -1308,8 +1301,9 @@ async def test_method_query_sentiment_v2(self, async_client: AsyncProfound) -> N report = await async_client.reports.query_sentiment_v2( asset_name="asset_name", category_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - end_date="end_date", - start_date="start_date", + end_date=parse_datetime("2019-12-27T18:11:19.117Z"), + metrics=["sentiment"], + start_date=parse_datetime("2019-12-27T18:11:19.117Z"), ) assert_matches_type(ReportQuerySentimentV2Response, report, path=["response"]) @@ -1319,35 +1313,25 @@ async def test_method_query_sentiment_v2_with_all_params(self, async_client: Asy report = await async_client.reports.query_sentiment_v2( asset_name="asset_name", category_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - end_date="end_date", - start_date="start_date", - claim_filters={ - "claim": "claim", - "claim_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - "sentiment": "positive", - "theme_id": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - }, - comparison_end_date="comparison_end_date", - comparison_start_date="comparison_start_date", - date_bucket="daily", - exclude_topic_ids=True, - group_by=["topic"], - include_no_persona=True, - include_no_tag=True, - limit=1, + end_date=parse_datetime("2019-12-27T18:11:19.117Z"), metrics=["sentiment"], - offset=0, - owned_asset_names_to_exclude=["string"], - persona_ids=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], - platform_ids=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], - prompt_ids=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], - region_ids=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], - run_ids=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], - sort_by="occurrence", - sort_direction="asc", - tag_filter_type="all", - tag_ids=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], - topic_ids=["182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e"], + start_date=parse_datetime("2019-12-27T18:11:19.117Z"), + comparison_end_date=parse_datetime("2019-12-27T18:11:19.117Z"), + comparison_start_date=parse_datetime("2019-12-27T18:11:19.117Z"), + date_interval="hour", + dimensions=["date"], + filters=[ + { + "field": "model_id", + "operator": "is", + "value": "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", + } + ], + order_by={"occurrence": "desc"}, + pagination={ + "limit": 1, + "offset": 0, + }, ) assert_matches_type(ReportQuerySentimentV2Response, report, path=["response"]) @@ -1357,8 +1341,9 @@ async def test_raw_response_query_sentiment_v2(self, async_client: AsyncProfound response = await async_client.reports.with_raw_response.query_sentiment_v2( asset_name="asset_name", category_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - end_date="end_date", - start_date="start_date", + end_date=parse_datetime("2019-12-27T18:11:19.117Z"), + metrics=["sentiment"], + start_date=parse_datetime("2019-12-27T18:11:19.117Z"), ) assert response.is_closed is True @@ -1372,8 +1357,9 @@ async def test_streaming_response_query_sentiment_v2(self, async_client: AsyncPr async with async_client.reports.with_streaming_response.query_sentiment_v2( asset_name="asset_name", category_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e", - end_date="end_date", - start_date="start_date", + end_date=parse_datetime("2019-12-27T18:11:19.117Z"), + metrics=["sentiment"], + start_date=parse_datetime("2019-12-27T18:11:19.117Z"), ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python"