You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"example": "/// Iterate on a CAD model with a prompt.\n/// \n/// 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.\n/// \n/// You always get the whole code back, even if you only changed a small part of it.\n/// \n/// 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.\nasync fn example_ml_create_text_to_cad_iteration() -> anyhow::Result<()> {\n let client = kittycad::Client::new_from_env();\n let result: kittycad::types::TextToCadIteration = client\n .ml()\n .create_text_to_cad_iteration(&kittycad::types::TextToCadIterationBody {\n original_source_code: \"some-string\".to_string(),\n prompt: Some(\"some-string\".to_string()),\n source_ranges: vec![kittycad::types::SourceRangePrompt {\n prompt: \"some-string\".to_string(),\n range: kittycad::types::SourceRange {\n end: kittycad::types::SourcePosition {\n column: 4 as u32,\n line: 4 as u32,\n },\n start: kittycad::types::SourcePosition {\n column: 4 as u32,\n line: 4 as u32,\n },\n },\n }],\n })\n .await?;\n println!(\"{:?}\", result);\n Ok(())\n}\n",
262
+
"example": "/// Iterate on a CAD model with a prompt.\n/// \n/// 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.\n/// \n/// You always get the whole code back, even if you only changed a small part of it.\n/// \n/// 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.\n/// \n/// This endpoint will soon be deprecated in favor of the `/ml/text-to-cad/multi-file/iteration` endpoint. In that the endpoint path will remain but it will have the same behavior as `ml/text-to-cad/multi-file/iteration`.\nasync fn example_ml_create_text_to_cad_iteration() -> anyhow::Result<()> {\n let client = kittycad::Client::new_from_env();\n let result: kittycad::types::TextToCadIteration = client\n .ml()\n .create_text_to_cad_iteration(&kittycad::types::TextToCadIterationBody {\n original_source_code: \"some-string\".to_string(),\n prompt: Some(\"some-string\".to_string()),\n source_ranges: vec![kittycad::types::SourceRangePrompt {\n file: Some(\"some-string\".to_string()),\n prompt: \"some-string\".to_string(),\n range: kittycad::types::SourceRange {\n end: kittycad::types::SourcePosition {\n column: 4 as u32,\n line: 4 as u32,\n },\n start: kittycad::types::SourcePosition {\n column: 4 as u32,\n line: 4 as u32,\n },\n },\n }],\n })\n .await?;\n println!(\"{:?}\", result);\n Ok(())\n}\n",
"example": "/// Iterate on a CAD model with a prompt.\n/// \n/// This endpoint can iterate on multi-file models.\n/// \n/// 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.\n/// \n/// You always get the whole code back, even if you only changed a small part of it. This endpoint will always return all the code back, including files that were not changed. If your original source code imported a stl/gltf/step/etc file, the output will not include that file since the model will never change non-kcl files. The endpoint will only return the kcl files that were changed.\n/// \n/// 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.\nasync fn example_ml_create_text_to_cad_multi_file_iteration() -> anyhow::Result<()> {\n let client = kittycad::Client::new_from_env();\n let result: kittycad::types::TextToCadMultiFileIteration = client\n .ml()\n .create_text_to_cad_multi_file_iteration(\n vec![kittycad::types::multipart::Attachment {\n name: \"thing\".to_string(),\n filename: Some(\"myfile.json\".to_string()),\n content_type: Some(\"application/json\".to_string()),\n data: std::fs::read(\"myfile.json\").unwrap(),\n }],\n &kittycad::types::TextToCadMultiFileIterationBody {\n source_ranges: vec![kittycad::types::SourceRangePrompt {\n file: Some(\"some-string\".to_string()),\n prompt: \"some-string\".to_string(),\n range: kittycad::types::SourceRange {\n end: kittycad::types::SourcePosition {\n column: 4 as u32,\n line: 4 as u32,\n },\n start: kittycad::types::SourcePosition {\n column: 4 as u32,\n line: 4 as u32,\n },\n },\n }],\n },\n )\n .await?;\n println!(\"{:?}\", result);\n Ok(())\n}\n",
Copy file name to clipboardexpand all lines: kittycad/src/ml.rs
+46-1
Original file line number
Diff line number
Diff line change
@@ -245,7 +245,7 @@ impl Ml {
245
245
}
246
246
}
247
247
248
-
#[doc = "Iterate on a CAD model with a prompt.\n\nEven 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.\n\nYou always get the whole code back, even if you only changed a small part of it.\n\nThis 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.\n\n```rust,no_run\nasync fn example_ml_create_text_to_cad_iteration() -> anyhow::Result<()> {\n let client = kittycad::Client::new_from_env();\n let result: kittycad::types::TextToCadIteration = client\n .ml()\n .create_text_to_cad_iteration(&kittycad::types::TextToCadIterationBody {\n original_source_code: \"some-string\".to_string(),\n prompt: Some(\"some-string\".to_string()),\n source_ranges: vec![kittycad::types::SourceRangePrompt {\n prompt: \"some-string\".to_string(),\n range: kittycad::types::SourceRange {\n end: kittycad::types::SourcePosition {\n column: 4 as u32,\n line: 4 as u32,\n },\n start: kittycad::types::SourcePosition {\n column: 4 as u32,\n line: 4 as u32,\n },\n },\n }],\n })\n .await?;\n println!(\"{:?}\", result);\n Ok(())\n}\n```"]
248
+
#[doc = "Iterate on a CAD model with a prompt.\n\nEven 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.\n\nYou always get the whole code back, even if you only changed a small part of it.\n\nThis 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.\n\nThis endpoint will soon be deprecated in favor of the `/ml/text-to-cad/multi-file/iteration` endpoint. In that the endpoint path will remain but it will have the same behavior as `ml/text-to-cad/multi-file/iteration`.\n\n```rust,no_run\nasync fn example_ml_create_text_to_cad_iteration() -> anyhow::Result<()> {\n let client = kittycad::Client::new_from_env();\n let result: kittycad::types::TextToCadIteration = client\n .ml()\n .create_text_to_cad_iteration(&kittycad::types::TextToCadIterationBody {\n original_source_code: \"some-string\".to_string(),\n prompt: Some(\"some-string\".to_string()),\n source_ranges: vec![kittycad::types::SourceRangePrompt {\n file: Some(\"some-string\".to_string()),\n prompt: \"some-string\".to_string(),\n range: kittycad::types::SourceRange {\n end: kittycad::types::SourcePosition {\n column: 4 as u32,\n line: 4 as u32,\n },\n start: kittycad::types::SourcePosition {\n column: 4 as u32,\n line: 4 as u32,\n },\n },\n }],\n })\n .await?;\n println!(\"{:?}\", result);\n Ok(())\n}\n```"]
249
249
#[tracing::instrument]
250
250
pubasyncfncreate_text_to_cad_iteration<'a>(
251
251
&'aself,
@@ -276,6 +276,51 @@ impl Ml {
276
276
}
277
277
}
278
278
279
+
#[doc = "Iterate on a CAD model with a prompt.\n\nThis endpoint can iterate on multi-file models.\n\nEven 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.\n\nYou always get the whole code back, even if you only changed a small part of it. This endpoint will always return all the code back, including files that were not changed. If your original source code imported a stl/gltf/step/etc file, the output will not include that file since the model will never change non-kcl files. The endpoint will only return the kcl files that were changed.\n\nThis 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.\n\n```rust,no_run\nasync fn example_ml_create_text_to_cad_multi_file_iteration() -> anyhow::Result<()> {\n let client = kittycad::Client::new_from_env();\n let result: kittycad::types::TextToCadMultiFileIteration = client\n .ml()\n .create_text_to_cad_multi_file_iteration(\n vec![kittycad::types::multipart::Attachment {\n name: \"thing\".to_string(),\n filename: Some(\"myfile.json\".to_string()),\n content_type: Some(\"application/json\".to_string()),\n data: std::fs::read(\"myfile.json\").unwrap(),\n }],\n &kittycad::types::TextToCadMultiFileIterationBody {\n source_ranges: vec![kittycad::types::SourceRangePrompt {\n file: Some(\"some-string\".to_string()),\n prompt: \"some-string\".to_string(),\n range: kittycad::types::SourceRange {\n end: kittycad::types::SourcePosition {\n column: 4 as u32,\n line: 4 as u32,\n },\n start: kittycad::types::SourcePosition {\n column: 4 as u32,\n line: 4 as u32,\n },\n },\n }],\n },\n )\n .await?;\n println!(\"{:?}\", result);\n Ok(())\n}\n```"]
#[doc = "List text-to-CAD models you've generated.\n\nThis will always return the STEP file contents as well as the format the user originally requested.\n\nThis endpoint requires authentication by any Zoo user. It returns the text-to-CAD models for the authenticated user.\n\nThe text-to-CAD models are returned in order of creation, with the most recently created text-to-CAD models first.\n\n**Parameters:**\n\n- `limit: Option<u32>`: Maximum number of items returned by a single call\n- `no_models: Option<bool>`: If we should return the model file contents or just the metadata.\n- `page_token: Option<String>`: Token returned by previous call to retrieve the subsequent page\n- `sort_by: Option<crate::types::CreatedAtSortMode>`\n\n```rust,no_run\nuse futures_util::TryStreamExt;\nasync fn example_ml_list_text_to_cad_models_for_user_stream() -> anyhow::Result<()> {\n let client = kittycad::Client::new_from_env();\n let mut ml = client.ml();\n let mut stream = ml.list_text_to_cad_models_for_user_stream(\n Some(4 as u32),\n Some(false),\n Some(kittycad::types::CreatedAtSortMode::CreatedAtDescending),\n );\n loop {\n match stream.try_next().await {\n Ok(Some(item)) => {\n println!(\"{:?}\", item);\n }\n Ok(None) => {\n break;\n }\n Err(err) => {\n return Err(err.into());\n }\n }\n }\n\n Ok(())\n}\n```"]
0 commit comments