From 3ae50a4c9edad19dc88e1977f53a7523fb1725a3 Mon Sep 17 00:00:00 2001 From: "zoo-github-actions-auth[bot]" <155849648+zoo-github-actions-auth[bot]@users.noreply.github.com> Date: Wed, 14 Feb 2024 16:16:40 -0800 Subject: [PATCH] Update api spec (#297) * YOYO NEW API SPEC! * I have generated the library! --------- Co-authored-by: github-actions[bot] --- Cargo.lock | 2 +- kittycad.rs.patch.json | 12 +- kittycad/Cargo.toml | 2 +- kittycad/README.md | 2 +- kittycad/src/ai.rs | 33 +++- kittycad/src/lib.rs | 2 +- kittycad/src/types.rs | 157 ++++++++++++++++ openapitor/tests/types/kittycad.rs.gen | 153 +++++++++++++++ spec.json | 248 ++++++++++++++++++++++++- 9 files changed, 603 insertions(+), 8 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7a343920..c15aea85 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -961,7 +961,7 @@ dependencies = [ [[package]] name = "kittycad" -version = "0.2.51" +version = "0.2.52" dependencies = [ "anyhow", "async-trait", diff --git a/kittycad.rs.patch.json b/kittycad.rs.patch.json index ed3dba51..50e8fbb9 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.2.51\"" + "install": "[dependencies]\nkittycad = \"0.2.52\"" } }, { @@ -47,11 +47,19 @@ "libDocsLink": "https://docs.rs/kittycad/latest/kittycad/ai/struct.Ai.html#method.get_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: kittycad::types::KclCodeCompletionParams {\n language: \"some-string\".to_string(),\n next_indent: 4 as i8,\n prompt_tokens: 4 as i32,\n suffix_tokens: 4 as i32,\n trim_by_indentation: false,\n },\n max_tokens: 4 as i32,\n n: 4 as i16,\n nwo: \"some-string\".to_string(),\n prompt: \"some-string\".to_string(),\n stop: vec![\"some-string\".to_string()],\n stream: false,\n suffix: \"some-string\".to_string(),\n temperature: 3.14 as f64,\n top_p: 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" + } + }, { "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/// This is an alpha endpoint. It will change in the future. The current output is honestly pretty bad. So if you find this endpoint, you get what you pay for, which currently is nothing. But in the future will be made a lot better.\n/// \n/// **Parameters:**\n/// \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 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", + "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/// - `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 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" } }, diff --git a/kittycad/Cargo.toml b/kittycad/Cargo.toml index 9e343a95..a71fdd26 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.2.51" +version = "0.2.52" documentation = "https://docs.rs/kittycad" readme = "README.md" repository = "https://github.com/KittyCAD/kittycad.rs/tree/main/kittycad" diff --git a/kittycad/README.md b/kittycad/README.md index 8d5ed6a8..44a03d8a 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.2.51" +kittycad = "0.2.52" ``` ## Basic example diff --git a/kittycad/src/ai.rs b/kittycad/src/ai.rs index 0f2104cf..b2dace1c 100644 --- a/kittycad/src/ai.rs +++ b/kittycad/src/ai.rs @@ -170,7 +170,38 @@ 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`.\nThis is an alpha endpoint. It will change in the future. The current output is honestly pretty bad. So if you find this endpoint, you get what you pay for, which currently is nothing. But in the future will be made a lot better.\n\n**Parameters:**\n\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 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 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: kittycad::types::KclCodeCompletionParams {\n language: \"some-string\".to_string(),\n next_indent: 4 as i8,\n prompt_tokens: 4 as i32,\n suffix_tokens: 4 as i32,\n trim_by_indentation: false,\n },\n max_tokens: 4 as i32,\n n: 4 as i16,\n nwo: \"some-string\".to_string(),\n prompt: \"some-string\".to_string(),\n stop: vec![\"some-string\".to_string()],\n stream: false,\n suffix: \"some-string\".to_string(),\n temperature: 3.14 as f64,\n top_p: 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, + body: &crate::types::KclCodeCompletionRequest, + ) -> Result { + let mut req = self.client.client.request( + http::Method::POST, + format!("{}/{}", self.client.base_url, "ai/kcl/completions"), + ); + req = req.bearer_auth(&self.client.token); + req = req.json(body); + let resp = req.send().await?; + let status = resp.status(); + if status.is_success() { + let text = resp.text().await.unwrap_or_default(); + serde_json::from_str(&text).map_err(|err| { + crate::types::error::Error::from_serde_error( + format_serde_error::SerdeError::new(text.to_string(), err), + status, + ) + }) + } else { + let text = resp.text().await.unwrap_or_default(); + return Err(crate::types::error::Error::Server { + body: text.to_string(), + status, + }); + } + } + + #[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- `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 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, diff --git a/kittycad/src/lib.rs b/kittycad/src/lib.rs index a607be9d..f4e34a27 100644 --- a/kittycad/src/lib.rs +++ b/kittycad/src/lib.rs @@ -29,7 +29,7 @@ //! //! ```toml //! [dependencies] -//! kittycad = "0.2.51" +//! kittycad = "0.2.52" //! ``` //! //! ## Basic example diff --git a/kittycad/src/types.rs b/kittycad/src/types.rs index 1d3069ed..1e09011c 100644 --- a/kittycad/src/types.rs +++ b/kittycad/src/types.rs @@ -6952,6 +6952,163 @@ impl tabled::Tabled for JetstreamStats { } } +#[doc = "Extra params for the completions."] +#[derive( + serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema, +)] +pub struct KclCodeCompletionParams { + #[doc = "The language of the code."] + pub language: String, + #[doc = "The next indent of the code."] + pub next_indent: i8, + #[doc = "The prompt tokens for the completions."] + pub prompt_tokens: i32, + #[doc = "The suffix tokens for the completions."] + pub suffix_tokens: i32, + #[doc = "If we should trim by indentation."] + pub trim_by_indentation: bool, +} + +impl std::fmt::Display for KclCodeCompletionParams { + 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 KclCodeCompletionParams { + const LENGTH: usize = 5; + fn fields(&self) -> Vec> { + vec![ + self.language.clone().into(), + format!("{:?}", self.next_indent).into(), + format!("{:?}", self.prompt_tokens).into(), + format!("{:?}", self.suffix_tokens).into(), + format!("{:?}", self.trim_by_indentation).into(), + ] + } + + fn headers() -> Vec> { + vec![ + "language".into(), + "next_indent".into(), + "prompt_tokens".into(), + "suffix_tokens".into(), + "trim_by_indentation".into(), + ] + } +} + +#[doc = "A request to generate KCL code completions."] +#[derive( + serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema, +)] +pub struct KclCodeCompletionRequest { + #[doc = "Extra parameters for the completions."] + pub extra: KclCodeCompletionParams, + #[doc = "The maximum number of tokens that can be generated for the completions. The total \ + length of input tokens and generated tokens is limited by the model’s context length."] + pub max_tokens: i32, + #[doc = "How many completion choices to generate for each input message."] + pub n: i16, + #[doc = "New workflows. This does not do anything yet. But we wanted the same API as GitHub \ + Copilot."] + pub nwo: String, + #[doc = "The prompt for the model."] + pub prompt: String, + #[doc = "Up to 4 sequences where the API will stop generating further tokens."] + pub stop: Vec, + #[doc = "If set, partial message deltas will be sent, like in ChatGPT or OpenAPI. Tokens will \ + be sent as data-only server-sent events as they become available, with the stream \ + terminated by a data: [DONE] message."] + pub stream: bool, + #[doc = "The suffix for the model."] + pub suffix: String, + #[doc = "The temperature for the model."] + pub temperature: f64, + #[doc = "The top p for the model."] + pub top_p: f64, +} + +impl std::fmt::Display for KclCodeCompletionRequest { + 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 KclCodeCompletionRequest { + const LENGTH: usize = 10; + fn fields(&self) -> Vec> { + vec![ + format!("{:?}", self.extra).into(), + format!("{:?}", self.max_tokens).into(), + format!("{:?}", self.n).into(), + self.nwo.clone().into(), + self.prompt.clone().into(), + format!("{:?}", self.stop).into(), + format!("{:?}", self.stream).into(), + self.suffix.clone().into(), + format!("{:?}", self.temperature).into(), + format!("{:?}", self.top_p).into(), + ] + } + + fn headers() -> Vec> { + vec![ + "extra".into(), + "max_tokens".into(), + "n".into(), + "nwo".into(), + "prompt".into(), + "stop".into(), + "stream".into(), + "suffix".into(), + "temperature".into(), + "top_p".into(), + ] + } +} + +#[doc = "A response with KCL code completions."] +#[derive( + serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema, +)] +pub struct KclCodeCompletionResponse { + #[doc = "The completions."] + pub completions: Vec, +} + +impl std::fmt::Display for KclCodeCompletionResponse { + 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 KclCodeCompletionResponse { + const LENGTH: usize = 1; + fn fields(&self) -> Vec> { + vec![format!("{:?}", self.completions).into()] + } + + fn headers() -> Vec> { + vec!["completions".into()] + } +} + #[doc = "Leaf node information."] #[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 f11ac327..532664a5 100644 --- a/openapitor/tests/types/kittycad.rs.gen +++ b/openapitor/tests/types/kittycad.rs.gen @@ -6825,6 +6825,159 @@ impl tabled::Tabled for JetstreamStats { } } +#[doc = "Extra params for the completions."] +#[derive( + serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema, +)] +pub struct KclCodeCompletionParams { + #[doc = "The language of the code."] + pub language: String, + #[doc = "The next indent of the code."] + pub next_indent: i8, + #[doc = "The prompt tokens for the completions."] + pub prompt_tokens: i32, + #[doc = "The suffix tokens for the completions."] + pub suffix_tokens: i32, + #[doc = "If we should trim by indentation."] + pub trim_by_indentation: bool, +} + +impl std::fmt::Display for KclCodeCompletionParams { + 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 KclCodeCompletionParams { + const LENGTH: usize = 5; + fn fields(&self) -> Vec> { + vec![ + self.language.clone().into(), + format!("{:?}", self.next_indent).into(), + format!("{:?}", self.prompt_tokens).into(), + format!("{:?}", self.suffix_tokens).into(), + format!("{:?}", self.trim_by_indentation).into(), + ] + } + + fn headers() -> Vec> { + vec![ + "language".into(), + "next_indent".into(), + "prompt_tokens".into(), + "suffix_tokens".into(), + "trim_by_indentation".into(), + ] + } +} + +#[doc = "A request to generate KCL code completions."] +#[derive( + serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema, +)] +pub struct KclCodeCompletionRequest { + #[doc = "Extra parameters for the completions."] + pub extra: KclCodeCompletionParams, + #[doc = "The maximum number of tokens that can be generated for the completions. The total length of input tokens and generated tokens is limited by the model’s context length."] + pub max_tokens: i32, + #[doc = "How many completion choices to generate for each input message."] + pub n: i16, + #[doc = "New workflows. This does not do anything yet. But we wanted the same API as GitHub Copilot."] + pub nwo: String, + #[doc = "The prompt for the model."] + pub prompt: String, + #[doc = "Up to 4 sequences where the API will stop generating further tokens."] + pub stop: Vec, + #[doc = "If set, partial message deltas will be sent, like in ChatGPT or OpenAPI. Tokens will be sent as data-only server-sent events as they become available, with the stream terminated by a data: [DONE] message."] + pub stream: bool, + #[doc = "The suffix for the model."] + pub suffix: String, + #[doc = "The temperature for the model."] + pub temperature: f64, + #[doc = "The top p for the model."] + pub top_p: f64, +} + +impl std::fmt::Display for KclCodeCompletionRequest { + 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 KclCodeCompletionRequest { + const LENGTH: usize = 10; + fn fields(&self) -> Vec> { + vec![ + format!("{:?}", self.extra).into(), + format!("{:?}", self.max_tokens).into(), + format!("{:?}", self.n).into(), + self.nwo.clone().into(), + self.prompt.clone().into(), + format!("{:?}", self.stop).into(), + format!("{:?}", self.stream).into(), + self.suffix.clone().into(), + format!("{:?}", self.temperature).into(), + format!("{:?}", self.top_p).into(), + ] + } + + fn headers() -> Vec> { + vec![ + "extra".into(), + "max_tokens".into(), + "n".into(), + "nwo".into(), + "prompt".into(), + "stop".into(), + "stream".into(), + "suffix".into(), + "temperature".into(), + "top_p".into(), + ] + } +} + +#[doc = "A response with KCL code completions."] +#[derive( + serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema, +)] +pub struct KclCodeCompletionResponse { + #[doc = "The completions."] + pub completions: Vec, +} + +impl std::fmt::Display for KclCodeCompletionResponse { + 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 KclCodeCompletionResponse { + const LENGTH: usize = 1; + fn fields(&self) -> Vec> { + vec![format!("{:?}", self.completions).into()] + } + + fn headers() -> Vec> { + vec!["completions".into()] + } +} + #[doc = "Leaf node information."] #[derive( serde :: Serialize, serde :: Deserialize, PartialEq, Debug, Clone, schemars :: JsonSchema, diff --git a/spec.json b/spec.json index bdb8b529..13485ffc 100644 --- a/spec.json +++ b/spec.json @@ -364,13 +364,138 @@ } } }, + "/ai/kcl/completions": { + "post": { + "tags": [ + "ai", + "beta" + ], + "summary": "Generate code completions for KCL.", + "operationId": "create_kcl_code_completions", + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/KclCodeCompletionRequest" + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "successful creation", + "headers": { + "Access-Control-Allow-Credentials": { + "description": "Access-Control-Allow-Credentials header.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + }, + "Access-Control-Allow-Headers": { + "description": "Access-Control-Allow-Headers header. This is a comma-separated list of headers.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + }, + "Access-Control-Allow-Methods": { + "description": "Access-Control-Allow-Methods header.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + }, + "Access-Control-Allow-Origin": { + "description": "Access-Control-Allow-Origin header.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + } + }, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/KclCodeCompletionResponse" + } + } + } + }, + "4XX": { + "$ref": "#/components/responses/Error" + }, + "5XX": { + "$ref": "#/components/responses/Error" + } + } + }, + "options": { + "tags": [ + "hidden" + ], + "summary": "OPTIONS endpoint.", + "description": "This is necessary for some preflight requests, specifically POST, PUT, and DELETE.", + "operationId": "options_kcl_code_completions", + "responses": { + "204": { + "description": "successful operation, no content", + "headers": { + "Access-Control-Allow-Credentials": { + "description": "Access-Control-Allow-Credentials header.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + }, + "Access-Control-Allow-Headers": { + "description": "Access-Control-Allow-Headers header. This is a comma-separated list of headers.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + }, + "Access-Control-Allow-Methods": { + "description": "Access-Control-Allow-Methods header.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + }, + "Access-Control-Allow-Origin": { + "description": "Access-Control-Allow-Origin header.", + "style": "simple", + "required": true, + "schema": { + "type": "string" + } + } + } + }, + "4XX": { + "$ref": "#/components/responses/Error" + }, + "5XX": { + "$ref": "#/components/responses/Error" + } + } + } + }, "/ai/text-to-cad/{output_format}": { "post": { "tags": [ "ai" ], "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`.\nThis is an alpha endpoint. It will change in the future. The current output is honestly pretty bad. So if you find this endpoint, you get what you pay for, which currently is nothing. But in the future will be made a lot better.", + "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`.", "operationId": "create_text_to_cad", "parameters": [ { @@ -15032,6 +15157,127 @@ } } }, + "KclCodeCompletionParams": { + "description": "Extra params for the completions.", + "type": "object", + "properties": { + "language": { + "description": "The language of the code.", + "type": "string" + }, + "next_indent": { + "description": "The next indent of the code.", + "type": "integer", + "format": "int8" + }, + "prompt_tokens": { + "description": "The prompt tokens for the completions.", + "type": "integer", + "format": "int32" + }, + "suffix_tokens": { + "description": "The suffix tokens for the completions.", + "type": "integer", + "format": "int32" + }, + "trim_by_indentation": { + "description": "If we should trim by indentation.", + "type": "boolean" + } + }, + "required": [ + "language", + "next_indent", + "prompt_tokens", + "suffix_tokens", + "trim_by_indentation" + ] + }, + "KclCodeCompletionRequest": { + "description": "A request to generate KCL code completions.", + "type": "object", + "properties": { + "extra": { + "description": "Extra parameters for the completions.", + "allOf": [ + { + "$ref": "#/components/schemas/KclCodeCompletionParams" + } + ] + }, + "max_tokens": { + "description": "The maximum number of tokens that can be generated for the completions. The total length of input tokens and generated tokens is limited by the model’s context length.", + "type": "integer", + "format": "int32" + }, + "n": { + "description": "How many completion choices to generate for each input message.", + "type": "integer", + "format": "int16" + }, + "nwo": { + "description": "New workflows. This does not do anything yet. But we wanted the same API as GitHub Copilot.", + "type": "string" + }, + "prompt": { + "description": "The prompt for the model.", + "type": "string" + }, + "stop": { + "description": "Up to 4 sequences where the API will stop generating further tokens.", + "type": "array", + "items": { + "type": "string" + } + }, + "stream": { + "description": "If set, partial message deltas will be sent, like in ChatGPT or OpenAPI. Tokens will be sent as data-only server-sent events as they become available, with the stream terminated by a data: [DONE] message.", + "type": "boolean" + }, + "suffix": { + "description": "The suffix for the model.", + "type": "string" + }, + "temperature": { + "description": "The temperature for the model.", + "type": "number", + "format": "float" + }, + "top_p": { + "description": "The top p for the model.", + "type": "number", + "format": "float" + } + }, + "required": [ + "extra", + "max_tokens", + "n", + "nwo", + "prompt", + "stop", + "stream", + "suffix", + "temperature", + "top_p" + ] + }, + "KclCodeCompletionResponse": { + "description": "A response with KCL code completions.", + "type": "object", + "properties": { + "completions": { + "description": "The completions.", + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ + "completions" + ] + }, "LeafNode": { "description": "Leaf node information.", "type": "object",