From ab8716fa1ee5252c9819b4ce454376b88ee0d318 Mon Sep 17 00:00:00 2001 From: "zoo-github-actions-auth[bot]" <155849648+zoo-github-actions-auth[bot]@users.noreply.github.com> Date: Fri, 9 Aug 2024 20:46:14 -0700 Subject: [PATCH] Update api spec (#489) * YOYO NEW API SPEC! * I have generated the library! --------- Co-authored-by: github-actions[bot] --- Cargo.lock | 15 +++++---- kittycad.rs.patch.json | 30 ++++++++--------- kittycad/Cargo.toml | 4 +-- kittycad/README.md | 2 +- kittycad/src/lib.rs | 26 +++++++-------- kittycad/src/{ai.rs => ml.rs} | 36 ++++++++++---------- kittycad/src/types.rs | 38 ++++++++++++++++++++- openapitor/tests/types/kittycad.rs.gen | 38 ++++++++++++++++++++- spec.json | 46 +++++++++++++++++--------- 9 files changed, 162 insertions(+), 73 deletions(-) rename kittycad/src/{ai.rs => ml.rs} (90%) diff --git a/Cargo.lock b/Cargo.lock index 45ccddb..5fb59d4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -978,7 +978,7 @@ dependencies = [ [[package]] name = "kittycad" -version = "0.3.11" +version = "0.3.12" dependencies = [ "anyhow", "async-trait", @@ -1308,9 +1308,9 @@ checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" [[package]] name = "papergrid" -version = "0.12.0" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7419ad52a7de9b60d33e11085a0fe3df1fbd5926aa3f93d3dd53afbc9e86725" +checksum = "9ad43c07024ef767f9160710b3a6773976194758c7919b17e63b863db0bdf7fb" dependencies = [ "ansi-str", "ansitok", @@ -2191,21 +2191,22 @@ dependencies = [ [[package]] name = "tabled" -version = "0.16.0" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77c9303ee60b9bedf722012ea29ae3711ba13a67c9b9ae28993838b63057cb1b" +checksum = "4c998b0c8b921495196a48aabaf1901ff28be0760136e31604f7967b0792050e" dependencies = [ "ansi-str", "ansitok", "papergrid", "tabled_derive", + "unicode-width", ] [[package]] name = "tabled_derive" -version = "0.8.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf0fb8bfdc709786c154e24a66777493fb63ae97e3036d914c8666774c477069" +checksum = "4c138f99377e5d653a371cdad263615634cfc8467685dfe8e73e2b8e98f44b17" dependencies = [ "heck 0.4.1", "proc-macro-error", diff --git a/kittycad.rs.patch.json b/kittycad.rs.patch.json index a9f669e..36e49ae 100644 --- a/kittycad.rs.patch.json +++ b/kittycad.rs.patch.json @@ -4,7 +4,7 @@ "path": "/info/x-rust", "value": { "client": "// Authenticate via an API token.\nlet client = kittycad::Client::new(\"$TOKEN\");\n\n// - OR -\n\n// Authenticate with your token and host parsed from the environment variables:\n// `KITTYCAD_API_TOKEN`.\nlet client = kittycad::Client::new_from_env();", - "install": "[dependencies]\nkittycad = \"0.3.11\"" + "install": "[dependencies]\nkittycad = \"0.3.12\"" } }, { @@ -35,32 +35,32 @@ "op": "add", "path": "/paths/~1ai-prompts/get/x-rust", "value": { - "example": "/// List all AI prompts.\n/// \n/// For text-to-cad prompts, this will always return the STEP file contents as well as the format the user originally requested.\n/// This endpoint requires authentication by a Zoo employee.\n/// The AI prompts are returned in order of creation, with the most recently created AI prompts first.\n/// \n/// **Parameters:**\n/// \n/// - `limit: Option`: Maximum number of items returned by a single call\n/// - `page_token: Option`: Token returned by previous call to retrieve the subsequent page\n/// - `sort_by: Option`\nasync fn example_ai_list_prompts() -> anyhow::Result<()> {\n let client = kittycad::Client::new_from_env();\n let result: kittycad::types::AiPromptResultsPage = client\n .ai()\n .list_prompts(\n Some(4 as u32),\n Some(\"some-string\".to_string()),\n Some(kittycad::types::CreatedAtSortMode::CreatedAtDescending),\n )\n .await?;\n println!(\"{:?}\", result);\n Ok(())\n}\n\n\n/// - OR -\n\n/// Get a stream of results.\n///\n/// This allows you to paginate through all the items.\nuse futures_util::TryStreamExt;\nasync fn example_ai_list_prompts_stream() -> anyhow::Result<()> {\n let client = kittycad::Client::new_from_env();\n let mut ai = client.ai();\n let mut stream = ai.list_prompts_stream(\n Some(4 as u32),\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", - "libDocsLink": "https://docs.rs/kittycad/latest/kittycad/ai/struct.Ai.html#method.list_prompts" + "example": "/// List all AI prompts.\n/// \n/// For text-to-cad prompts, this will always return the STEP file contents as well as the format the user originally requested.\n/// This endpoint requires authentication by a Zoo employee.\n/// The AI prompts are returned in order of creation, with the most recently created AI prompts first.\n/// \n/// **Parameters:**\n/// \n/// - `limit: Option`: Maximum number of items returned by a single call\n/// - `page_token: Option`: Token returned by previous call to retrieve the subsequent page\n/// - `sort_by: Option`\nasync fn example_ml_list_ai_prompts() -> anyhow::Result<()> {\n let client = kittycad::Client::new_from_env();\n let result: kittycad::types::AiPromptResultsPage = client\n .ml()\n .list_ai_prompts(\n Some(4 as u32),\n Some(\"some-string\".to_string()),\n Some(kittycad::types::CreatedAtSortMode::CreatedAtDescending),\n )\n .await?;\n println!(\"{:?}\", result);\n Ok(())\n}\n\n\n/// - OR -\n\n/// Get a stream of results.\n///\n/// This allows you to paginate through all the items.\nuse futures_util::TryStreamExt;\nasync fn example_ml_list_ai_prompts_stream() -> anyhow::Result<()> {\n let client = kittycad::Client::new_from_env();\n let mut ml = client.ml();\n let mut stream = ml.list_ai_prompts_stream(\n Some(4 as u32),\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", + "libDocsLink": "https://docs.rs/kittycad/latest/kittycad/ml/struct.Ml.html#method.list_ai_prompts" } }, { "op": "add", "path": "/paths/~1ai-prompts~1{id}/get/x-rust", "value": { - "example": "/// Get an AI prompt.\n/// \n/// This endpoint requires authentication by a Zoo employee.\n/// \n/// **Parameters:**\n/// \n/// - `id: uuid::Uuid`: The id of the model to give feedback to. (required)\nuse std::str::FromStr;\nasync fn example_ai_get_prompt() -> anyhow::Result<()> {\n let client = kittycad::Client::new_from_env();\n let result: kittycad::types::AiPrompt = client\n .ai()\n .get_prompt(uuid::Uuid::from_str(\n \"d9797f8d-9ad6-4e08-90d7-2ec17e13471c\",\n )?)\n .await?;\n println!(\"{:?}\", result);\n Ok(())\n}\n", - "libDocsLink": "https://docs.rs/kittycad/latest/kittycad/ai/struct.Ai.html#method.get_prompt" + "example": "/// Get an AI prompt.\n/// \n/// This endpoint requires authentication by a Zoo employee.\n/// \n/// **Parameters:**\n/// \n/// - `id: uuid::Uuid`: The id of the model to give feedback to. (required)\nuse std::str::FromStr;\nasync fn example_ml_get_ai_prompt() -> anyhow::Result<()> {\n let client = kittycad::Client::new_from_env();\n let result: kittycad::types::AiPrompt = client\n .ml()\n .get_ai_prompt(uuid::Uuid::from_str(\n \"d9797f8d-9ad6-4e08-90d7-2ec17e13471c\",\n )?)\n .await?;\n println!(\"{:?}\", result);\n Ok(())\n}\n", + "libDocsLink": "https://docs.rs/kittycad/latest/kittycad/ml/struct.Ml.html#method.get_ai_prompt" } }, { "op": "add", "path": "/paths/~1ai~1kcl~1completions/post/x-rust", "value": { - "example": "/// Generate code completions for KCL.\nasync fn example_ai_create_kcl_code_completions() -> anyhow::Result<()> {\n let client = kittycad::Client::new_from_env();\n let result: kittycad::types::KclCodeCompletionResponse = client\n .ai()\n .create_kcl_code_completions(&kittycad::types::KclCodeCompletionRequest {\n extra: Some(kittycad::types::KclCodeCompletionParams {\n language: Some(\"some-string\".to_string()),\n next_indent: Some(4 as u8),\n prompt_tokens: Some(4 as u32),\n suffix_tokens: Some(4 as u32),\n trim_by_indentation: false,\n }),\n max_tokens: Some(4 as u16),\n n: Some(4 as u8),\n nwo: Some(\"some-string\".to_string()),\n prompt: Some(\"some-string\".to_string()),\n stop: Some(vec![\"some-string\".to_string()]),\n stream: false,\n suffix: Some(\"some-string\".to_string()),\n temperature: Some(3.14 as f64),\n top_p: Some(3.14 as f64),\n })\n .await?;\n println!(\"{:?}\", result);\n Ok(())\n}\n", - "libDocsLink": "https://docs.rs/kittycad/latest/kittycad/ai/struct.Ai.html#method.create_kcl_code_completions" + "example": "/// Generate code completions for KCL.\nasync fn example_ml_create_kcl_code_completions() -> anyhow::Result<()> {\n let client = kittycad::Client::new_from_env();\n let result: kittycad::types::KclCodeCompletionResponse = client\n .ml()\n .create_kcl_code_completions(&kittycad::types::KclCodeCompletionRequest {\n extra: Some(kittycad::types::KclCodeCompletionParams {\n language: Some(\"some-string\".to_string()),\n next_indent: Some(4 as u8),\n prompt_tokens: Some(4 as u32),\n suffix_tokens: Some(4 as u32),\n trim_by_indentation: false,\n }),\n max_tokens: Some(4 as u16),\n n: Some(4 as u8),\n nwo: Some(\"some-string\".to_string()),\n prompt: Some(\"some-string\".to_string()),\n stop: Some(vec![\"some-string\".to_string()]),\n stream: false,\n suffix: Some(\"some-string\".to_string()),\n temperature: Some(3.14 as f64),\n top_p: Some(3.14 as f64),\n })\n .await?;\n println!(\"{:?}\", result);\n Ok(())\n}\n", + "libDocsLink": "https://docs.rs/kittycad/latest/kittycad/ml/struct.Ml.html#method.create_kcl_code_completions" } }, { "op": "add", "path": "/paths/~1ai~1text-to-cad~1{output_format}/post/x-rust", "value": { - "example": "/// Generate a CAD model from text.\n/// \n/// 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.\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/// One thing to note, if you hit the cache, this endpoint will return right away. So you only have to wait if the status is not `Completed` or `Failed`.\n/// \n/// **Parameters:**\n/// \n/// - `kcl: Option`: If we should output the kcl for the model.\n/// - `output_format: crate::types::FileExportFormat`: The format the output file should be converted to. (required)\nasync fn example_ai_create_text_to_cad() -> anyhow::Result<()> {\n let client = kittycad::Client::new_from_env();\n let result: kittycad::types::TextToCad = client\n .ai()\n .create_text_to_cad(\n Some(false),\n kittycad::types::FileExportFormat::Stl,\n &kittycad::types::TextToCadCreateBody {\n prompt: \"some-string\".to_string(),\n },\n )\n .await?;\n println!(\"{:?}\", result);\n Ok(())\n}\n", - "libDocsLink": "https://docs.rs/kittycad/latest/kittycad/ai/struct.Ai.html#method.create_text_to_cad" + "example": "/// Generate a CAD model from text.\n/// \n/// 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.\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/// One thing to note, if you hit the cache, this endpoint will return right away. So you only have to wait if the status is not `Completed` or `Failed`.\n/// \n/// **Parameters:**\n/// \n/// - `kcl: Option`: If we should output the kcl for the model.\n/// - `output_format: crate::types::FileExportFormat`: The format the output file should be converted to. (required)\nasync fn example_ml_create_text_to_cad() -> anyhow::Result<()> {\n let client = kittycad::Client::new_from_env();\n let result: kittycad::types::TextToCad = client\n .ml()\n .create_text_to_cad(\n Some(false),\n kittycad::types::FileExportFormat::Stl,\n &kittycad::types::TextToCadCreateBody {\n prompt: \"some-string\".to_string(),\n },\n )\n .await?;\n println!(\"{:?}\", result);\n Ok(())\n}\n", + "libDocsLink": "https://docs.rs/kittycad/latest/kittycad/ml/struct.Ml.html#method.create_text_to_cad" } }, { @@ -979,24 +979,24 @@ "op": "add", "path": "/paths/~1user~1text-to-cad/get/x-rust", "value": { - "example": "/// List text-to-CAD models you've generated.\n/// \n/// This will always return the STEP file contents as well as the format the user originally requested.\n/// This endpoint requires authentication by any Zoo user. It returns the text-to-CAD models for the authenticated user.\n/// The 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`: Maximum number of items returned by a single call\n/// - `no_models: Option`: If we should return the model file contents or just the metadata.\n/// - `page_token: Option`: Token returned by previous call to retrieve the subsequent page\n/// - `sort_by: Option`\nasync fn example_ai_list_text_to_cad_models_for_user() -> anyhow::Result<()> {\n let client = kittycad::Client::new_from_env();\n let result: kittycad::types::TextToCadResultsPage = client\n .ai()\n .list_text_to_cad_models_for_user(\n Some(4 as u32),\n Some(false),\n Some(\"some-string\".to_string()),\n Some(kittycad::types::CreatedAtSortMode::CreatedAtDescending),\n )\n .await?;\n println!(\"{:?}\", result);\n Ok(())\n}\n\n\n/// - OR -\n\n/// Get a stream of results.\n///\n/// This allows you to paginate through all the items.\nuse futures_util::TryStreamExt;\nasync fn example_ai_list_text_to_cad_models_for_user_stream() -> anyhow::Result<()> {\n let client = kittycad::Client::new_from_env();\n let mut ai = client.ai();\n let mut stream = ai.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", - "libDocsLink": "https://docs.rs/kittycad/latest/kittycad/ai/struct.Ai.html#method.list_text_to_cad_models_for_user" + "example": "/// List text-to-CAD models you've generated.\n/// \n/// This will always return the STEP file contents as well as the format the user originally requested.\n/// This endpoint requires authentication by any Zoo user. It returns the text-to-CAD models for the authenticated user.\n/// The 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`: Maximum number of items returned by a single call\n/// - `no_models: Option`: If we should return the model file contents or just the metadata.\n/// - `page_token: Option`: Token returned by previous call to retrieve the subsequent page\n/// - `sort_by: Option`\nasync fn example_ml_list_text_to_cad_models_for_user() -> anyhow::Result<()> {\n let client = kittycad::Client::new_from_env();\n let result: kittycad::types::TextToCadResultsPage = client\n .ml()\n .list_text_to_cad_models_for_user(\n Some(4 as u32),\n Some(false),\n Some(\"some-string\".to_string()),\n Some(kittycad::types::CreatedAtSortMode::CreatedAtDescending),\n )\n .await?;\n println!(\"{:?}\", result);\n Ok(())\n}\n\n\n/// - OR -\n\n/// Get a stream of results.\n///\n/// This allows you to paginate through all the items.\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", + "libDocsLink": "https://docs.rs/kittycad/latest/kittycad/ml/struct.Ml.html#method.list_text_to_cad_models_for_user" } }, { "op": "add", "path": "/paths/~1user~1text-to-cad~1{id}/get/x-rust", "value": { - "example": "/// Get a text-to-CAD response.\n/// \n/// This endpoint requires authentication by any Zoo user. The user must be the owner of the text-to-CAD model.\n/// \n/// **Parameters:**\n/// \n/// - `id: uuid::Uuid`: The id of the model to give feedback to. (required)\nuse std::str::FromStr;\nasync fn example_ai_get_text_to_cad_model_for_user() -> anyhow::Result<()> {\n let client = kittycad::Client::new_from_env();\n let result: kittycad::types::TextToCad = client\n .ai()\n .get_text_to_cad_model_for_user(uuid::Uuid::from_str(\n \"d9797f8d-9ad6-4e08-90d7-2ec17e13471c\",\n )?)\n .await?;\n println!(\"{:?}\", result);\n Ok(())\n}\n", - "libDocsLink": "https://docs.rs/kittycad/latest/kittycad/ai/struct.Ai.html#method.get_text_to_cad_model_for_user" + "example": "/// Get a text-to-CAD response.\n/// \n/// This endpoint requires authentication by any Zoo user. The user must be the owner of the text-to-CAD model.\n/// \n/// **Parameters:**\n/// \n/// - `id: uuid::Uuid`: The id of the model to give feedback to. (required)\nuse std::str::FromStr;\nasync fn example_ml_get_text_to_cad_model_for_user() -> anyhow::Result<()> {\n let client = kittycad::Client::new_from_env();\n let result: kittycad::types::TextToCad = client\n .ml()\n .get_text_to_cad_model_for_user(uuid::Uuid::from_str(\n \"d9797f8d-9ad6-4e08-90d7-2ec17e13471c\",\n )?)\n .await?;\n println!(\"{:?}\", result);\n Ok(())\n}\n", + "libDocsLink": "https://docs.rs/kittycad/latest/kittycad/ml/struct.Ml.html#method.get_text_to_cad_model_for_user" } }, { "op": "add", "path": "/paths/~1user~1text-to-cad~1{id}/post/x-rust", "value": { - "example": "/// Give feedback to a specific text-to-CAD response.\n/// \n/// This endpoint requires authentication by any Zoo user. The user must be the owner of the text-to-CAD model, in order to give feedback.\n/// \n/// **Parameters:**\n/// \n/// - `feedback: crate::types::AiFeedback`: The feedback. (required)\n/// - `id: uuid::Uuid`: The id of the model to give feedback to. (required)\nuse std::str::FromStr;\nasync fn example_ai_create_text_to_cad_model_feedback() -> anyhow::Result<()> {\n let client = kittycad::Client::new_from_env();\n client\n .ai()\n .create_text_to_cad_model_feedback(\n kittycad::types::AiFeedback::ThumbsDown,\n uuid::Uuid::from_str(\"d9797f8d-9ad6-4e08-90d7-2ec17e13471c\")?,\n )\n .await?;\n Ok(())\n}\n", - "libDocsLink": "https://docs.rs/kittycad/latest/kittycad/ai/struct.Ai.html#method.create_text_to_cad_model_feedback" + "example": "/// Give feedback to a specific text-to-CAD response.\n/// \n/// This endpoint requires authentication by any Zoo user. The user must be the owner of the text-to-CAD model, in order to give feedback.\n/// \n/// **Parameters:**\n/// \n/// - `feedback: crate::types::AiFeedback`: The feedback. (required)\n/// - `id: uuid::Uuid`: The id of the model to give feedback to. (required)\nuse std::str::FromStr;\nasync fn example_ml_create_text_to_cad_model_feedback() -> anyhow::Result<()> {\n let client = kittycad::Client::new_from_env();\n client\n .ml()\n .create_text_to_cad_model_feedback(\n kittycad::types::AiFeedback::ThumbsDown,\n uuid::Uuid::from_str(\"d9797f8d-9ad6-4e08-90d7-2ec17e13471c\")?,\n )\n .await?;\n Ok(())\n}\n", + "libDocsLink": "https://docs.rs/kittycad/latest/kittycad/ml/struct.Ml.html#method.create_text_to_cad_model_feedback" } }, { diff --git a/kittycad/Cargo.toml b/kittycad/Cargo.toml index fa4af51..b93be70 100644 --- a/kittycad/Cargo.toml +++ b/kittycad/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "kittycad" description = "A fully generated & opinionated API client for the KittyCAD API." -version = "0.3.11" +version = "0.3.12" documentation = "https://docs.rs/kittycad" readme = "README.md" repository = "https://github.com/KittyCAD/kittycad.rs/tree/main/kittycad" @@ -37,7 +37,7 @@ serde = { version = "1", features = ["derive"] } serde_bytes = "0.11" serde_json = "1" serde_urlencoded = { version = "^0.7", optional = true } -tabled = { version = "0.16.0", features = ["ansi"], optional = true } +tabled = { version = "0.15.0", features = ["ansi"], optional = true } thiserror = "1" tracing = { version = "^0.1", optional = true } url = { version = "2", features = ["serde"] } diff --git a/kittycad/README.md b/kittycad/README.md index 248f5af..7694998 100644 --- a/kittycad/README.md +++ b/kittycad/README.md @@ -31,7 +31,7 @@ To install the library, add the following to your `Cargo.toml` file. ```toml [dependencies] -kittycad = "0.3.11" +kittycad = "0.3.12" ``` ## Basic example diff --git a/kittycad/src/lib.rs b/kittycad/src/lib.rs index de783d1..e4e64ea 100644 --- a/kittycad/src/lib.rs +++ b/kittycad/src/lib.rs @@ -29,7 +29,7 @@ //! //! ```toml //! [dependencies] -//! kittycad = "0.3.11" +//! kittycad = "0.3.12" //! ``` //! //! ## Basic example @@ -59,11 +59,6 @@ #![allow(clippy::needless_lifetimes)] #![cfg_attr(docsrs, feature(doc_cfg))] -/// AI uses machine learning to generate CAD models. -/// -/// FROM: -#[cfg(feature = "requests")] -pub mod ai; /// API calls that have been performed by users can be queried by the API. This is helpful for debugging as well as billing. /// /// FROM: @@ -100,6 +95,11 @@ pub mod hidden; #[cfg(feature = "requests")] pub mod meta; mod methods; +/// Machine learning to generate CAD models and other things. +/// +/// FROM: +#[cfg(feature = "requests")] +pub mod ml; /// Modeling API for updating your 3D files using the Zoo engine. /// /// FROM: @@ -376,13 +376,6 @@ impl Client { Ok(RequestBuilder(req)) } - /// AI uses machine learning to generate CAD models. - /// - /// FROM: - pub fn ai(&self) -> ai::Ai { - ai::Ai::new(self.clone()) - } - /// API calls that have been performed by users can be queried by the API. This is helpful for debugging as well as billing. /// /// FROM: @@ -432,6 +425,13 @@ impl Client { meta::Meta::new(self.clone()) } + /// Machine learning to generate CAD models and other things. + /// + /// FROM: + pub fn ml(&self) -> ml::Ml { + ml::Ml::new(self.clone()) + } + /// Modeling API for updating your 3D files using the Zoo engine. /// /// FROM: diff --git a/kittycad/src/ai.rs b/kittycad/src/ml.rs similarity index 90% rename from kittycad/src/ai.rs rename to kittycad/src/ml.rs index 18142de..95a1c5d 100644 --- a/kittycad/src/ai.rs +++ b/kittycad/src/ml.rs @@ -2,19 +2,19 @@ use anyhow::Result; use crate::Client; #[derive(Clone, Debug)] -pub struct Ai { +pub struct Ml { pub client: Client, } -impl Ai { +impl Ml { #[doc(hidden)] pub fn new(client: Client) -> Self { Self { client } } - #[doc = "List all AI prompts.\n\nFor text-to-cad prompts, this will always return the STEP file contents as well as the format the user originally requested.\nThis endpoint requires authentication by a Zoo employee.\nThe AI prompts are returned in order of creation, with the most recently created AI prompts first.\n\n**Parameters:**\n\n- `limit: Option`: Maximum number of items returned by a single call\n- `page_token: Option`: Token returned by previous call to retrieve the subsequent page\n- `sort_by: Option`\n\n```rust,no_run\nuse futures_util::TryStreamExt;\nasync fn example_ai_list_prompts_stream() -> anyhow::Result<()> {\n let client = kittycad::Client::new_from_env();\n let mut ai = client.ai();\n let mut stream = ai.list_prompts_stream(\n Some(4 as u32),\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```"] + #[doc = "List all AI prompts.\n\nFor text-to-cad prompts, this will always return the STEP file contents as well as the format the user originally requested.\nThis endpoint requires authentication by a Zoo employee.\nThe AI prompts are returned in order of creation, with the most recently created AI prompts first.\n\n**Parameters:**\n\n- `limit: Option`: Maximum number of items returned by a single call\n- `page_token: Option`: Token returned by previous call to retrieve the subsequent page\n- `sort_by: Option`\n\n```rust,no_run\nuse futures_util::TryStreamExt;\nasync fn example_ml_list_ai_prompts_stream() -> anyhow::Result<()> {\n let client = kittycad::Client::new_from_env();\n let mut ml = client.ml();\n let mut stream = ml.list_ai_prompts_stream(\n Some(4 as u32),\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```"] #[tracing::instrument] - pub async fn list_prompts<'a>( + pub async fn list_ai_prompts<'a>( &'a self, limit: Option, page_token: Option, @@ -58,10 +58,10 @@ impl Ai { } } - #[doc = "List all AI prompts.\n\nFor text-to-cad prompts, this will always return the STEP file contents as well as the format the user originally requested.\nThis endpoint requires authentication by a Zoo employee.\nThe AI prompts are returned in order of creation, with the most recently created AI prompts first.\n\n**Parameters:**\n\n- `limit: Option`: Maximum number of items returned by a single call\n- `page_token: Option`: Token returned by previous call to retrieve the subsequent page\n- `sort_by: Option`\n\n```rust,no_run\nuse futures_util::TryStreamExt;\nasync fn example_ai_list_prompts_stream() -> anyhow::Result<()> {\n let client = kittycad::Client::new_from_env();\n let mut ai = client.ai();\n let mut stream = ai.list_prompts_stream(\n Some(4 as u32),\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```"] + #[doc = "List all AI prompts.\n\nFor text-to-cad prompts, this will always return the STEP file contents as well as the format the user originally requested.\nThis endpoint requires authentication by a Zoo employee.\nThe AI prompts are returned in order of creation, with the most recently created AI prompts first.\n\n**Parameters:**\n\n- `limit: Option`: Maximum number of items returned by a single call\n- `page_token: Option`: Token returned by previous call to retrieve the subsequent page\n- `sort_by: Option`\n\n```rust,no_run\nuse futures_util::TryStreamExt;\nasync fn example_ml_list_ai_prompts_stream() -> anyhow::Result<()> {\n let client = kittycad::Client::new_from_env();\n let mut ml = client.ml();\n let mut stream = ml.list_ai_prompts_stream(\n Some(4 as u32),\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```"] #[tracing::instrument] #[cfg(not(feature = "js"))] - pub fn list_prompts_stream<'a>( + pub fn list_ai_prompts_stream<'a>( &'a self, limit: Option, sort_by: Option, @@ -71,7 +71,7 @@ impl Ai { use futures::{StreamExt, TryFutureExt, TryStreamExt}; use crate::types::paginate::Pagination; - self.list_prompts(limit, None, sort_by) + self.list_ai_prompts(limit, None, sort_by) .map_ok(move |result| { let items = futures::stream::iter(result.items().into_iter().map(Ok)); let next_pages = futures::stream::try_unfold( @@ -132,13 +132,13 @@ impl Ai { #[doc = "Get an AI prompt.\n\nThis endpoint requires authentication by a Zoo \ employee.\n\n**Parameters:**\n\n- `id: uuid::Uuid`: The id of the model to give \ feedback to. (required)\n\n```rust,no_run\nuse std::str::FromStr;\nasync fn \ - example_ai_get_prompt() -> anyhow::Result<()> {\n let client = \ + example_ml_get_ai_prompt() -> anyhow::Result<()> {\n let client = \ kittycad::Client::new_from_env();\n let result: kittycad::types::AiPrompt = \ - client\n .ai()\n .get_prompt(uuid::Uuid::from_str(\n \ + client\n .ml()\n .get_ai_prompt(uuid::Uuid::from_str(\n \ \"d9797f8d-9ad6-4e08-90d7-2ec17e13471c\",\n )?)\n .await?;\n \ println!(\"{:?}\", result);\n Ok(())\n}\n```"] #[tracing::instrument] - pub async fn get_prompt<'a>( + pub async fn get_ai_prompt<'a>( &'a self, id: uuid::Uuid, ) -> Result { @@ -170,7 +170,7 @@ impl Ai { } } - #[doc = "Generate code completions for KCL.\n\n```rust,no_run\nasync fn example_ai_create_kcl_code_completions() -> anyhow::Result<()> {\n let client = kittycad::Client::new_from_env();\n let result: kittycad::types::KclCodeCompletionResponse = client\n .ai()\n .create_kcl_code_completions(&kittycad::types::KclCodeCompletionRequest {\n extra: Some(kittycad::types::KclCodeCompletionParams {\n language: Some(\"some-string\".to_string()),\n next_indent: Some(4 as u8),\n prompt_tokens: Some(4 as u32),\n suffix_tokens: Some(4 as u32),\n trim_by_indentation: false,\n }),\n max_tokens: Some(4 as u16),\n n: Some(4 as u8),\n nwo: Some(\"some-string\".to_string()),\n prompt: Some(\"some-string\".to_string()),\n stop: Some(vec![\"some-string\".to_string()]),\n stream: false,\n suffix: Some(\"some-string\".to_string()),\n temperature: Some(3.14 as f64),\n top_p: Some(3.14 as f64),\n })\n .await?;\n println!(\"{:?}\", result);\n Ok(())\n}\n```"] + #[doc = "Generate code completions for KCL.\n\n```rust,no_run\nasync fn example_ml_create_kcl_code_completions() -> anyhow::Result<()> {\n let client = kittycad::Client::new_from_env();\n let result: kittycad::types::KclCodeCompletionResponse = client\n .ml()\n .create_kcl_code_completions(&kittycad::types::KclCodeCompletionRequest {\n extra: Some(kittycad::types::KclCodeCompletionParams {\n language: Some(\"some-string\".to_string()),\n next_indent: Some(4 as u8),\n prompt_tokens: Some(4 as u32),\n suffix_tokens: Some(4 as u32),\n trim_by_indentation: false,\n }),\n max_tokens: Some(4 as u16),\n n: Some(4 as u8),\n nwo: Some(\"some-string\".to_string()),\n prompt: Some(\"some-string\".to_string()),\n stop: Some(vec![\"some-string\".to_string()]),\n stream: false,\n suffix: Some(\"some-string\".to_string()),\n temperature: Some(3.14 as f64),\n top_p: Some(3.14 as f64),\n })\n .await?;\n println!(\"{:?}\", result);\n Ok(())\n}\n```"] #[tracing::instrument] pub async fn create_kcl_code_completions<'a>( &'a self, @@ -201,7 +201,7 @@ impl Ai { } } - #[doc = "Generate a CAD model from text.\n\nBecause 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.\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.\nOne thing to note, if you hit the cache, this endpoint will return right away. So you only have to wait if the status is not `Completed` or `Failed`.\n\n**Parameters:**\n\n- `kcl: Option`: If we should output the kcl for the model.\n- `output_format: crate::types::FileExportFormat`: The format the output file should be converted to. (required)\n\n```rust,no_run\nasync fn example_ai_create_text_to_cad() -> anyhow::Result<()> {\n let client = kittycad::Client::new_from_env();\n let result: kittycad::types::TextToCad = client\n .ai()\n .create_text_to_cad(\n Some(false),\n kittycad::types::FileExportFormat::Stl,\n &kittycad::types::TextToCadCreateBody {\n prompt: \"some-string\".to_string(),\n },\n )\n .await?;\n println!(\"{:?}\", result);\n Ok(())\n}\n```"] + #[doc = "Generate a CAD model from text.\n\nBecause 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.\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.\nOne thing to note, if you hit the cache, this endpoint will return right away. So you only have to wait if the status is not `Completed` or `Failed`.\n\n**Parameters:**\n\n- `kcl: Option`: If we should output the kcl for the model.\n- `output_format: crate::types::FileExportFormat`: The format the output file should be converted to. (required)\n\n```rust,no_run\nasync fn example_ml_create_text_to_cad() -> anyhow::Result<()> {\n let client = kittycad::Client::new_from_env();\n let result: kittycad::types::TextToCad = client\n .ml()\n .create_text_to_cad(\n Some(false),\n kittycad::types::FileExportFormat::Stl,\n &kittycad::types::TextToCadCreateBody {\n prompt: \"some-string\".to_string(),\n },\n )\n .await?;\n println!(\"{:?}\", result);\n Ok(())\n}\n```"] #[tracing::instrument] pub async fn create_text_to_cad<'a>( &'a self, @@ -245,7 +245,7 @@ impl Ai { } } - #[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.\nThis endpoint requires authentication by any Zoo user. It returns the text-to-CAD models for the authenticated user.\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`: Maximum number of items returned by a single call\n- `no_models: Option`: If we should return the model file contents or just the metadata.\n- `page_token: Option`: Token returned by previous call to retrieve the subsequent page\n- `sort_by: Option`\n\n```rust,no_run\nuse futures_util::TryStreamExt;\nasync fn example_ai_list_text_to_cad_models_for_user_stream() -> anyhow::Result<()> {\n let client = kittycad::Client::new_from_env();\n let mut ai = client.ai();\n let mut stream = ai.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```"] + #[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.\nThis endpoint requires authentication by any Zoo user. It returns the text-to-CAD models for the authenticated user.\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`: Maximum number of items returned by a single call\n- `no_models: Option`: If we should return the model file contents or just the metadata.\n- `page_token: Option`: Token returned by previous call to retrieve the subsequent page\n- `sort_by: Option`\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```"] #[tracing::instrument] pub async fn list_text_to_cad_models_for_user<'a>( &'a self, @@ -296,7 +296,7 @@ impl Ai { } } - #[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.\nThis endpoint requires authentication by any Zoo user. It returns the text-to-CAD models for the authenticated user.\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`: Maximum number of items returned by a single call\n- `no_models: Option`: If we should return the model file contents or just the metadata.\n- `page_token: Option`: Token returned by previous call to retrieve the subsequent page\n- `sort_by: Option`\n\n```rust,no_run\nuse futures_util::TryStreamExt;\nasync fn example_ai_list_text_to_cad_models_for_user_stream() -> anyhow::Result<()> {\n let client = kittycad::Client::new_from_env();\n let mut ai = client.ai();\n let mut stream = ai.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```"] + #[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.\nThis endpoint requires authentication by any Zoo user. It returns the text-to-CAD models for the authenticated user.\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`: Maximum number of items returned by a single call\n- `no_models: Option`: If we should return the model file contents or just the metadata.\n- `page_token: Option`: Token returned by previous call to retrieve the subsequent page\n- `sort_by: Option`\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```"] #[tracing::instrument] #[cfg(not(feature = "js"))] pub fn list_text_to_cad_models_for_user_stream<'a>( @@ -372,9 +372,9 @@ impl Ai { The user must be the owner of the text-to-CAD model.\n\n**Parameters:**\n\n- `id: \ uuid::Uuid`: The id of the model to give feedback to. \ (required)\n\n```rust,no_run\nuse std::str::FromStr;\nasync fn \ - example_ai_get_text_to_cad_model_for_user() -> anyhow::Result<()> {\n let client = \ + example_ml_get_text_to_cad_model_for_user() -> anyhow::Result<()> {\n let client = \ kittycad::Client::new_from_env();\n let result: kittycad::types::TextToCad = \ - client\n .ai()\n \ + client\n .ml()\n \ .get_text_to_cad_model_for_user(uuid::Uuid::from_str(\n \ \"d9797f8d-9ad6-4e08-90d7-2ec17e13471c\",\n )?)\n .await?;\n \ println!(\"{:?}\", result);\n Ok(())\n}\n```"] @@ -416,9 +416,9 @@ impl Ai { in order to give feedback.\n\n**Parameters:**\n\n- `feedback: \ crate::types::AiFeedback`: The feedback. (required)\n- `id: uuid::Uuid`: The id of \ the model to give feedback to. (required)\n\n```rust,no_run\nuse \ - std::str::FromStr;\nasync fn example_ai_create_text_to_cad_model_feedback() -> \ + std::str::FromStr;\nasync fn example_ml_create_text_to_cad_model_feedback() -> \ anyhow::Result<()> {\n let client = kittycad::Client::new_from_env();\n \ - client\n .ai()\n .create_text_to_cad_model_feedback(\n \ + client\n .ml()\n .create_text_to_cad_model_feedback(\n \ kittycad::types::AiFeedback::ThumbsDown,\n \ uuid::Uuid::from_str(\"d9797f8d-9ad6-4e08-90d7-2ec17e13471c\")?,\n )\n \ .await?;\n Ok(())\n}\n```"] diff --git a/kittycad/src/types.rs b/kittycad/src/types.rs index 6554ee5..bb91d02 100644 --- a/kittycad/src/types.rs +++ b/kittycad/src/types.rs @@ -695,7 +695,7 @@ pub struct AiPrompt { pub id: uuid::Uuid, #[doc = "The metadata for the prompt."] #[serde(default, skip_serializing_if = "Option::is_none")] - pub metadata: Option, + pub metadata: Option, #[doc = "The version of the model."] pub model_version: String, #[doc = "The output file. In the case of TextToCad this is a link to a file in a GCP bucket."] @@ -793,6 +793,42 @@ impl tabled::Tabled for AiPrompt { } } +#[doc = "Metadata for an AI prompt."] +#[derive( + serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema, +)] +pub struct AiPromptMetadata { + #[doc = "Code for the model."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, +} + +impl std::fmt::Display for AiPromptMetadata { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> { + write!( + f, + "{}", + serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)? + ) + } +} + +#[cfg(feature = "tabled")] +impl tabled::Tabled for AiPromptMetadata { + const LENGTH: usize = 1; + fn fields(&self) -> Vec> { + vec![if let Some(code) = &self.code { + format!("{:?}", code).into() + } else { + String::new().into() + }] + } + + fn headers() -> Vec> { + vec!["code".into()] + } +} + #[doc = "A single page of results"] #[derive( serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema, diff --git a/openapitor/tests/types/kittycad.rs.gen b/openapitor/tests/types/kittycad.rs.gen index f2e8379..6a10274 100644 --- a/openapitor/tests/types/kittycad.rs.gen +++ b/openapitor/tests/types/kittycad.rs.gen @@ -692,7 +692,7 @@ pub struct AiPrompt { pub id: uuid::Uuid, #[doc = "The metadata for the prompt."] #[serde(default, skip_serializing_if = "Option::is_none")] - pub metadata: Option, + pub metadata: Option, #[doc = "The version of the model."] pub model_version: String, #[doc = "The output file. In the case of TextToCad this is a link to a file in a GCP bucket."] @@ -790,6 +790,42 @@ impl tabled::Tabled for AiPrompt { } } +#[doc = "Metadata for an AI prompt."] +#[derive( + serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema, +)] +pub struct AiPromptMetadata { + #[doc = "Code for the model."] + #[serde(default, skip_serializing_if = "Option::is_none")] + pub code: Option, +} + +impl std::fmt::Display for AiPromptMetadata { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> { + write!( + f, + "{}", + serde_json::to_string_pretty(self).map_err(|_| std::fmt::Error)? + ) + } +} + +#[cfg(feature = "tabled")] +impl tabled::Tabled for AiPromptMetadata { + const LENGTH: usize = 1; + fn fields(&self) -> Vec> { + vec![if let Some(code) = &self.code { + format!("{:?}", code).into() + } else { + String::new().into() + }] + } + + fn headers() -> Vec> { + vec!["code".into()] + } +} + #[doc = "A single page of results"] #[derive( serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema, diff --git a/spec.json b/spec.json index ed3cdc0..65cb23f 100644 --- a/spec.json +++ b/spec.json @@ -197,7 +197,7 @@ "/ai-prompts": { "get": { "tags": [ - "ai", + "ml", "hidden" ], "summary": "List all AI prompts.", @@ -292,7 +292,7 @@ "/ai-prompts/{id}": { "get": { "tags": [ - "ai", + "ml", "hidden" ], "summary": "Get an AI prompt.", @@ -367,7 +367,7 @@ "/ai/kcl/completions": { "post": { "tags": [ - "ai", + "ml", "beta" ], "summary": "Generate code completions for KCL.", @@ -492,7 +492,7 @@ "/ai/text-to-cad/{output_format}": { "post": { "tags": [ - "ai" + "ml" ], "summary": "Generate a CAD model from text.", "description": "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.\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.\nOne thing to note, if you hit the cache, this endpoint will return right away. So you only have to wait if the status is not `Completed` or `Failed`.", @@ -11326,7 +11326,7 @@ "/user/text-to-cad": { "get": { "tags": [ - "ai" + "ml" ], "summary": "List text-to-CAD models you've generated.", "description": "This will always return the STEP file contents as well as the format the user originally requested.\nThis endpoint requires authentication by any Zoo user. It returns the text-to-CAD models for the authenticated user.\nThe text-to-CAD models are returned in order of creation, with the most recently created text-to-CAD models first.", @@ -11429,7 +11429,7 @@ "/user/text-to-cad/{id}": { "get": { "tags": [ - "ai" + "ml" ], "summary": "Get a text-to-CAD response.", "description": "This endpoint requires authentication by any Zoo user. The user must be the owner of the text-to-CAD model.", @@ -11501,7 +11501,7 @@ }, "post": { "tags": [ - "ai" + "ml" ], "summary": "Give feedback to a specific text-to-CAD response.", "description": "This endpoint requires authentication by any Zoo user. The user must be the owner of the text-to-CAD model, in order to give feedback.", @@ -12608,7 +12608,12 @@ }, "metadata": { "nullable": true, - "description": "The metadata for the prompt." + "description": "The metadata for the prompt.", + "allOf": [ + { + "$ref": "#/components/schemas/AiPromptMetadata" + } + ] }, "model_version": { "description": "The version of the model.", @@ -12672,6 +12677,17 @@ "user_id" ] }, + "AiPromptMetadata": { + "description": "Metadata for an AI prompt.", + "type": "object", + "properties": { + "code": { + "nullable": true, + "description": "Code for the model.", + "type": "string" + } + } + }, "AiPromptResultsPage": { "description": "A single page of results", "type": "object", @@ -28166,13 +28182,6 @@ } }, "tags": [ - { - "name": "ai", - "description": "AI uses machine learning to generate CAD models.", - "externalDocs": { - "url": "https://zoo.dev/docs/api/ai" - } - }, { "name": "api-calls", "description": "API calls that have been performed by users can be queried by the API. This is helpful for debugging as well as billing.", @@ -28236,6 +28245,13 @@ "url": "https://zoo.dev/docs/api/meta" } }, + { + "name": "ml", + "description": "Machine learning to generate CAD models and other things.", + "externalDocs": { + "url": "https://zoo.dev/docs/api/ml" + } + }, { "name": "modeling", "description": "Modeling API for updating your 3D files using the Zoo engine.",