Skip to content

Commit

Permalink
bump
Browse files Browse the repository at this point in the history
Signed-off-by: Jess Frazelle <[email protected]>
  • Loading branch information
jessfraz committed Aug 10, 2024
1 parent 9cbda88 commit 108e3e2
Show file tree
Hide file tree
Showing 11 changed files with 415 additions and 367 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.venv
732 changes: 366 additions & 366 deletions kittycad.py.patch.json

Large diffs are not rendered by default.

16 changes: 16 additions & 0 deletions kittycad/api/ai/create_text_to_cad.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,20 @@ def _get_kwargs(
body: TextToCadCreateBody,
*,
client: Client,
kcl: Optional[bool] = None,
) -> Dict[str, Any]:
url = "{}/ai/text-to-cad/{output_format}".format(
client.base_url,
output_format=output_format,
) # noqa: E501

if kcl is not None:

if "?" in url:
url = url + "&kcl=" + str(kcl)
else:
url = url + "?kcl=" + str(kcl)

headers: Dict[str, Any] = client.get_headers()
cookies: Dict[str, Any] = client.get_cookies()

Expand Down Expand Up @@ -62,9 +70,11 @@ def sync_detailed(
body: TextToCadCreateBody,
*,
client: Client,
kcl: Optional[bool] = None,
) -> Response[Optional[Union[TextToCad, Error]]]:
kwargs = _get_kwargs(
output_format=output_format,
kcl=kcl,
body=body,
client=client,
)
Expand All @@ -82,6 +92,7 @@ def sync(
body: TextToCadCreateBody,
*,
client: Client,
kcl: Optional[bool] = None,
) -> Optional[Union[TextToCad, Error]]:
"""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.
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 All @@ -90,6 +101,7 @@ def sync(

return sync_detailed(
output_format=output_format,
kcl=kcl,
body=body,
client=client,
).parsed
Expand All @@ -100,9 +112,11 @@ async def asyncio_detailed(
body: TextToCadCreateBody,
*,
client: Client,
kcl: Optional[bool] = None,
) -> Response[Optional[Union[TextToCad, Error]]]:
kwargs = _get_kwargs(
output_format=output_format,
kcl=kcl,
body=body,
client=client,
)
Expand All @@ -118,6 +132,7 @@ async def asyncio(
body: TextToCadCreateBody,
*,
client: Client,
kcl: Optional[bool] = None,
) -> Optional[Union[TextToCad, Error]]:
"""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.
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 All @@ -127,6 +142,7 @@ async def asyncio(
return (
await asyncio_detailed(
output_format=output_format,
kcl=kcl,
body=body,
client=client,
)
Expand Down
1 change: 1 addition & 0 deletions kittycad/client_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,7 @@ def test_text_to_cad():
body=TextToCadCreateBody(
prompt="a 2x4 lego",
),
kcl=None,
)

if isinstance(result, Error) or result is None:
Expand Down
4 changes: 4 additions & 0 deletions kittycad/examples_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -583,6 +583,7 @@ def test_create_text_to_cad():
result: Optional[Union[TextToCad, Error]] = create_text_to_cad.sync(
client=client,
output_format=FileExportFormat.FBX,
kcl=None, # Optional[bool]
body=TextToCadCreateBody(
prompt="<string>",
),
Expand All @@ -600,6 +601,7 @@ def test_create_text_to_cad():
create_text_to_cad.sync_detailed(
client=client,
output_format=FileExportFormat.FBX,
kcl=None, # Optional[bool]
body=TextToCadCreateBody(
prompt="<string>",
),
Expand All @@ -617,6 +619,7 @@ async def test_create_text_to_cad_async():
result: Optional[Union[TextToCad, Error]] = await create_text_to_cad.asyncio(
client=client,
output_format=FileExportFormat.FBX,
kcl=None, # Optional[bool]
body=TextToCadCreateBody(
prompt="<string>",
),
Expand All @@ -627,6 +630,7 @@ async def test_create_text_to_cad_async():
await create_text_to_cad.asyncio_detailed(
client=client,
output_format=FileExportFormat.FBX,
kcl=None, # Optional[bool]
body=TextToCadCreateBody(
prompt="<string>",
),
Expand Down
1 change: 1 addition & 0 deletions kittycad/models/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@
from .take_snapshot import TakeSnapshot
from .text_to_cad import TextToCad
from .text_to_cad_create_body import TextToCadCreateBody
from .text_to_cad_model import TextToCadModel
from .text_to_cad_results_page import TextToCadResultsPage
from .unit_angle import UnitAngle
from .unit_angle_conversion import UnitAngleConversion
Expand Down
2 changes: 2 additions & 0 deletions kittycad/models/ai_prompt_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ class AiPromptType(str, Enum):

"""# Text to CAD. """ # noqa: E501
TEXT_TO_CAD = "text_to_cad"
"""# Text to KCL. """ # noqa: E501
TEXT_TO_KCL = "text_to_kcl"

def __str__(self) -> str:
return str(self.value)
5 changes: 5 additions & 0 deletions kittycad/models/async_api_call_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from ..models.input_format import InputFormat
from ..models.output_format import OutputFormat
from ..models.point3d import Point3d
from ..models.text_to_cad_model import TextToCadModel
from ..models.unit_area import UnitArea
from ..models.unit_density import UnitDensity
from ..models.unit_length import UnitLength
Expand Down Expand Up @@ -215,6 +216,8 @@ class file_surface_area(BaseModel):
class text_to_cad(BaseModel):
"""Text to CAD."""

code: Optional[str] = None

completed_at: Optional[datetime.datetime] = None

created_at: datetime.datetime
Expand All @@ -225,6 +228,8 @@ class text_to_cad(BaseModel):

id: Uuid

model: TextToCadModel

model_version: str

output_format: FileExportFormat
Expand Down
5 changes: 5 additions & 0 deletions kittycad/models/text_to_cad.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,16 @@
from ..models.ai_feedback import AiFeedback
from ..models.api_call_status import ApiCallStatus
from ..models.file_export_format import FileExportFormat
from ..models.text_to_cad_model import TextToCadModel
from ..models.uuid import Uuid
from .base64data import Base64Data


class TextToCad(BaseModel):
"""A response from a text to CAD prompt."""

code: Optional[str] = None

completed_at: Optional[datetime.datetime] = None

created_at: datetime.datetime
Expand All @@ -23,6 +26,8 @@ class TextToCad(BaseModel):

id: Uuid

model: TextToCadModel

model_version: str

output_format: FileExportFormat
Expand Down
13 changes: 13 additions & 0 deletions kittycad/models/text_to_cad_model.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from enum import Enum


class TextToCadModel(str, Enum):
"""A type of Text-to-CAD model.""" # noqa: E501

"""# CAD. """ # noqa: E501
CAD = "cad"
"""# KCL. """ # noqa: E501
KCL = "kcl"

def __str__(self) -> str:
return str(self.value)
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "kittycad"
version = "0.6.17"
version = "0.6.18"
description = "A client library for accessing KittyCAD"

authors = []
Expand Down

0 comments on commit 108e3e2

Please sign in to comment.