Skip to content

Commit c88982f

Browse files
feat(api): update from perform -> create
1 parent 6de8ec2 commit c88982f

File tree

13 files changed

+88
-88
lines changed

13 files changed

+88
-88
lines changed

.github/workflows/publish-pypi.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This workflow is triggered when a GitHub release is created.
22
# It can also be run manually to re-publish to PyPI in case it failed for some reason.
3-
# You can run this workflow by navigating to https://www.github.com/ppl-ai/testing-stainless/actions/workflows/publish-pypi.yml
3+
# You can run this workflow by navigating to https://www.github.com/ppl-ai/perplexity-py/actions/workflows/publish-pypi.yml
44
name: Publish PyPI
55
on:
66
workflow_dispatch:

.github/workflows/release-doctor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
release_doctor:
1010
name: release doctor
1111
runs-on: ubuntu-latest
12-
if: github.repository == 'ppl-ai/testing-stainless' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || startsWith(github.head_ref, 'release-please') || github.head_ref == 'next')
12+
if: github.repository == 'ppl-ai/perplexity-py' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || startsWith(github.head_ref, 'release-please') || github.head_ref == 'next')
1313

1414
steps:
1515
- uses: actions/checkout@v4

.stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 1
22
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/perplexity-ai%2Fperplexity-0215ad03799c0d48a897533cf7797fc279ca4ddd6ff3ef89194e8637c83d16f0.yml
33
openapi_spec_hash: 185af16df97b1856cddb649ceb87fb0d
4-
config_hash: 1e977530930da048f3a2860a609a6f72
4+
config_hash: 0949c9a4b53524761966b36d96211b28

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ If you’d like to use the repository from source, you can either install from g
6262
To install via git:
6363

6464
```sh
65-
$ pip install git+ssh://[email protected]/ppl-ai/testing-stainless.git
65+
$ pip install git+ssh://[email protected]/ppl-ai/perplexity-py.git
6666
```
6767

6868
Alternatively, you can build from source and install the wheel file:
@@ -120,7 +120,7 @@ the changes aren't made through the automated pipeline, you may want to make rel
120120

121121
### Publish with a GitHub workflow
122122

