Skip to content

Commit 29ff10c

Browse files
feat(api): api update
1 parent a271224 commit 29ff10c

File tree

8 files changed

+60
-164
lines changed

8 files changed

+60
-164
lines changed

.stats.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
configured_endpoints: 18
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lemma%2Flemma-34406ba4cbe013a332aa89d2e6de85dd0f10426405476c8f37da3c3a4b57e0ce.yml
3-
openapi_spec_hash: 509d1233071637148a2b3298d7fc3de2
1+
configured_endpoints: 17
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lemma%2Flemma-7d37defa0f907862d7d3c807dd33259df967ddaa70601f91d4d771c9c02e4dec.yml
3+
openapi_spec_hash: 357f9bb257a1f73b57bd4bd5f3018000
44
config_hash: 3911423d0a218a9e0813f5fe6370ae95

README.md

Lines changed: 29 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,10 @@ from lemma import Lemma
3232

3333
client = Lemma()
3434

35-
datasets = client.datasets.list()
35+
dataset = client.datasets.create(
36+
name="name",
37+
)
38+
print(dataset.id)
3639
```
3740

3841
While you can provide an `api_key` keyword argument,
@@ -52,7 +55,10 @@ client = AsyncLemma()
5255

5356

5457
async def main() -> None:
55-
datasets = await client.datasets.list()
58+
dataset = await client.datasets.create(
59+
name="name",
60+
)
61+
print(dataset.id)
5662

5763

5864
asyncio.run(main())
@@ -83,7 +89,10 @@ async def main() -> None:
8389
async with AsyncLemma(
8490
http_client=DefaultAioHttpClient(),
8591
) as client:
86-
datasets = await client.datasets.list()
92+
dataset = await client.datasets.create(
93+
name="name",
94+
)
95+
print(dataset.id)
8796

8897

8998
asyncio.run(main())
@@ -131,7 +140,9 @@ from lemma import Lemma
131140
client = Lemma()
132141

133142
try:
134-
client.datasets.list()
143+
client.datasets.create(
144+
name="name",
145+
)
135146
except lemma.APIConnectionError as e:
136147
print("The server could not be reached")
137148
print(e.__cause__) # an underlying Exception, likely raised within httpx.
@@ -174,7 +185,9 @@ client = Lemma(
174185
)
175186

176187
# Or, configure per-request:
177-
client.with_options(max_retries=5).datasets.list()
188+
client.with_options(max_retries=5).datasets.create(
189+
name="name",
190+
)
178191
```
179192

180193
### Timeouts
@@ -197,7 +210,9 @@ client = Lemma(
197210
)
198211

199212
# Override per-request:
200-
client.with_options(timeout=5.0).datasets.list()
213+
client.with_options(timeout=5.0).datasets.create(
214+
name="name",
215+
)
201216
```
202217

203218
On timeout, an `APITimeoutError` is thrown.
@@ -238,11 +253,13 @@ The "raw" Response object can be accessed by prefixing `.with_raw_response.` to
238253
from lemma import Lemma
239254

240255
client = Lemma()
241-
response = client.datasets.with_raw_response.list()
256+
response = client.datasets.with_raw_response.create(
257+
name="name",
258+
)
242259
print(response.headers.get('X-My-Header'))
243260

244-
dataset = response.parse() # get the object that `datasets.list()` would have returned
245-
print(dataset)
261+
dataset = response.parse() # get the object that `datasets.create()` would have returned
262+
print(dataset.id)
246263
```
247264

