Skip to content

Commit 90c550f

Browse files
feat(api): manual updates
1 parent 03a16d2 commit 90c550f

7 files changed

Lines changed: 331 additions & 2 deletions

File tree

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
configured_endpoints: 5
1+
configured_endpoints: 6
22
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/brand-dev%2Fbrand.dev-d5cf52f21333b8216b73e9659b4a1e8e0675404f0ae3d15bdd7ef368ccfa94cf.yml
33
openapi_spec_hash: c70cbc2e38e7aeaf2173574a13e9ca55
4-
config_hash: d46b53bb2641150aed659de7eeec3a68
4+
config_hash: 372b187172495fc2f76f05ba016b4a45

api.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Types:
55
```python
66
from brand.dev.types import (
77
BrandRetrieveResponse,
8+
BrandAIQueryResponse,
89
BrandIdentifyFromTransactionResponse,
910
BrandRetrieveByTickerResponse,
1011
BrandRetrieveNaicsResponse,
@@ -15,6 +16,7 @@ from brand.dev.types import (
1516
Methods:
1617

1718
- <code title="get /brand/retrieve">client.brand.<a href="./src/brand/dev/resources/brand.py">retrieve</a>(\*\*<a href="src/brand/dev/types/brand_retrieve_params.py">params</a>) -> <a href="./src/brand/dev/types/brand_retrieve_response.py">BrandRetrieveResponse</a></code>
19+
- <code title="post /brand/ai/query">client.brand.<a href="./src/brand/dev/resources/brand.py">ai_query</a>(\*\*<a href="src/brand/dev/types/brand_ai_query_params.py">params</a>) -> <a href="./src/brand/dev/types/brand_ai_query_response.py">BrandAIQueryResponse</a></code>
1820
- <code title="get /brand/transaction_identifier">client.brand.<a href="./src/brand/dev/resources/brand.py">identify_from_transaction</a>(\*\*<a href="src/brand/dev/types/brand_identify_from_transaction_params.py">params</a>) -> <a href="./src/brand/dev/types/brand_identify_from_transaction_response.py">BrandIdentifyFromTransactionResponse</a></code>
1921
- <code title="get /brand/retrieve-by-ticker">client.brand.<a href="./src/brand/dev/resources/brand.py">retrieve_by_ticker</a>(\*\*<a href="src/brand/dev/types/brand_retrieve_by_ticker_params.py">params</a>) -> <a href="./src/brand/dev/types/brand_retrieve_by_ticker_response.py">BrandRetrieveByTickerResponse</a></code>
2022
- <code title="get /brand/naics">client.brand.<a href="./src/brand/dev/resources/brand.py">retrieve_naics</a>(\*\*<a href="src/brand/dev/types/brand_retrieve_naics_params.py">params</a>) -> <a href="./src/brand/dev/types/brand_retrieve_naics_response.py">BrandRetrieveNaicsResponse</a></code>

src/brand/dev/resources/brand.py

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@
22

33
from __future__ import annotations
44

5+
from typing import List, Iterable
56
from typing_extensions import Literal
67

78
import httpx
89

910
from ..types import (
1011
brand_search_params,
12+
brand_ai_query_params,
1113
brand_retrieve_params,
1214
brand_retrieve_naics_params,
1315
brand_retrieve_by_ticker_params,
@@ -25,6 +27,7 @@
2527
)
2628
from .._base_client import make_request_options
2729
from ..types.brand_search_response import BrandSearchResponse
30+
from ..types.brand_ai_query_response import BrandAIQueryResponse
2831
from ..types.brand_retrieve_response import BrandRetrieveResponse
2932
from ..types.brand_retrieve_naics_response import BrandRetrieveNaicsResponse
3033
from ..types.brand_retrieve_by_ticker_response import BrandRetrieveByTickerResponse
@@ -153,6 +156,56 @@ def retrieve(
153156
cast_to=BrandRetrieveResponse,
154157
)
155158

159+
def ai_query(
160+
self,
161+
*,
162+
data_to_extract: Iterable[brand_ai_query_params.DataToExtract],
163+
domain: str,
164+
specific_pages: List[str] | NotGiven = NOT_GIVEN,
165+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
166+
# The extra values given here take precedence over values defined on the client or passed to this method.
167+
extra_headers: Headers | None = None,
168+
extra_query: Query | None = None,
169+
extra_body: Body | None = None,
170+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
171+
) -> BrandAIQueryResponse:
172+
"""Beta feature: Use AI to extract specific data points from a brand's website.
173+
174+
The
175+
AI will crawl the website and extract the requested information based on the
176+
provided data points.
177+
178+
Args:
179+
data_to_extract: Array of data points to extract from the website
180+
181+
domain: The domain name to analyze
182+
183+
specific_pages: Optional array of specific pages to analyze
184+
185+
extra_headers: Send extra headers
186+
187+
extra_query: Add additional query parameters to the request
188+
189+
extra_body: Add additional JSON properties to the request
190+
191+
timeout: Override the client-level default timeout for this request, in seconds
192+
"""
193+
return self._post(
194+
"/brand/ai/query",
195+
body=maybe_transform(
196+
{
197+
"data_to_extract": data_to_extract,
198+
"domain": domain,
199+
"specific_pages": specific_pages,
200+
},
201+
brand_ai_query_params.BrandAIQueryParams,
202+
),
203+
options=make_request_options(
204+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
205+
),
206+
cast_to=BrandAIQueryResponse,
207+
)
208+
156209
def identify_from_transaction(
157210
self,
158211
*,
@@ -429,6 +482,56 @@ async def retrieve(
429482
cast_to=BrandRetrieveResponse,
430483
)
431484

485+
async def ai_query(
486+
self,
487+
*,
488+
data_to_extract: Iterable[brand_ai_query_params.DataToExtract],
489+
domain: str,
490+
specific_pages: List[str] | NotGiven = NOT_GIVEN,
491+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
492+
# The extra values given here take precedence over values defined on the client or passed to this method.
493+
extra_headers: Headers | None = None,
494+
extra_query: Query | None = None,
495+
extra_body: Body | None = None,
496+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
497+
) -> BrandAIQueryResponse:
498+
"""Beta feature: Use AI to extract specific data points from a brand's website.
499+
500+
The
501+
AI will crawl the website and extract the requested information based on the
502+
provided data points.
503+
504+
Args:
505+
data_to_extract: Array of data points to extract from the website
506+
507+
domain: The domain name to analyze
508+
509+
specific_pages: Optional array of specific pages to analyze
510+
511+
extra_headers: Send extra headers
512+
513+
extra_query: Add additional query parameters to the request
514+
515+
extra_body: Add additional JSON properties to the request
516+
517+
timeout: Override the client-level default timeout for this request, in seconds
518+
"""
519+
return await self._post(
520+
"/brand/ai/query",
521+
body=await async_maybe_transform(
522+
{
523+
"data_to_extract": data_to_extract,
524+
"domain": domain,
525+
"specific_pages": specific_pages,
526+
},
527+
brand_ai_query_params.BrandAIQueryParams,
528+
),
529+
options=make_request_options(
530+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
531+
),
532+
cast_to=BrandAIQueryResponse,
533+
)
534+
432535
async def identify_from_transaction(
433536
self,
434537
*,
@@ -596,6 +699,9 @@ def __init__(self, brand: BrandResource) -> None:
596699
self.retrieve = to_raw_response_wrapper(
597700
brand.retrieve,
598701
)
702+
self.ai_query = to_raw_response_wrapper(
703+
brand.ai_query,
704+
)
599705
self.identify_from_transaction = to_raw_response_wrapper(
600706
brand.identify_from_transaction,
601707
)
@@ -617,6 +723,9 @@ def __init__(self, brand: AsyncBrandResource) -> None:
617723
self.retrieve = async_to_raw_response_wrapper(
618724
brand.retrieve,
619725
)
726+
self.ai_query = async_to_raw_response_wrapper(
727+
brand.ai_query,
728+
)
620729
self.identify_from_transaction = async_to_raw_response_wrapper(
621730
brand.identify_from_transaction,
622731
)
@@ -638,6 +747,9 @@ def __init__(self, brand: BrandResource) -> None:
638747
self.retrieve = to_streamed_response_wrapper(
639748
brand.retrieve,
640749
)
750+
self.ai_query = to_streamed_response_wrapper(
751+
brand.ai_query,
752+
)
641753
self.identify_from_transaction = to_streamed_response_wrapper(
642754
brand.identify_from_transaction,
643755
)
@@ -659,6 +771,9 @@ def __init__(self, brand: AsyncBrandResource) -> None:
659771
self.retrieve = async_to_streamed_response_wrapper(
660772
brand.retrieve,
661773
)
774+
self.ai_query = async_to_streamed_response_wrapper(
775+
brand.ai_query,
776+
)
662777
self.identify_from_transaction = async_to_streamed_response_wrapper(
663778
brand.identify_from_transaction,
664779
)

src/brand/dev/types/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@
33
from __future__ import annotations
44

55
from .brand_search_params import BrandSearchParams as BrandSearchParams
6+
from .brand_ai_query_params import BrandAIQueryParams as BrandAIQueryParams
67
from .brand_retrieve_params import BrandRetrieveParams as BrandRetrieveParams
78
from .brand_search_response import BrandSearchResponse as BrandSearchResponse
9+
from .brand_ai_query_response import BrandAIQueryResponse as BrandAIQueryResponse
810
from .brand_retrieve_response import BrandRetrieveResponse as BrandRetrieveResponse
911
from .brand_retrieve_naics_params import BrandRetrieveNaicsParams as BrandRetrieveNaicsParams
1012
from .brand_retrieve_naics_response import BrandRetrieveNaicsResponse as BrandRetrieveNaicsResponse
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
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 List, Iterable
6+
from typing_extensions import Literal, Required, TypedDict
7+
8+
__all__ = ["BrandAIQueryParams", "DataToExtract"]
9+
10+
11+
class BrandAIQueryParams(TypedDict, total=False):
12+
data_to_extract: Required[Iterable[DataToExtract]]
13+
"""Array of data points to extract from the website"""
14+
15+
domain: Required[str]
16+
"""The domain name to analyze"""
17+
18+
specific_pages: List[str]
19+
"""Optional array of specific pages to analyze"""
20+
21+
22+
class DataToExtract(TypedDict, total=False):
23+
datapoint_description: Required[str]
24+
"""Description of what to extract"""
25+
26+
datapoint_example: Required[str]
27+
"""Example of the expected value"""
28+
29+
datapoint_name: Required[str]
30+
"""Name of the data point to extract"""
31+
32+
datapoint_type: Required[Literal["text", "number", "date", "boolean", "list", "url"]]
33+
"""Type of the data point"""
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from typing import List, Union, Optional
4+
5+
from .._models import BaseModel
6+
7+
__all__ = ["BrandAIQueryResponse", "DataExtracted"]
8+
9+
10+
class DataExtracted(BaseModel):
11+
datapoint_name: Optional[str] = None
12+
"""Name of the extracted data point"""
13+
14+
datapoint_value: Union[str, float, bool, List[str], List[float], None] = None
15+
"""Value of the extracted data point"""
16+
17+
18+
class BrandAIQueryResponse(BaseModel):
19+
data_extracted: Optional[List[DataExtracted]] = None
20+
"""Array of extracted data points"""
21+
22+
domain: Optional[str] = None
23+
"""The domain that was analyzed"""
24+
25+
urls_analyzed: Optional[List[str]] = None
26+
"""List of URLs that were analyzed"""

0 commit comments

Comments
 (0)