Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions docs/pagination.rst
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,8 @@ Ml API
async for item in client.ml.list_conversations_for_user():
print(item)

**list_text_to_cad_models_for_user**
List text-to-CAD models you've generated.
**list_text_to_cad_parts_for_user**
List text-to-CAD parts you've generated.

Returns: ``SyncPageIterator[TextToCadResponse]``

Expand All @@ -220,11 +220,11 @@ Ml API
.. code-block:: python

# Sync
for item in client.ml.list_text_to_cad_models_for_user():
for item in client.ml.list_text_to_cad_parts_for_user():
print(item)

# Async
async for item in client.ml.list_text_to_cad_models_for_user():
async for item in client.ml.list_text_to_cad_parts_for_user():
print(item)


Expand Down
6 changes: 3 additions & 3 deletions kittycad.py.patch.json
Original file line number Diff line number Diff line change
Expand Up @@ -1099,23 +1099,23 @@
"op": "add",
"path": "/paths/~1user~1text-to-cad/get/x-python",
"value": {
"example": "from kittycad.models.created_at_sort_mode import CreatedAtSortMode\nfrom kittycad.models.uuid import Uuid\nfrom kittycad.models.uuid import Uuid\nfrom kittycad.models import TextToCadResponseResultsPage\nfrom typing import Union, Any, Optional, List, Tuple\nfrom kittycad.types import Response\n\n\nfrom kittycad.models import TextToCadResponse\ndef example_list_text_to_cad_models_for_user():\n client = KittyCAD() # Uses KITTYCAD_API_TOKEN environment variable\n\n # Iterate through all pages automatically\n item: TextToCadResponse\n for item in client.ml.list_text_to_cad_models_for_user(sort_by=CreatedAtSortMode.CREATED_AT_ASCENDING,\n conversation_id=Uuid(\"<string>\"),\n limit=None,\n page_token=None,\n no_models=None):\n print(item)\n\n",
"example": "from kittycad.models.created_at_sort_mode import CreatedAtSortMode\nfrom kittycad.models.uuid import Uuid\nfrom kittycad.models.uuid import Uuid\nfrom kittycad.models import TextToCadResponseResultsPage\nfrom typing import Union, Any, Optional, List, Tuple\nfrom kittycad.types import Response\n\n\nfrom kittycad.models import TextToCadResponse\ndef example_list_text_to_cad_parts_for_user():\n client = KittyCAD() # Uses KITTYCAD_API_TOKEN environment variable\n\n # Iterate through all pages automatically\n item: TextToCadResponse\n for item in client.ml.list_text_to_cad_parts_for_user(sort_by=CreatedAtSortMode.CREATED_AT_ASCENDING,\n conversation_id=Uuid(\"<string>\"),\n limit=None,\n page_token=None,\n no_models=None):\n print(item)\n\n",
"libDocsLink": "https://python.api.docs.zoo.dev/_autosummary/kittycad.KittyCAD.html#kittycad.KittyCAD.ml"
}
},
{
"op": "add",
"path": "/paths/~1user~1text-to-cad~1{id}/get/x-python",
"value": {
"example": "from kittycad.models import TextToCadResponse\nfrom typing import Union, Any, Optional, List, Tuple\nfrom kittycad.types import Response\ndef example_get_text_to_cad_model_for_user():\n client = KittyCAD() # Uses KITTYCAD_API_TOKEN environment variable\n\n result: TextToCadResponse = client.ml.get_text_to_cad_model_for_user(id=\"<string>\")\n\n\n body: TextToCadResponse = result\n print(body)\n\n",
"example": "from kittycad.models import TextToCadResponse\nfrom typing import Union, Any, Optional, List, Tuple\nfrom kittycad.types import Response\ndef example_get_text_to_cad_parts_for_user():\n client = KittyCAD() # Uses KITTYCAD_API_TOKEN environment variable\n\n result: TextToCadResponse = client.ml.get_text_to_cad_parts_for_user(id=\"<string>\")\n\n\n body: TextToCadResponse = result\n print(body)\n\n",
"libDocsLink": "https://python.api.docs.zoo.dev/_autosummary/kittycad.KittyCAD.html#kittycad.KittyCAD.ml"
}
},
{
"op": "add",
"path": "/paths/~1user~1text-to-cad~1{id}/post/x-python",
"value": {
"example": "from kittycad.models.ml_feedback import MlFeedback\ndef example_create_text_to_cad_model_feedback():\n client = KittyCAD() # Uses KITTYCAD_API_TOKEN environment variable\n\n client.ml.create_text_to_cad_model_feedback(id=\"<string>\",\n feedback=MlFeedback.THUMBS_UP)\n\n",
"example": "from kittycad.models.ml_feedback import MlFeedback\ndef example_create_text_to_cad_part_feedback():\n client = KittyCAD() # Uses KITTYCAD_API_TOKEN environment variable\n\n client.ml.create_text_to_cad_part_feedback(id=\"<string>\",\n feedback=MlFeedback.THUMBS_UP)\n\n",
"libDocsLink": "https://python.api.docs.zoo.dev/_autosummary/kittycad.KittyCAD.html#kittycad.KittyCAD.ml"
}
},
Expand Down
40 changes: 20 additions & 20 deletions kittycad/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -663,7 +663,7 @@ def create_text_to_cad(
*,
kcl: Optional[bool] = None,
) -> TextToCad:
"""Because our source of truth for the resulting model is a STEP file, you will always have STEP file contents when you list your generated models. Any other formats you request here will also be returned when you list your generated models.
"""Because our source of truth for the resulting model is a STEP file, you will always have STEP file contents when you list your generated parts. Any other formats you request here will also be returned when you list your generated parts.