248265
These methods return an [`APIResponse`](https://github.com/uselemma/sdk-python/tree/main/src/lemma/_response.py) object.
@@ -256,7 +273,9 @@ The above interface eagerly reads the full response body when you make the reque
256273
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.
257274

258275
```python
259-
with client.datasets.with_streaming_response.list() as response:
276+
with client.datasets.with_streaming_response.create(
277+
name="name",
278+
) as response:
260279
print(response.headers.get("X-My-Header"))
261280

262281
for line in response.iter_lines():

api.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ Types:
55
```python
66
from lemma.types import (
77
Dataset,
8-
DatasetListResponse,
98
DatasetDeleteResponse,
109
DatasetCreateDownloadURLResponse,
1110
DatasetGenerateDatasetResponse,
@@ -18,7 +17,6 @@ Methods:
1817

1918
- <code title="post /datasets">client.datasets.<a href="./src/lemma/resources/datasets.py">create</a>(\*\*<a href="src/lemma/types/dataset_create_params.py">params</a>) -> <a href="./src/lemma/types/dataset.py">Dataset</a></code>
2019
- <code title="get /datasets/{dataset_id}">client.datasets.<a href="./src/lemma/resources/datasets.py">retrieve</a>(dataset_id) -> <a href="./src/lemma/types/dataset.py">Dataset</a></code>
21-
- <code title="get /datasets">client.datasets.<a href="./src/lemma/resources/datasets.py">list</a>() -> <a href="./src/lemma/types/dataset_list_response.py">DatasetListResponse</a></code>
2220
- <code title="delete /datasets/{dataset_id}">client.datasets.<a href="./src/lemma/resources/datasets.py">delete</a>(dataset_id) -> <a href="./src/lemma/types/dataset_delete_response.py">DatasetDeleteResponse</a></code>
2321
- <code title="get /datasets/{dataset_id}/create-download-url">client.datasets.<a href="./src/lemma/resources/datasets.py">create_download_url</a>(dataset_id) -> str</code>
2422
- <code title="post /datasets/generate-dataset">client.datasets.<a href="./src/lemma/resources/datasets.py">generate_dataset</a>(\*\*<a href="src/lemma/types/dataset_generate_dataset_params.py">params</a>) -> <a href="./src/lemma/types/dataset_generate_dataset_response.py">DatasetGenerateDatasetResponse</a></code>

src/lemma/resources/datasets.py

Lines changed: 0 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
)
2525
from .._base_client import make_request_options
2626
from ..types.dataset import Dataset
27-
from ..types.dataset_list_response import DatasetListResponse
2827
from ..types.dataset_delete_response import DatasetDeleteResponse
2928
from ..types.dataset_generate_schema_response import DatasetGenerateSchemaResponse
3029
from ..types.dataset_generate_dataset_response import DatasetGenerateDatasetResponse
@@ -136,30 +135,6 @@ def retrieve(
136135
cast_to=Dataset,
137136
)
138137

139-
def list(
140-
self,
141-
*,
142-
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
143-
# The extra values given here take precedence over values defined on the client or passed to this method.
144-
extra_headers: Headers | None = None,
145-
extra_query: Query | None = None,
146-
extra_body: Body | None = None,
147-
timeout: float | httpx.Timeout | None | NotGiven = not_given,
148-
) -> DatasetListResponse:
149-
"""
150-
List all datasets for the current tenant.
151-
152-
Retrieves all datasets that belong to the current user's tenant. This includes
153-
datasets created by any user within the same tenant.
154-
"""
155-
return self._get(
156-
"/datasets",
157-
options=make_request_options(
158-
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
159-
),
160-
cast_to=DatasetListResponse,
161-
)
162-
163138
def delete(
164139
self,
165140
dataset_id: str,
@@ -491,30 +466,6 @@ async def retrieve(
491466
cast_to=Dataset,
492467
)
493468

494-
async def list(
495-
self,
496-
*,
497-
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
498-
# The extra values given here take precedence over values defined on the client or passed to this method.
499-
extra_headers: Headers | None = None,
500-
extra_query: Query | None = None,
501-
extra_body: Body | None = None,
502-
timeout: float | httpx.Timeout | None | NotGiven = not_given,
503-
) -> DatasetListResponse:
504-
"""
505-
List all datasets for the current tenant.
506-
507-
Retrieves all datasets that belong to the current user's tenant. This includes
508-
datasets created by any user within the same tenant.
509-
"""
510-
return await self._get(
511-
"/datasets",
512-
options=make_request_options(
513-
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
514-
),
515-
cast_to=DatasetListResponse,
516-
)
517-
518469
async def delete(
519470
self,
520471
dataset_id: str,
@@ -753,9 +704,6 @@ def __init__(self, datasets: DatasetsResource) -> None:
753704
self.retrieve = to_raw_response_wrapper(
754705
datasets.retrieve,
755706
)
756-
self.list = to_raw_response_wrapper(
757-
datasets.list,
758-
)
759707
self.delete = to_raw_response_wrapper(
760708
datasets.delete,
761709
)
@@ -783,9 +731,6 @@ def __init__(self, datasets: AsyncDatasetsResource) -> None:
783731
self.retrieve = async_to_raw_response_wrapper(
784732
datasets.retrieve,
785733
)
786-
self.list = async_to_raw_response_wrapper(
787-
datasets.list,
788-
)
789734
self.delete = async_to_raw_response_wrapper(
790735
datasets.delete,
791736
)
@@ -813,9 +758,6 @@ def __init__(self, datasets: DatasetsResource) -> None:
813758
self.retrieve = to_streamed_response_wrapper(
814759
datasets.retrieve,
815760
)
816-
self.list = to_streamed_response_wrapper(
817-
datasets.list,
818-
)
819761
self.delete = to_streamed_response_wrapper(
820762
datasets.delete,
821763
)
@@ -843,9 +785,6 @@ def __init__(self, datasets: AsyncDatasetsResource) -> None:
843785
self.retrieve = async_to_streamed_response_wrapper(
844786
datasets.retrieve,
845787
)
846-
self.list = async_to_streamed_response_wrapper(
847-
datasets.list,
848-
)
849788
self.delete = async_to_streamed_response_wrapper(
850789
datasets.delete,
851790
)

src/lemma/types/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
from .log_list_response import LogListResponse as LogListResponse
1111
from .prompt_create_params import PromptCreateParams as PromptCreateParams
1212
from .dataset_create_params import DatasetCreateParams as DatasetCreateParams
13-
from .dataset_list_response import DatasetListResponse as DatasetListResponse
1413
from .playground_run_params import PlaygroundRunParams as PlaygroundRunParams
1514
from .prompt_create_response import PromptCreateResponse as PromptCreateResponse
1615
from .prompt_delete_response import PromptDeleteResponse as PromptDeleteResponse

src/lemma/types/dataset_list_response.py

Lines changed: 0 additions & 10 deletions
This file was deleted.

tests/api_resources/test_datasets.py

Lines changed: 0 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
from lemma import Lemma, AsyncLemma
1111
from lemma.types import (
1212
Dataset,
13-
DatasetListResponse,
1413
DatasetDeleteResponse,
1514
DatasetGenerateSchemaResponse,
1615
DatasetGenerateDatasetResponse,
@@ -109,34 +108,6 @@ def test_path_params_retrieve(self, client: Lemma) -> None:
109108
"",
110109
)
111110

112-
@pytest.mark.skip(reason="Prism tests are disabled")
113-
@parametrize
114-
def test_method_list(self, client: Lemma) -> None:
115-
dataset = client.datasets.list()
116-
assert_matches_type(DatasetListResponse, dataset, path=["response"])
117-
118-
@pytest.mark.skip(reason="Prism tests are disabled")
119-
@parametrize
120-
def test_raw_response_list(self, client: Lemma) -> None:
121-
response = client.datasets.with_raw_response.list()
122-
123-
assert response.is_closed is True
124-
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
125-
dataset = response.parse()
126-
assert_matches_type(DatasetListResponse, dataset, path=["response"])
127-
128-
@pytest.mark.skip(reason="Prism tests are disabled")
129-
@parametrize
130-
def test_streaming_response_list(self, client: Lemma) -> None:
131-
with client.datasets.with_streaming_response.list() as response:
132-
assert not response.is_closed
133-
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
134-
135-
dataset = response.parse()
136-
assert_matches_type(DatasetListResponse, dataset, path=["response"])
137-
138-
assert cast(Any, response.is_closed) is True
139-
140111
@pytest.mark.skip(reason="Prism tests are disabled")
141112
@parametrize
142113
def test_method_delete(self, client: Lemma) -> None:
@@ -444,34 +415,6 @@ async def test_path_params_retrieve(self, async_client: AsyncLemma) -> None:
444415
"",
445416
)
446417

447-
@pytest.mark.skip(reason="Prism tests are disabled")
448-
@parametrize
449-
async def test_method_list(self, async_client: AsyncLemma) -> None:
450-
dataset = await async_client.datasets.list()
451-
assert_matches_type(DatasetListResponse, dataset, path=["response"])
452-
453-
@pytest.mark.skip(reason="Prism tests are disabled")
454-
@parametrize
455-
async def test_raw_response_list(self, async_client: AsyncLemma) -> None:
456-
response = await async_client.datasets.with_raw_response.list()
457-
458-
assert response.is_closed is True
459-
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
460-
dataset = await response.parse()
461-
assert_matches_type(DatasetListResponse, dataset, path=["response"])
462-
463-
@pytest.mark.skip(reason="Prism tests are disabled")
464-
@parametrize
465-
async def test_streaming_response_list(self, async_client: AsyncLemma) -> None:
466-
async with async_client.datasets.with_streaming_response.list() as response:
467-
assert not response.is_closed
468-
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
469-
470-
dataset = await response.parse()
471-
assert_matches_type(DatasetListResponse, dataset, path=["response"])
472-
473-
assert cast(Any, response.is_closed) is True
474-
475418
@pytest.mark.skip(reason="Prism tests are disabled")
476419
@parametrize
477420
async def test_method_delete(self, async_client: AsyncLemma) -> None:

0 commit comments

Comments
 (0)