123-
You can release to package managers by using [the `Publish PyPI` GitHub action](https://www.github.com/ppl-ai/testing-stainless/actions/workflows/publish-pypi.yml). This requires a setup organization or repository secret to be set up.
123+
You can release to package managers by using [the `Publish PyPI` GitHub action](https://www.github.com/ppl-ai/perplexity-py/actions/workflows/publish-pypi.yml). This requires a setup organization or repository secret to be set up.
124124

125125
### Publish manually
126126

README.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ client = Perplexity(
3232
bearer_token=os.environ.get("PERPLEXITY_API_KEY"), # This is the default and can be omitted
3333
)
3434

35-
response = client.search.perform(
35+
search = client.search.create(
3636
query="string",
3737
)
38-
print(response.id)
38+
print(search.id)
3939
```
4040

4141
While you can provide a `bearer_token` keyword argument,
@@ -58,10 +58,10 @@ client = AsyncPerplexity(
5858

5959

6060
async def main() -> None:
61-
response = await client.search.perform(
61+
search = await client.search.create(
6262
query="string",
6363
)
64-
print(response.id)
64+
print(search.id)
6565

6666

6767
asyncio.run(main())
@@ -93,10 +93,10 @@ async def main() -> None:
9393
bearer_token="My Bearer Token",
9494
http_client=DefaultAioHttpClient(),
9595
) as client:
96-
response = await client.search.perform(
96+
search = await client.search.create(
9797
query="string",
9898
)
99-
print(response.id)
99+
print(search.id)
100100

101101

102102
asyncio.run(main())
@@ -127,7 +127,7 @@ from perplexity import Perplexity
127127
client = Perplexity()
128128

129129
try:
130-
client.search.perform(
130+
client.search.create(
131131
query="string",
132132
)
133133
except perplexity.APIConnectionError as e:
@@ -172,7 +172,7 @@ client = Perplexity(
172172
)
173173

174174
# Or, configure per-request:
175-
client.with_options(max_retries=5).search.perform(
175+
client.with_options(max_retries=5).search.create(
176176
query="string",
177177
)
178178
```
@@ -197,7 +197,7 @@ client = Perplexity(
197197
)
198198

199199
# Override per-request:
200-
client.with_options(timeout=5.0).search.perform(
200+
client.with_options(timeout=5.0).search.create(
201201
query="string",
202202
)
203203
```
@@ -240,18 +240,18 @@ The "raw" Response object can be accessed by prefixing `.with_raw_response.` to
240240
from perplexity import Perplexity
241241

242242
client = Perplexity()
243-
response = client.search.with_raw_response.perform(
243+
response = client.search.with_raw_response.create(
244244
query="string",
245245
)
246246
print(response.headers.get('X-My-Header'))
247247

248-
search = response.parse() # get the object that `search.perform()` would have returned
248+
search = response.parse() # get the object that `search.create()` would have returned
249249
print(search.id)
250250
```
251251

252-
These methods return an [`APIResponse`](https://github.com/ppl-ai/testing-stainless/tree/main/src/perplexity/_response.py) object.
252+
These methods return an [`APIResponse`](https://github.com/ppl-ai/perplexity-py/tree/main/src/perplexity/_response.py) object.
253253

254-
The async client returns an [`AsyncAPIResponse`](https://github.com/ppl-ai/testing-stainless/tree/main/src/perplexity/_response.py) with the same structure, the only difference being `await`able methods for reading the response content.
254+
The async client returns an [`AsyncAPIResponse`](https://github.com/ppl-ai/perplexity-py/tree/main/src/perplexity/_response.py) with the same structure, the only difference being `await`able methods for reading the response content.
255255

256256
#### `.with_streaming_response`
257257

@@ -260,7 +260,7 @@ The above interface eagerly reads the full response body when you make the reque
260260
To stream the response body, use `.with_streaming_response` instead, which requires a context manager and only reads the response body once you call `.read()`, `.text()`, `.json()`, `.iter_bytes()`, `.iter_text()`, `.iter_lines()` or `.parse()`. In the async client, these are async methods.
261261

262262
```python
263-
with client.search.with_streaming_response.perform(
263+
with client.search.with_streaming_response.create(
264264
query="string",
265265
) as response:
266266
print(response.headers.get("X-My-Header"))
@@ -357,7 +357,7 @@ This package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) con
357357

358358
We take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.
359359

360-
We are keen for your feedback; please open an [issue](https://www.github.com/ppl-ai/testing-stainless/issues) with questions, bugs, or suggestions.
360+
We are keen for your feedback; please open an [issue](https://www.github.com/ppl-ai/perplexity-py/issues) with questions, bugs, or suggestions.
361361

362362
### Determining the installed version
363363

api.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
Types:
44

55
```python
6-
from perplexity.types import SearchPerformResponse
6+
from perplexity.types import SearchCreateResponse
77
```
88

99
Methods:
1010

11-
- <code title="post /search">client.search.<a href="./src/perplexity/resources/search.py">perform</a>(\*\*<a href="src/perplexity/types/search_perform_params.py">params</a>) -> <a href="./src/perplexity/types/search_perform_response.py">SearchPerformResponse</a></code>
11+
- <code title="post /search">client.search.<a href="./src/perplexity/resources/search.py">create</a>(\*\*<a href="src/perplexity/types/search_create_params.py">params</a>) -> <a href="./src/perplexity/types/search_create_response.py">SearchCreateResponse</a></code>

pyproject.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ classifiers = [
3535
]
3636

3737
[project.urls]
38-
Homepage = "https://github.com/ppl-ai/testing-stainless"
39-
Repository = "https://github.com/ppl-ai/testing-stainless"
38+
Homepage = "https://github.com/ppl-ai/perplexity-py"
39+
Repository = "https://github.com/ppl-ai/perplexity-py"
4040

4141
[project.optional-dependencies]
4242
aiohttp = ["aiohttp", "httpx_aiohttp>=0.1.8"]
@@ -124,7 +124,7 @@ path = "README.md"
124124
[[tool.hatch.metadata.hooks.fancy-pypi-readme.substitutions]]
125125
# replace relative links with absolute links
126126
pattern = '\[(.+?)\]\(((?!https?://)\S+?)\)'
127-
replacement = '[\1](https://github.com/ppl-ai/testing-stainless/tree/main/\g<2>)'
127+
replacement = '[\1](https://github.com/ppl-ai/perplexity-py/tree/main/\g<2>)'
128128

129129
[tool.pytest.ini_options]
130130
testpaths = ["tests"]

src/perplexity/resources/search.py

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
import httpx
99

10-
from ..types import search_perform_params
10+
from ..types import search_create_params
1111
from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven, SequenceNotStr
1212
from .._utils import maybe_transform, async_maybe_transform
1313
from .._compat import cached_property
@@ -19,7 +19,7 @@
1919
async_to_streamed_response_wrapper,
2020
)
2121
from .._base_client import make_request_options
22-
from ..types.search_perform_response import SearchPerformResponse
22+
from ..types.search_create_response import SearchCreateResponse
2323

2424
__all__ = ["SearchResource", "AsyncSearchResource"]
2525

@@ -31,7 +31,7 @@ def with_raw_response(self) -> SearchResourceWithRawResponse:
3131
This property can be used as a prefix for any HTTP method call to return
3232
the raw response object instead of the parsed content.
3333
34-
For more information, see https://www.github.com/ppl-ai/testing-stainless#accessing-raw-response-data-eg-headers
34+
For more information, see https://www.github.com/ppl-ai/perplexity-py#accessing-raw-response-data-eg-headers
3535
"""
3636
return SearchResourceWithRawResponse(self)
3737

@@ -40,11 +40,11 @@ def with_streaming_response(self) -> SearchResourceWithStreamingResponse:
4040
"""
4141
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
4242
43-
For more information, see https://www.github.com/ppl-ai/testing-stainless#with_streaming_response
43+
For more information, see https://www.github.com/ppl-ai/perplexity-py#with_streaming_response
4444
"""
4545
return SearchResourceWithStreamingResponse(self)
4646

47-
def perform(
47+
def create(
4848
self,
4949
*,
5050
query: Union[str, SequenceNotStr[str]],
@@ -65,7 +65,7 @@ def perform(
6565
extra_query: Query | None = None,
6666
extra_body: Body | None = None,
6767
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
68-
) -> SearchPerformResponse:
68+
) -> SearchCreateResponse:
6969
"""
7070
Search
7171
@@ -95,12 +95,12 @@ def perform(
9595
"search_mode": search_mode,
9696
"search_recency_filter": search_recency_filter,
9797
},
98-
search_perform_params.SearchPerformParams,
98+
search_create_params.SearchCreateParams,
9999
),
100100
options=make_request_options(
101101
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
102102
),
103-
cast_to=SearchPerformResponse,
103+
cast_to=SearchCreateResponse,
104104
)
105105

106106

@@ -111,7 +111,7 @@ def with_raw_response(self) -> AsyncSearchResourceWithRawResponse:
111111
This property can be used as a prefix for any HTTP method call to return
112112
the raw response object instead of the parsed content.
113113
114-
For more information, see https://www.github.com/ppl-ai/testing-stainless#accessing-raw-response-data-eg-headers
114+
For more information, see https://www.github.com/ppl-ai/perplexity-py#accessing-raw-response-data-eg-headers
115115
"""
116116
return AsyncSearchResourceWithRawResponse(self)
117117

@@ -120,11 +120,11 @@ def with_streaming_response(self) -> AsyncSearchResourceWithStreamingResponse:
120120
"""
121121
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
122122
123-
For more information, see https://www.github.com/ppl-ai/testing-stainless#with_streaming_response
123+
For more information, see https://www.github.com/ppl-ai/perplexity-py#with_streaming_response
124124
"""
125125
return AsyncSearchResourceWithStreamingResponse(self)
126126

127-
async def perform(
127+
async def create(
128128
self,
129129
*,
130130
query: Union[str, SequenceNotStr[str]],
@@ -145,7 +145,7 @@ async def perform(
145145
extra_query: Query | None = None,
146146
extra_body: Body | None = None,
147147
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
148-
) -> SearchPerformResponse:
148+
) -> SearchCreateResponse:
149149
"""
150150
Search
151151
@@ -175,46 +175,46 @@ async def perform(
175175
"search_mode": search_mode,
176176
"search_recency_filter": search_recency_filter,
177177
},
178-
search_perform_params.SearchPerformParams,
178+
search_create_params.SearchCreateParams,
179179
),
180180
options=make_request_options(
181181
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
182182
),
183-
cast_to=SearchPerformResponse,
183+
cast_to=SearchCreateResponse,
184184
)
185185

186186

187187
class SearchResourceWithRawResponse:
188188
def __init__(self, search: SearchResource) -> None:
189189
self._search = search
190190

191-
self.perform = to_raw_response_wrapper(
192-
search.perform,
191+
self.create = to_raw_response_wrapper(
192+
search.create,
193193
)
194194

195195

196196
class AsyncSearchResourceWithRawResponse:
197197
def __init__(self, search: AsyncSearchResource) -> None:
198198
self._search = search
199199

200-
self.perform = async_to_raw_response_wrapper(
201-
search.perform,
200+
self.create = async_to_raw_response_wrapper(
201+
search.create,
202202
)
203203

204204

205205
class SearchResourceWithStreamingResponse:
206206
def __init__(self, search: SearchResource) -> None:
207207
self._search = search
208208

209-
self.perform = to_streamed_response_wrapper(
210-
search.perform,
209+
self.create = to_streamed_response_wrapper(
210+
search.create,
211211
)
212212

213213

214214
class AsyncSearchResourceWithStreamingResponse:
215215
def __init__(self, search: AsyncSearchResource) -> None:
216216
self._search = search
217217

218-
self.perform = async_to_streamed_response_wrapper(
219-
search.perform,
218+
self.create = async_to_streamed_response_wrapper(
219+
search.create,
220220
)

src/perplexity/types/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22

33
from __future__ import annotations
44

5-
from .search_perform_params import SearchPerformParams as SearchPerformParams
6-
from .search_perform_response import SearchPerformResponse as SearchPerformResponse
5+
from .search_create_params import SearchCreateParams as SearchCreateParams
6+
from .search_create_response import SearchCreateResponse as SearchCreateResponse

src/perplexity/types/search_perform_params.py renamed to src/perplexity/types/search_create_params.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77

88
from .._types import SequenceNotStr
99

10-
__all__ = ["SearchPerformParams"]
10+
__all__ = ["SearchCreateParams"]
1111

1212

13-
class SearchPerformParams(TypedDict, total=False):
13+
class SearchCreateParams(TypedDict, total=False):
1414
query: Required[Union[str, SequenceNotStr[str]]]
1515

1616
country: Optional[str]

0 commit comments

Comments
 (0)