This operation is performed asynchronously, the `id` of the operation will be returned. You can use the `id` returned from the request to get status information about the async operation from the `/async/operations/{id}` endpoint.

Expand Down Expand Up @@ -1020,7 +1020,7 @@ def create_text_to_cad_multi_file_iteration(
body: TextToCadMultiFileIterationBody,
file_attachments: Dict[str, SyncUpload],
) -> TextToCadMultiFileIteration:
"""This endpoint can iterate on multi-file models.
"""This endpoint can iterate on multi-file projects.

Even if you give specific ranges to edit, the model might change more than just those in order to make the changes you requested without breaking the code.

Expand Down Expand Up @@ -1100,7 +1100,7 @@ def create_text_to_cad_multi_file_iteration(
# Validate into a Pydantic model (works for BaseModel and RootModel)
return TextToCadMultiFileIteration.model_validate(json_data)

def list_text_to_cad_models_for_user(
def list_text_to_cad_parts_for_user(
self,
*,
limit: Optional[int] = None,
Expand All @@ -1111,14 +1111,14 @@ def list_text_to_cad_models_for_user(
) -> "SyncPageIterator":
"""This will always return the STEP file contents as well as the format the user originally requested.

This endpoint requires authentication by any Zoo user. It returns the text-to-CAD models for the authenticated user.
This endpoint requires authentication by any Zoo user. It returns the text-to-CAD parts for the authenticated user.

The text-to-CAD models are returned in order of creation, with the most recently created text-to-CAD models first.
The text-to-CAD parts are returned in order of creation, with the most recently created text-to-CAD parts first.

Returns an iterator that automatically handles pagination.
Iterate over all items across all pages:

for item in client.user.list_text_to_cad_models_for_user():
for item in client.user.list_text_to_cad_parts_for_user():
print(item)
"""

Expand Down Expand Up @@ -1147,15 +1147,15 @@ def list_text_to_cad_models_for_user(
kwargs["no_models"] = no_models

def fetch_page(**kw):
return self._fetch_page_list_text_to_cad_models_for_user(**kw)
return self._fetch_page_list_text_to_cad_parts_for_user(**kw)

# Create the page iterator
return SyncPageIterator(
page_fetcher=fetch_page,
initial_kwargs=kwargs,
)

def _fetch_page_list_text_to_cad_models_for_user(
def _fetch_page_list_text_to_cad_parts_for_user(
self, **kwargs
) -> TextToCadResponseResultsPage:
"""Internal method to fetch a single page."""
Expand Down Expand Up @@ -1214,7 +1214,7 @@ def _fetch_page_list_text_to_cad_models_for_user(
# Validate into a Pydantic model (supports BaseModel/RootModel)
return TextToCadResponseResultsPage.model_validate(json_data)

def get_text_to_cad_model_for_user(
def get_text_to_cad_parts_for_user(
self,
id: str,
) -> TextToCadResponse:
Expand Down Expand Up @@ -1242,7 +1242,7 @@ def get_text_to_cad_model_for_user(
# Validate into a Pydantic model (works for BaseModel and RootModel)
return TextToCadResponse.model_validate(json_data)

def create_text_to_cad_model_feedback(
def create_text_to_cad_part_feedback(
self,
id: str,
feedback: MlFeedback,
Expand Down Expand Up @@ -1301,7 +1301,7 @@ async def create_text_to_cad(
*,
kcl: Optional[bool] = None,
) -> TextToCad:
"""Because our source of truth for the resulting model is a STEP file, you will always have STEP file contents when you list your generated models. Any other formats you request here will also be returned when you list your generated models.
"""Because our source of truth for the resulting model is a STEP file, you will always have STEP file contents when you list your generated parts. Any other formats you request here will also be returned when you list your generated parts.

This operation is performed asynchronously, the `id` of the operation will be returned. You can use the `id` returned from the request to get status information about the async operation from the `/async/operations/{id}` endpoint.

Expand Down Expand Up @@ -1658,7 +1658,7 @@ async def create_text_to_cad_multi_file_iteration(
body: TextToCadMultiFileIterationBody,
file_attachments: Dict[str, SyncUpload],
) -> TextToCadMultiFileIteration:
"""This endpoint can iterate on multi-file models.
"""This endpoint can iterate on multi-file projects.

Even if you give specific ranges to edit, the model might change more than just those in order to make the changes you requested without breaking the code.

Expand Down Expand Up @@ -1738,7 +1738,7 @@ async def create_text_to_cad_multi_file_iteration(
# Validate into a Pydantic model (works for BaseModel and RootModel)
return TextToCadMultiFileIteration.model_validate(json_data)

def list_text_to_cad_models_for_user(
def list_text_to_cad_parts_for_user(
self,
*,
limit: Optional[int] = None,
Expand All @@ -1749,14 +1749,14 @@ def list_text_to_cad_models_for_user(
) -> "AsyncPageIterator":
"""This will always return the STEP file contents as well as the format the user originally requested.

This endpoint requires authentication by any Zoo user. It returns the text-to-CAD models for the authenticated user.
This endpoint requires authentication by any Zoo user. It returns the text-to-CAD parts for the authenticated user.

The text-to-CAD models are returned in order of creation, with the most recently created text-to-CAD models first.
The text-to-CAD parts are returned in order of creation, with the most recently created text-to-CAD parts first.

Returns an async iterator that automatically handles pagination.
Iterate over all items across all pages:

async for item in client.user.list_text_to_cad_models_for_user():
async for item in client.user.list_text_to_cad_parts_for_user():
print(item)
"""

Expand Down Expand Up @@ -1785,15 +1785,15 @@ def list_text_to_cad_models_for_user(
kwargs["no_models"] = no_models

async def fetch_page(**kw):
return await self._fetch_page_list_text_to_cad_models_for_user(**kw)
return await self._fetch_page_list_text_to_cad_parts_for_user(**kw)

# Create the async page iterator
return AsyncPageIterator(
page_fetcher=fetch_page,
initial_kwargs=kwargs,
)

async def _fetch_page_list_text_to_cad_models_for_user(
async def _fetch_page_list_text_to_cad_parts_for_user(
self, **kwargs
) -> TextToCadResponseResultsPage:
"""Internal async method to fetch a single page."""
Expand Down Expand Up @@ -1852,7 +1852,7 @@ async def _fetch_page_list_text_to_cad_models_for_user(
# Validate into a Pydantic model (supports BaseModel/RootModel)
return TextToCadResponseResultsPage.model_validate(json_data)

async def get_text_to_cad_model_for_user(
async def get_text_to_cad_parts_for_user(
self,
id: str,
) -> TextToCadResponse:
Expand Down Expand Up @@ -1880,7 +1880,7 @@ async def get_text_to_cad_model_for_user(
# Validate into a Pydantic model (works for BaseModel and RootModel)
return TextToCadResponse.model_validate(json_data)

async def create_text_to_cad_model_feedback(
async def create_text_to_cad_part_feedback(
self,
id: str,
feedback: MlFeedback,
Expand Down
2 changes: 1 addition & 1 deletion kittycad/models/text_to_cad_create_body.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@


class TextToCadCreateBody(KittyCadBaseModel):
"""Body for generating models from text."""
"""Body for generating parts from text."""

kcl_version: Optional[str] = None

Expand Down
2 changes: 1 addition & 1 deletion kittycad/models/text_to_cad_iteration_body.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@


class TextToCadIterationBody(KittyCadBaseModel):
"""Body for generating models from text."""
"""Body for generating parts from text."""

kcl_version: Optional[str] = None

Expand Down
2 changes: 1 addition & 1 deletion kittycad/tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -933,7 +933,7 @@ def test_text_to_cad():
while (
body.status == ApiCallStatus.IN_PROGRESS or body.status == ApiCallStatus.QUEUED
) and time.time() - start_time < 120:
result_status = client.ml.get_text_to_cad_model_for_user(
result_status = client.ml.get_text_to_cad_parts_for_user(
id=body.id,
)

Expand Down
24 changes: 12 additions & 12 deletions kittycad/tests/test_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -3265,12 +3265,12 @@ async def test_update_user_shortlink_async():


@pytest.mark.skip
def test_list_text_to_cad_models_for_user():
def test_list_text_to_cad_parts_for_user():
client = KittyCAD() # Uses KITTYCAD_API_TOKEN environment variable

# Iterate through all pages automatically
item: TextToCadResponse
for item in client.ml.list_text_to_cad_models_for_user(
for item in client.ml.list_text_to_cad_parts_for_user(
sort_by=CreatedAtSortMode.CREATED_AT_ASCENDING,
conversation_id=Uuid("<string>"),
limit=None,
Expand All @@ -3283,11 +3283,11 @@ def test_list_text_to_cad_models_for_user():
# OR run async
@pytest.mark.asyncio
@pytest.mark.skip
async def test_list_text_to_cad_models_for_user_async():
async def test_list_text_to_cad_parts_for_user_async():
client = AsyncKittyCAD() # Uses KITTYCAD_API_TOKEN environment variable

# Iterate through all pages automatically
iterator = client.ml.list_text_to_cad_models_for_user(
iterator = client.ml.list_text_to_cad_parts_for_user(
sort_by=CreatedAtSortMode.CREATED_AT_ASCENDING,
conversation_id=Uuid("<string>"),
limit=None,
Expand All @@ -3300,10 +3300,10 @@ async def test_list_text_to_cad_models_for_user_async():


@pytest.mark.skip
def test_get_text_to_cad_model_for_user():
def test_get_text_to_cad_parts_for_user():
client = KittyCAD() # Uses KITTYCAD_API_TOKEN environment variable

result: TextToCadResponse = client.ml.get_text_to_cad_model_for_user(id="<string>")
result: TextToCadResponse = client.ml.get_text_to_cad_parts_for_user(id="<string>")

body: TextToCadResponse = result
print(body)
Expand All @@ -3312,30 +3312,30 @@ def test_get_text_to_cad_model_for_user():
# OR run async
@pytest.mark.asyncio
@pytest.mark.skip
async def test_get_text_to_cad_model_for_user_async():
async def test_get_text_to_cad_parts_for_user_async():
client = AsyncKittyCAD() # Uses KITTYCAD_API_TOKEN environment variable

result: TextToCadResponse = await client.ml.get_text_to_cad_model_for_user(
result: TextToCadResponse = await client.ml.get_text_to_cad_parts_for_user(
id="<string>"
)


@pytest.mark.skip
def test_create_text_to_cad_model_feedback():
def test_create_text_to_cad_part_feedback():
client = KittyCAD() # Uses KITTYCAD_API_TOKEN environment variable

client.ml.create_text_to_cad_model_feedback(
client.ml.create_text_to_cad_part_feedback(
id="<string>", feedback=MlFeedback.THUMBS_UP
)


# OR run async
@pytest.mark.asyncio
@pytest.mark.skip
async def test_create_text_to_cad_model_feedback_async():
async def test_create_text_to_cad_part_feedback_async():
client = AsyncKittyCAD() # Uses KITTYCAD_API_TOKEN environment variable

await client.ml.create_text_to_cad_model_feedback(
await client.ml.create_text_to_cad_part_feedback(
id="<string>", feedback=MlFeedback.THUMBS_UP
)

Expand Down
8 changes: 4 additions & 4 deletions kittycad/tests/test_pagination.py
Original file line number Diff line number Diff line change
Expand Up @@ -761,7 +761,7 @@ def test_sync_pagination_integration_text_to_cad():
client = KittyCAD()

# Call paginated endpoint - now returns SyncPageIterator
iterator = client.ml.list_text_to_cad_models_for_user( # type: ignore[attr-defined]
iterator = client.ml.list_text_to_cad_parts_for_user( # type: ignore[attr-defined]
limit=10, # Small page size to test pagination
)

Expand Down Expand Up @@ -830,7 +830,7 @@ async def test_async_pagination_integration_text_to_cad():
client = AsyncKittyCAD()

# Call paginated endpoint - now returns AsyncPageIterator directly
iterator = client.ml.list_text_to_cad_models_for_user( # type: ignore[attr-defined]
iterator = client.ml.list_text_to_cad_parts_for_user( # type: ignore[attr-defined]
limit=10, # Small page size to test pagination
)

Expand Down Expand Up @@ -926,7 +926,7 @@ def mock_http_request(url, **kwargs):
# Get the iterator first with specific parameters
from kittycad.models.created_at_sort_mode import CreatedAtSortMode

iterator = client.ml.list_text_to_cad_models_for_user(
iterator = client.ml.list_text_to_cad_parts_for_user(
limit=5, sort_by=CreatedAtSortMode.CREATED_AT_ASCENDING
)
assert isinstance(iterator, SyncPageIterator)
Expand Down Expand Up @@ -1014,7 +1014,7 @@ def mock_http_request(url, **kwargs):
return mock_response

# Get the iterator with an explicit page_token (user wants to start from specific page)
iterator = client.ml.list_text_to_cad_models_for_user(
iterator = client.ml.list_text_to_cad_parts_for_user(
limit=5, page_token="explicit_start_token"
)
assert isinstance(iterator, SyncPageIterator)
Expand Down
Loading
Loading