From 54d2cf1dd1bd2435dabaa5eaf0c0d8f6f0ddaccf Mon Sep 17 00:00:00 2001 From: Ricky Robinett Date: Tue, 18 Mar 2025 14:09:28 -0400 Subject: [PATCH 01/12] proposal for new ai side nav --- public/_redirects | 41 +++++++++++++++++++ src/content/docs/workers-ai/agents.mdx | 14 +++++++ src/content/docs/workers-ai/changelog.mdx | 2 +- .../docs/workers-ai/get-started/index.mdx | 2 +- .../demos-architectures/index.mdx} | 6 +-- src/content/docs/workers-ai/guides/index.mdx | 2 +- ...ld-a-retrieval-augmented-generation-ai.mdx | 0 ...oice-notes-app-with-auto-transcription.mdx | 0 .../build-ai-interview-practice-tool.mdx | 0 ...generation-using-deepseek-coder-models.mdx | 0 ...ers-ai-models-using-a-jupyter-notebook.mdx | 0 .../fine-tune-models-with-autotrain.mdx | 0 ...choose-the-right-text-generation-model.mdx | 0 .../image-generator-flux-newmodels.mdx | 0 .../image-generator-flux.mdx | 0 .../image-generator-store-and-catalog.mdx | 0 .../image-generation-playground/index.mdx | 0 .../{ => guides}/tutorials/index.mdx | 2 +- .../tutorials/llama-vision-tutorial.mdx | 0 .../using-bigquery-with-workers-ai.mdx | 0 src/content/docs/workers-ai/models/index.mdx | 2 +- .../errors.mdx} | 2 + .../workers-ai/{ => platform}/glossary.mdx | 2 +- .../workers-ai/{ => platform}/privacy.mdx | 2 +- src/content/docs/workers-ai/playground.mdx | 2 +- .../{ => tools}/fine-tunes/index.mdx | 2 +- .../{ => tools}/fine-tunes/loras.mdx | 0 .../{ => tools}/fine-tunes/public-loras.mdx | 0 .../embedded/api-reference.mdx | 0 .../embedded/examples/fetch.mdx | 0 .../embedded/examples/index.mdx | 0 .../function-calling/embedded/examples/kv.mdx | 0 .../embedded/examples/openapi.mdx | 0 .../function-calling/embedded/get-started.mdx | 0 .../function-calling/embedded/index.mdx | 0 .../embedded/troubleshooting.mdx | 0 .../{ => tools}/function-calling/index.mdx | 2 +- .../function-calling/traditional.mdx | 0 src/content/docs/workers-ai/tools/index.mdx | 12 ++++++ .../{ => tools}/json-mode/index.mdx | 2 +- .../prompting/index.mdx} | 5 ++- 41 files changed, 86 insertions(+), 16 deletions(-) create mode 100644 src/content/docs/workers-ai/agents.mdx rename src/content/docs/workers-ai/{demos.mdx => guides/demos-architectures/index.mdx} (93%) rename src/content/docs/workers-ai/{ => guides}/tutorials/build-a-retrieval-augmented-generation-ai.mdx (100%) rename src/content/docs/workers-ai/{ => guides}/tutorials/build-a-voice-notes-app-with-auto-transcription.mdx (100%) rename src/content/docs/workers-ai/{ => guides}/tutorials/build-ai-interview-practice-tool.mdx (100%) rename src/content/docs/workers-ai/{ => guides}/tutorials/explore-code-generation-using-deepseek-coder-models.mdx (100%) rename src/content/docs/workers-ai/{ => guides}/tutorials/explore-workers-ai-models-using-a-jupyter-notebook.mdx (100%) rename src/content/docs/workers-ai/{ => guides}/tutorials/fine-tune-models-with-autotrain.mdx (100%) rename src/content/docs/workers-ai/{ => guides}/tutorials/how-to-choose-the-right-text-generation-model.mdx (100%) rename src/content/docs/workers-ai/{ => guides}/tutorials/image-generation-playground/image-generator-flux-newmodels.mdx (100%) rename src/content/docs/workers-ai/{ => guides}/tutorials/image-generation-playground/image-generator-flux.mdx (100%) rename src/content/docs/workers-ai/{ => guides}/tutorials/image-generation-playground/image-generator-store-and-catalog.mdx (100%) rename src/content/docs/workers-ai/{ => guides}/tutorials/image-generation-playground/index.mdx (100%) rename src/content/docs/workers-ai/{ => guides}/tutorials/index.mdx (97%) rename src/content/docs/workers-ai/{ => guides}/tutorials/llama-vision-tutorial.mdx (100%) rename src/content/docs/workers-ai/{ => guides}/tutorials/using-bigquery-with-workers-ai.mdx (100%) rename src/content/docs/workers-ai/{workers-ai-errors.mdx => platform/errors.mdx} (99%) rename src/content/docs/workers-ai/{ => platform}/glossary.mdx (94%) rename src/content/docs/workers-ai/{ => platform}/privacy.mdx (99%) rename src/content/docs/workers-ai/{ => tools}/fine-tunes/index.mdx (99%) rename src/content/docs/workers-ai/{ => tools}/fine-tunes/loras.mdx (100%) rename src/content/docs/workers-ai/{ => tools}/fine-tunes/public-loras.mdx (100%) rename src/content/docs/workers-ai/{ => tools}/function-calling/embedded/api-reference.mdx (100%) rename src/content/docs/workers-ai/{ => tools}/function-calling/embedded/examples/fetch.mdx (100%) rename src/content/docs/workers-ai/{ => tools}/function-calling/embedded/examples/index.mdx (100%) rename src/content/docs/workers-ai/{ => tools}/function-calling/embedded/examples/kv.mdx (100%) rename src/content/docs/workers-ai/{ => tools}/function-calling/embedded/examples/openapi.mdx (100%) rename src/content/docs/workers-ai/{ => tools}/function-calling/embedded/get-started.mdx (100%) rename src/content/docs/workers-ai/{ => tools}/function-calling/embedded/index.mdx (100%) rename src/content/docs/workers-ai/{ => tools}/function-calling/embedded/troubleshooting.mdx (100%) rename src/content/docs/workers-ai/{ => tools}/function-calling/index.mdx (99%) rename src/content/docs/workers-ai/{ => tools}/function-calling/traditional.mdx (100%) create mode 100644 src/content/docs/workers-ai/tools/index.mdx rename src/content/docs/workers-ai/{ => tools}/json-mode/index.mdx (99%) rename src/content/docs/workers-ai/{guides/prompting.mdx => tools/prompting/index.mdx} (98%) diff --git a/public/_redirects b/public/_redirects index 9f76cd33e2d172..740230209d39e2 100644 --- a/public/_redirects +++ b/public/_redirects @@ -1666,6 +1666,47 @@ /workers/observability/baselime-integration/ /workers/observability/integrations/baselime-integration/ 301 /workers-ai/tutorials/image-generator-flux/ /workers-ai/tutorials/image-generation-playground/ 301 +# Workers AI reorganization redirects +# Function calling +/workers-ai/function-calling /workers-ai/tools/function-calling/ 301 +/workers-ai/function-calling/ /workers-ai/tools/function-calling/ 301 +/workers-ai/function-calling/embedded/ /workers-ai/tools/function-calling/embedded/ 301 +/workers-ai/function-calling/embedded/* /workers-ai/tools/function-calling/embedded/:splat 301 +/workers-ai/function-calling/traditional/ /workers-ai/tools/function-calling/traditional/ 301 +/workers-ai/function-calling/index/ /workers-ai/tools/function-calling/ 301 +/workers-ai/function-calling/* /workers-ai/tools/function-calling/:splat 301 + +# JSON Mode +/workers-ai/json-mode /workers-ai/tools/json-mode/ 301 +/workers-ai/json-mode/ /workers-ai/tools/json-mode/ 301 +/workers-ai/json-mode/* /workers-ai/tools/json-mode/:splat 301 + +# Fine-tunes +/workers-ai/fine-tunes /workers-ai/tools/fine-tunes/ 301 +/workers-ai/fine-tunes/ /workers-ai/tools/fine-tunes/ 301 +/workers-ai/fine-tunes/* /workers-ai/tools/fine-tunes/:splat 301 + +# Prompting +/workers-ai/guides/prompting /workers-ai/tools/prompting/ 301 +/workers-ai/guides/prompting/ /workers-ai/tools/prompting/ 301 +/workers-ai/guides/prompting/* /workers-ai/tools/prompting/:splat 301 + +# Platform section +/workers-ai/privacy /workers-ai/platform/privacy/ 301 +/workers-ai/privacy/ /workers-ai/platform/privacy/ 301 +/workers-ai/glossary /workers-ai/platform/glossary/ 301 +/workers-ai/glossary/ /workers-ai/platform/glossary/ 301 +/workers-ai/workers-ai-errors /workers-ai/platform/errors/ 301 +/workers-ai/workers-ai-errors/ /workers-ai/platform/errors/ 301 + +# Guides section +/workers-ai/demos /workers-ai/guides/demos-architectures/ 301 +/workers-ai/demos/ /workers-ai/guides/demos-architectures/ 301 +/workers-ai/demos/* /workers-ai/guides/demos-architectures/:splat 301 +/workers-ai/tutorials /workers-ai/guides/tutorials/ 301 +/workers-ai/tutorials/ /workers-ai/guides/tutorials/ 301 +/workers-ai/tutorials/* /workers-ai/guides/tutorials/:splat 301 + # workflows /workflows/reference/storage-options/ /workers/platform/storage-options/ 301 diff --git a/src/content/docs/workers-ai/agents.mdx b/src/content/docs/workers-ai/agents.mdx new file mode 100644 index 00000000000000..de3629d3a2ecd4 --- /dev/null +++ b/src/content/docs/workers-ai/agents.mdx @@ -0,0 +1,14 @@ +--- +title: Agents +pcx_content_type: navigation +external_link: /agents/ +sidebar: + order: 7 +--- + +import { LinkButton } from "~/components" + +
+

Build AI assistants that can perform complex tasks on behalf of your users using Cloudflare Workers AI and Agents.

+ Go to Agents documentation +
\ No newline at end of file diff --git a/src/content/docs/workers-ai/changelog.mdx b/src/content/docs/workers-ai/changelog.mdx index 314c69bcd1c811..ad4c57057fb6e7 100644 --- a/src/content/docs/workers-ai/changelog.mdx +++ b/src/content/docs/workers-ai/changelog.mdx @@ -4,7 +4,7 @@ title: Changelog release_notes_file_name: - workers-ai sidebar: - order: 8 + order: 9 head: [] description: Review recent changes to Cloudflare Workers AI. --- diff --git a/src/content/docs/workers-ai/get-started/index.mdx b/src/content/docs/workers-ai/get-started/index.mdx index 8129e2095fa63e..74dc0ffc9639e1 100644 --- a/src/content/docs/workers-ai/get-started/index.mdx +++ b/src/content/docs/workers-ai/get-started/index.mdx @@ -2,7 +2,7 @@ pcx_content_type: navigation title: Getting started sidebar: - order: 2 + order: 1 --- diff --git a/src/content/docs/workers-ai/demos.mdx b/src/content/docs/workers-ai/guides/demos-architectures/index.mdx similarity index 93% rename from src/content/docs/workers-ai/demos.mdx rename to src/content/docs/workers-ai/guides/demos-architectures/index.mdx index 3ea8f9a2fd9af2..979857d0025dfc 100644 --- a/src/content/docs/workers-ai/demos.mdx +++ b/src/content/docs/workers-ai/guides/demos-architectures/index.mdx @@ -1,9 +1,9 @@ --- -pcx_content_type: navigation +pcx_content_type: concept title: Demos and architectures +hideChildren: true sidebar: - order: 6 - + order: 2 --- import { ExternalResources, GlossaryTooltip, ResourcesBySelector } from "~/components" diff --git a/src/content/docs/workers-ai/guides/index.mdx b/src/content/docs/workers-ai/guides/index.mdx index 0591121e3afbc2..247bf5e5b64b77 100644 --- a/src/content/docs/workers-ai/guides/index.mdx +++ b/src/content/docs/workers-ai/guides/index.mdx @@ -4,7 +4,7 @@ pcx_content_type: navigation sidebar: group: hideIndex: true - order: 2 + order: 5 --- import { DirectoryListing } from "~/components"; diff --git a/src/content/docs/workers-ai/tutorials/build-a-retrieval-augmented-generation-ai.mdx b/src/content/docs/workers-ai/guides/tutorials/build-a-retrieval-augmented-generation-ai.mdx similarity index 100% rename from src/content/docs/workers-ai/tutorials/build-a-retrieval-augmented-generation-ai.mdx rename to src/content/docs/workers-ai/guides/tutorials/build-a-retrieval-augmented-generation-ai.mdx diff --git a/src/content/docs/workers-ai/tutorials/build-a-voice-notes-app-with-auto-transcription.mdx b/src/content/docs/workers-ai/guides/tutorials/build-a-voice-notes-app-with-auto-transcription.mdx similarity index 100% rename from src/content/docs/workers-ai/tutorials/build-a-voice-notes-app-with-auto-transcription.mdx rename to src/content/docs/workers-ai/guides/tutorials/build-a-voice-notes-app-with-auto-transcription.mdx diff --git a/src/content/docs/workers-ai/tutorials/build-ai-interview-practice-tool.mdx b/src/content/docs/workers-ai/guides/tutorials/build-ai-interview-practice-tool.mdx similarity index 100% rename from src/content/docs/workers-ai/tutorials/build-ai-interview-practice-tool.mdx rename to src/content/docs/workers-ai/guides/tutorials/build-ai-interview-practice-tool.mdx diff --git a/src/content/docs/workers-ai/tutorials/explore-code-generation-using-deepseek-coder-models.mdx b/src/content/docs/workers-ai/guides/tutorials/explore-code-generation-using-deepseek-coder-models.mdx similarity index 100% rename from src/content/docs/workers-ai/tutorials/explore-code-generation-using-deepseek-coder-models.mdx rename to src/content/docs/workers-ai/guides/tutorials/explore-code-generation-using-deepseek-coder-models.mdx diff --git a/src/content/docs/workers-ai/tutorials/explore-workers-ai-models-using-a-jupyter-notebook.mdx b/src/content/docs/workers-ai/guides/tutorials/explore-workers-ai-models-using-a-jupyter-notebook.mdx similarity index 100% rename from src/content/docs/workers-ai/tutorials/explore-workers-ai-models-using-a-jupyter-notebook.mdx rename to src/content/docs/workers-ai/guides/tutorials/explore-workers-ai-models-using-a-jupyter-notebook.mdx diff --git a/src/content/docs/workers-ai/tutorials/fine-tune-models-with-autotrain.mdx b/src/content/docs/workers-ai/guides/tutorials/fine-tune-models-with-autotrain.mdx similarity index 100% rename from src/content/docs/workers-ai/tutorials/fine-tune-models-with-autotrain.mdx rename to src/content/docs/workers-ai/guides/tutorials/fine-tune-models-with-autotrain.mdx diff --git a/src/content/docs/workers-ai/tutorials/how-to-choose-the-right-text-generation-model.mdx b/src/content/docs/workers-ai/guides/tutorials/how-to-choose-the-right-text-generation-model.mdx similarity index 100% rename from src/content/docs/workers-ai/tutorials/how-to-choose-the-right-text-generation-model.mdx rename to src/content/docs/workers-ai/guides/tutorials/how-to-choose-the-right-text-generation-model.mdx diff --git a/src/content/docs/workers-ai/tutorials/image-generation-playground/image-generator-flux-newmodels.mdx b/src/content/docs/workers-ai/guides/tutorials/image-generation-playground/image-generator-flux-newmodels.mdx similarity index 100% rename from src/content/docs/workers-ai/tutorials/image-generation-playground/image-generator-flux-newmodels.mdx rename to src/content/docs/workers-ai/guides/tutorials/image-generation-playground/image-generator-flux-newmodels.mdx diff --git a/src/content/docs/workers-ai/tutorials/image-generation-playground/image-generator-flux.mdx b/src/content/docs/workers-ai/guides/tutorials/image-generation-playground/image-generator-flux.mdx similarity index 100% rename from src/content/docs/workers-ai/tutorials/image-generation-playground/image-generator-flux.mdx rename to src/content/docs/workers-ai/guides/tutorials/image-generation-playground/image-generator-flux.mdx diff --git a/src/content/docs/workers-ai/tutorials/image-generation-playground/image-generator-store-and-catalog.mdx b/src/content/docs/workers-ai/guides/tutorials/image-generation-playground/image-generator-store-and-catalog.mdx similarity index 100% rename from src/content/docs/workers-ai/tutorials/image-generation-playground/image-generator-store-and-catalog.mdx rename to src/content/docs/workers-ai/guides/tutorials/image-generation-playground/image-generator-store-and-catalog.mdx diff --git a/src/content/docs/workers-ai/tutorials/image-generation-playground/index.mdx b/src/content/docs/workers-ai/guides/tutorials/image-generation-playground/index.mdx similarity index 100% rename from src/content/docs/workers-ai/tutorials/image-generation-playground/index.mdx rename to src/content/docs/workers-ai/guides/tutorials/image-generation-playground/index.mdx diff --git a/src/content/docs/workers-ai/tutorials/index.mdx b/src/content/docs/workers-ai/guides/tutorials/index.mdx similarity index 97% rename from src/content/docs/workers-ai/tutorials/index.mdx rename to src/content/docs/workers-ai/guides/tutorials/index.mdx index 50376b9ddb723a..5b7f13e5975e53 100644 --- a/src/content/docs/workers-ai/tutorials/index.mdx +++ b/src/content/docs/workers-ai/guides/tutorials/index.mdx @@ -3,7 +3,7 @@ pcx_content_type: navigation title: Tutorials hideChildren: true sidebar: - order: 5 + order: 3 --- import { GlossaryTooltip, ListTutorials } from "~/components"; diff --git a/src/content/docs/workers-ai/tutorials/llama-vision-tutorial.mdx b/src/content/docs/workers-ai/guides/tutorials/llama-vision-tutorial.mdx similarity index 100% rename from src/content/docs/workers-ai/tutorials/llama-vision-tutorial.mdx rename to src/content/docs/workers-ai/guides/tutorials/llama-vision-tutorial.mdx diff --git a/src/content/docs/workers-ai/tutorials/using-bigquery-with-workers-ai.mdx b/src/content/docs/workers-ai/guides/tutorials/using-bigquery-with-workers-ai.mdx similarity index 100% rename from src/content/docs/workers-ai/tutorials/using-bigquery-with-workers-ai.mdx rename to src/content/docs/workers-ai/guides/tutorials/using-bigquery-with-workers-ai.mdx diff --git a/src/content/docs/workers-ai/models/index.mdx b/src/content/docs/workers-ai/models/index.mdx index 222a0e5c7ac090..b86e1455bf07da 100644 --- a/src/content/docs/workers-ai/models/index.mdx +++ b/src/content/docs/workers-ai/models/index.mdx @@ -3,7 +3,7 @@ pcx_content_type: navigation title: Models hideChildren: true sidebar: - order: 3 + order: 2 --- import ModelCatalog from "~/pages/workers-ai/models/index.astro"; diff --git a/src/content/docs/workers-ai/workers-ai-errors.mdx b/src/content/docs/workers-ai/platform/errors.mdx similarity index 99% rename from src/content/docs/workers-ai/workers-ai-errors.mdx rename to src/content/docs/workers-ai/platform/errors.mdx index d0aa9070e471b4..78cc30b030394f 100644 --- a/src/content/docs/workers-ai/workers-ai-errors.mdx +++ b/src/content/docs/workers-ai/platform/errors.mdx @@ -1,6 +1,8 @@ --- title: Errors pcx_content_type: concept +sidebar: + order: 5 --- Below is a list of Workers AI errors. diff --git a/src/content/docs/workers-ai/glossary.mdx b/src/content/docs/workers-ai/platform/glossary.mdx similarity index 94% rename from src/content/docs/workers-ai/glossary.mdx rename to src/content/docs/workers-ai/platform/glossary.mdx index 667037e0f889a9..ef19bfb185d06b 100644 --- a/src/content/docs/workers-ai/glossary.mdx +++ b/src/content/docs/workers-ai/platform/glossary.mdx @@ -2,7 +2,7 @@ title: Glossary pcx_content_type: glossary sidebar: - order: 19 + order: 4 --- import { Glossary } from "~/components"; diff --git a/src/content/docs/workers-ai/privacy.mdx b/src/content/docs/workers-ai/platform/privacy.mdx similarity index 99% rename from src/content/docs/workers-ai/privacy.mdx rename to src/content/docs/workers-ai/platform/privacy.mdx index 5f591334458b59..bac97700b7adda 100644 --- a/src/content/docs/workers-ai/privacy.mdx +++ b/src/content/docs/workers-ai/platform/privacy.mdx @@ -2,7 +2,7 @@ title: Privacy pcx_content_type: reference sidebar: - order: 10 + order: 2 head: - tag: title content: Your Data and Workers AI diff --git a/src/content/docs/workers-ai/playground.mdx b/src/content/docs/workers-ai/playground.mdx index e01eb050c7005a..f82b45050bce2b 100644 --- a/src/content/docs/workers-ai/playground.mdx +++ b/src/content/docs/workers-ai/playground.mdx @@ -3,6 +3,6 @@ pcx_content_type: navigation title: Playground external_link: https://playground.ai.cloudflare.com sidebar: - order: 2 + order: 8 --- diff --git a/src/content/docs/workers-ai/fine-tunes/index.mdx b/src/content/docs/workers-ai/tools/fine-tunes/index.mdx similarity index 99% rename from src/content/docs/workers-ai/fine-tunes/index.mdx rename to src/content/docs/workers-ai/tools/fine-tunes/index.mdx index fd32972a5801c9..ee433dc98e5fc2 100644 --- a/src/content/docs/workers-ai/fine-tunes/index.mdx +++ b/src/content/docs/workers-ai/tools/fine-tunes/index.mdx @@ -2,7 +2,7 @@ pcx_content_type: navigation title: Fine-tunes sidebar: - order: 5 + order: 3 --- diff --git a/src/content/docs/workers-ai/fine-tunes/loras.mdx b/src/content/docs/workers-ai/tools/fine-tunes/loras.mdx similarity index 100% rename from src/content/docs/workers-ai/fine-tunes/loras.mdx rename to src/content/docs/workers-ai/tools/fine-tunes/loras.mdx diff --git a/src/content/docs/workers-ai/fine-tunes/public-loras.mdx b/src/content/docs/workers-ai/tools/fine-tunes/public-loras.mdx similarity index 100% rename from src/content/docs/workers-ai/fine-tunes/public-loras.mdx rename to src/content/docs/workers-ai/tools/fine-tunes/public-loras.mdx diff --git a/src/content/docs/workers-ai/function-calling/embedded/api-reference.mdx b/src/content/docs/workers-ai/tools/function-calling/embedded/api-reference.mdx similarity index 100% rename from src/content/docs/workers-ai/function-calling/embedded/api-reference.mdx rename to src/content/docs/workers-ai/tools/function-calling/embedded/api-reference.mdx diff --git a/src/content/docs/workers-ai/function-calling/embedded/examples/fetch.mdx b/src/content/docs/workers-ai/tools/function-calling/embedded/examples/fetch.mdx similarity index 100% rename from src/content/docs/workers-ai/function-calling/embedded/examples/fetch.mdx rename to src/content/docs/workers-ai/tools/function-calling/embedded/examples/fetch.mdx diff --git a/src/content/docs/workers-ai/function-calling/embedded/examples/index.mdx b/src/content/docs/workers-ai/tools/function-calling/embedded/examples/index.mdx similarity index 100% rename from src/content/docs/workers-ai/function-calling/embedded/examples/index.mdx rename to src/content/docs/workers-ai/tools/function-calling/embedded/examples/index.mdx diff --git a/src/content/docs/workers-ai/function-calling/embedded/examples/kv.mdx b/src/content/docs/workers-ai/tools/function-calling/embedded/examples/kv.mdx similarity index 100% rename from src/content/docs/workers-ai/function-calling/embedded/examples/kv.mdx rename to src/content/docs/workers-ai/tools/function-calling/embedded/examples/kv.mdx diff --git a/src/content/docs/workers-ai/function-calling/embedded/examples/openapi.mdx b/src/content/docs/workers-ai/tools/function-calling/embedded/examples/openapi.mdx similarity index 100% rename from src/content/docs/workers-ai/function-calling/embedded/examples/openapi.mdx rename to src/content/docs/workers-ai/tools/function-calling/embedded/examples/openapi.mdx diff --git a/src/content/docs/workers-ai/function-calling/embedded/get-started.mdx b/src/content/docs/workers-ai/tools/function-calling/embedded/get-started.mdx similarity index 100% rename from src/content/docs/workers-ai/function-calling/embedded/get-started.mdx rename to src/content/docs/workers-ai/tools/function-calling/embedded/get-started.mdx diff --git a/src/content/docs/workers-ai/function-calling/embedded/index.mdx b/src/content/docs/workers-ai/tools/function-calling/embedded/index.mdx similarity index 100% rename from src/content/docs/workers-ai/function-calling/embedded/index.mdx rename to src/content/docs/workers-ai/tools/function-calling/embedded/index.mdx diff --git a/src/content/docs/workers-ai/function-calling/embedded/troubleshooting.mdx b/src/content/docs/workers-ai/tools/function-calling/embedded/troubleshooting.mdx similarity index 100% rename from src/content/docs/workers-ai/function-calling/embedded/troubleshooting.mdx rename to src/content/docs/workers-ai/tools/function-calling/embedded/troubleshooting.mdx diff --git a/src/content/docs/workers-ai/function-calling/index.mdx b/src/content/docs/workers-ai/tools/function-calling/index.mdx similarity index 99% rename from src/content/docs/workers-ai/function-calling/index.mdx rename to src/content/docs/workers-ai/tools/function-calling/index.mdx index f730bff881fa67..dba495331ca59f 100644 --- a/src/content/docs/workers-ai/function-calling/index.mdx +++ b/src/content/docs/workers-ai/tools/function-calling/index.mdx @@ -2,7 +2,7 @@ pcx_content_type: navigation title: Function calling sidebar: - order: 5 + order: 1 badge: text: Beta --- diff --git a/src/content/docs/workers-ai/function-calling/traditional.mdx b/src/content/docs/workers-ai/tools/function-calling/traditional.mdx similarity index 100% rename from src/content/docs/workers-ai/function-calling/traditional.mdx rename to src/content/docs/workers-ai/tools/function-calling/traditional.mdx diff --git a/src/content/docs/workers-ai/tools/index.mdx b/src/content/docs/workers-ai/tools/index.mdx new file mode 100644 index 00000000000000..503117de9202c3 --- /dev/null +++ b/src/content/docs/workers-ai/tools/index.mdx @@ -0,0 +1,12 @@ +--- +pcx_content_type: navigation +title: Tools +sidebar: + group: + hideIndex: true + order: 4 +--- + +import { DirectoryListing } from "~/components"; + + \ No newline at end of file diff --git a/src/content/docs/workers-ai/json-mode/index.mdx b/src/content/docs/workers-ai/tools/json-mode/index.mdx similarity index 99% rename from src/content/docs/workers-ai/json-mode/index.mdx rename to src/content/docs/workers-ai/tools/json-mode/index.mdx index 452fb278aeaf26..f496af33345d58 100644 --- a/src/content/docs/workers-ai/json-mode/index.mdx +++ b/src/content/docs/workers-ai/tools/json-mode/index.mdx @@ -3,7 +3,7 @@ pcx_content_type: navigation title: JSON Mode hideChildren: true sidebar: - order: 5 + order: 2 --- import { Code } from "~/components"; diff --git a/src/content/docs/workers-ai/guides/prompting.mdx b/src/content/docs/workers-ai/tools/prompting/index.mdx similarity index 98% rename from src/content/docs/workers-ai/guides/prompting.mdx rename to src/content/docs/workers-ai/tools/prompting/index.mdx index a8461b7619d392..0afeaafab85aaa 100644 --- a/src/content/docs/workers-ai/guides/prompting.mdx +++ b/src/content/docs/workers-ai/tools/prompting/index.mdx @@ -1,8 +1,9 @@ --- -pcx_content_type: navigation +pcx_content_type: concept title: Prompting +hideChildren: true sidebar: - order: 2 + order: 4 --- import { Code } from "~/components"; From 8df5a3a69047707daf1958d2a86cd4b4eec831d9 Mon Sep 17 00:00:00 2001 From: Craig Dennis Date: Tue, 1 Apr 2025 15:46:52 -0700 Subject: [PATCH 02/12] Renames to Workers for Nav per Michelle request --- src/content/docs/workers-ai/get-started/workers-wrangler.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/content/docs/workers-ai/get-started/workers-wrangler.mdx b/src/content/docs/workers-ai/get-started/workers-wrangler.mdx index d12b191a22ec61..8fb75046cb70f6 100644 --- a/src/content/docs/workers-ai/get-started/workers-wrangler.mdx +++ b/src/content/docs/workers-ai/get-started/workers-wrangler.mdx @@ -1,11 +1,11 @@ --- -title: CLI +title: Workers pcx_content_type: get-started sidebar: order: 1 head: - tag: title - content: Get started - CLI + content: Get started - Workers description: Deploy your first Cloudflare Workers AI project using the CLI. --- From 703b6b81ecb61eac5a9f36aa6bb92f8638597399 Mon Sep 17 00:00:00 2001 From: Craig Dennis Date: Tue, 1 Apr 2025 16:27:22 -0700 Subject: [PATCH 03/12] Moves tools to features and removes dynamic where unnecessary --- public/_redirects | 29 ++++++++----------- .../{tools => features}/fine-tunes/index.mdx | 0 .../{tools => features}/fine-tunes/loras.mdx | 0 .../fine-tunes/public-loras.mdx | 0 .../embedded/api-reference.mdx | 0 .../embedded/examples/fetch.mdx | 0 .../embedded/examples/index.mdx | 0 .../function-calling/embedded/examples/kv.mdx | 0 .../embedded/examples/openapi.mdx | 0 .../function-calling/embedded/get-started.mdx | 0 .../function-calling/embedded/index.mdx | 0 .../embedded/troubleshooting.mdx | 0 .../function-calling/index.mdx | 0 .../function-calling/traditional.mdx | 0 .../workers-ai/{tools => features}/index.mdx | 0 .../{tools => features}/json-mode/index.mdx | 0 .../{tools => features}/prompting/index.mdx | 0 17 files changed, 12 insertions(+), 17 deletions(-) rename src/content/docs/workers-ai/{tools => features}/fine-tunes/index.mdx (100%) rename src/content/docs/workers-ai/{tools => features}/fine-tunes/loras.mdx (100%) rename src/content/docs/workers-ai/{tools => features}/fine-tunes/public-loras.mdx (100%) rename src/content/docs/workers-ai/{tools => features}/function-calling/embedded/api-reference.mdx (100%) rename src/content/docs/workers-ai/{tools => features}/function-calling/embedded/examples/fetch.mdx (100%) rename src/content/docs/workers-ai/{tools => features}/function-calling/embedded/examples/index.mdx (100%) rename src/content/docs/workers-ai/{tools => features}/function-calling/embedded/examples/kv.mdx (100%) rename src/content/docs/workers-ai/{tools => features}/function-calling/embedded/examples/openapi.mdx (100%) rename src/content/docs/workers-ai/{tools => features}/function-calling/embedded/get-started.mdx (100%) rename src/content/docs/workers-ai/{tools => features}/function-calling/embedded/index.mdx (100%) rename src/content/docs/workers-ai/{tools => features}/function-calling/embedded/troubleshooting.mdx (100%) rename src/content/docs/workers-ai/{tools => features}/function-calling/index.mdx (100%) rename src/content/docs/workers-ai/{tools => features}/function-calling/traditional.mdx (100%) rename src/content/docs/workers-ai/{tools => features}/index.mdx (100%) rename src/content/docs/workers-ai/{tools => features}/json-mode/index.mdx (100%) rename src/content/docs/workers-ai/{tools => features}/prompting/index.mdx (100%) diff --git a/public/_redirects b/public/_redirects index 740230209d39e2..fa64261c479d8b 100644 --- a/public/_redirects +++ b/public/_redirects @@ -1668,28 +1668,23 @@ # Workers AI reorganization redirects # Function calling -/workers-ai/function-calling /workers-ai/tools/function-calling/ 301 -/workers-ai/function-calling/ /workers-ai/tools/function-calling/ 301 -/workers-ai/function-calling/embedded/ /workers-ai/tools/function-calling/embedded/ 301 -/workers-ai/function-calling/embedded/* /workers-ai/tools/function-calling/embedded/:splat 301 -/workers-ai/function-calling/traditional/ /workers-ai/tools/function-calling/traditional/ 301 -/workers-ai/function-calling/index/ /workers-ai/tools/function-calling/ 301 -/workers-ai/function-calling/* /workers-ai/tools/function-calling/:splat 301 +/workers-ai/function-calling /workers-ai/features/function-calling/ 301 +/workers-ai/function-calling/ /workers-ai/features/function-calling/ 301 +/workers-ai/function-calling/embedded/ /workers-ai/features/function-calling/embedded/ 301 +/workers-ai/function-calling/traditional/ /workers-ai/features/function-calling/traditional/ 301 +/workers-ai/function-calling/index/ /workers-ai/features/function-calling/ 301 # JSON Mode -/workers-ai/json-mode /workers-ai/tools/json-mode/ 301 -/workers-ai/json-mode/ /workers-ai/tools/json-mode/ 301 -/workers-ai/json-mode/* /workers-ai/tools/json-mode/:splat 301 +/workers-ai/json-mode /workers-ai/features/json-mode/ 301 +/workers-ai/json-mode/ /workers-ai/features/json-mode/ 301 # Fine-tunes -/workers-ai/fine-tunes /workers-ai/tools/fine-tunes/ 301 -/workers-ai/fine-tunes/ /workers-ai/tools/fine-tunes/ 301 -/workers-ai/fine-tunes/* /workers-ai/tools/fine-tunes/:splat 301 +/workers-ai/fine-tunes /workers-ai/features/fine-tunes/ 301 +/workers-ai/fine-tunes/ /workers-ai/features/fine-tunes/ 301 # Prompting -/workers-ai/guides/prompting /workers-ai/tools/prompting/ 301 -/workers-ai/guides/prompting/ /workers-ai/tools/prompting/ 301 -/workers-ai/guides/prompting/* /workers-ai/tools/prompting/:splat 301 +/workers-ai/guides/prompting /workers-ai/features/prompting/ 301 +/workers-ai/guides/prompting/ /workers-ai/features/prompting/ 301 # Platform section /workers-ai/privacy /workers-ai/platform/privacy/ 301 @@ -1702,9 +1697,9 @@ # Guides section /workers-ai/demos /workers-ai/guides/demos-architectures/ 301 /workers-ai/demos/ /workers-ai/guides/demos-architectures/ 301 -/workers-ai/demos/* /workers-ai/guides/demos-architectures/:splat 301 /workers-ai/tutorials /workers-ai/guides/tutorials/ 301 /workers-ai/tutorials/ /workers-ai/guides/tutorials/ 301 +/workers-ai/demos/* /workers-ai/guides/demos-architectures/:splat 301 /workers-ai/tutorials/* /workers-ai/guides/tutorials/:splat 301 # workflows diff --git a/src/content/docs/workers-ai/tools/fine-tunes/index.mdx b/src/content/docs/workers-ai/features/fine-tunes/index.mdx similarity index 100% rename from src/content/docs/workers-ai/tools/fine-tunes/index.mdx rename to src/content/docs/workers-ai/features/fine-tunes/index.mdx diff --git a/src/content/docs/workers-ai/tools/fine-tunes/loras.mdx b/src/content/docs/workers-ai/features/fine-tunes/loras.mdx similarity index 100% rename from src/content/docs/workers-ai/tools/fine-tunes/loras.mdx rename to src/content/docs/workers-ai/features/fine-tunes/loras.mdx diff --git a/src/content/docs/workers-ai/tools/fine-tunes/public-loras.mdx b/src/content/docs/workers-ai/features/fine-tunes/public-loras.mdx similarity index 100% rename from src/content/docs/workers-ai/tools/fine-tunes/public-loras.mdx rename to src/content/docs/workers-ai/features/fine-tunes/public-loras.mdx diff --git a/src/content/docs/workers-ai/tools/function-calling/embedded/api-reference.mdx b/src/content/docs/workers-ai/features/function-calling/embedded/api-reference.mdx similarity index 100% rename from src/content/docs/workers-ai/tools/function-calling/embedded/api-reference.mdx rename to src/content/docs/workers-ai/features/function-calling/embedded/api-reference.mdx diff --git a/src/content/docs/workers-ai/tools/function-calling/embedded/examples/fetch.mdx b/src/content/docs/workers-ai/features/function-calling/embedded/examples/fetch.mdx similarity index 100% rename from src/content/docs/workers-ai/tools/function-calling/embedded/examples/fetch.mdx rename to src/content/docs/workers-ai/features/function-calling/embedded/examples/fetch.mdx diff --git a/src/content/docs/workers-ai/tools/function-calling/embedded/examples/index.mdx b/src/content/docs/workers-ai/features/function-calling/embedded/examples/index.mdx similarity index 100% rename from src/content/docs/workers-ai/tools/function-calling/embedded/examples/index.mdx rename to src/content/docs/workers-ai/features/function-calling/embedded/examples/index.mdx diff --git a/src/content/docs/workers-ai/tools/function-calling/embedded/examples/kv.mdx b/src/content/docs/workers-ai/features/function-calling/embedded/examples/kv.mdx similarity index 100% rename from src/content/docs/workers-ai/tools/function-calling/embedded/examples/kv.mdx rename to src/content/docs/workers-ai/features/function-calling/embedded/examples/kv.mdx diff --git a/src/content/docs/workers-ai/tools/function-calling/embedded/examples/openapi.mdx b/src/content/docs/workers-ai/features/function-calling/embedded/examples/openapi.mdx similarity index 100% rename from src/content/docs/workers-ai/tools/function-calling/embedded/examples/openapi.mdx rename to src/content/docs/workers-ai/features/function-calling/embedded/examples/openapi.mdx diff --git a/src/content/docs/workers-ai/tools/function-calling/embedded/get-started.mdx b/src/content/docs/workers-ai/features/function-calling/embedded/get-started.mdx similarity index 100% rename from src/content/docs/workers-ai/tools/function-calling/embedded/get-started.mdx rename to src/content/docs/workers-ai/features/function-calling/embedded/get-started.mdx diff --git a/src/content/docs/workers-ai/tools/function-calling/embedded/index.mdx b/src/content/docs/workers-ai/features/function-calling/embedded/index.mdx similarity index 100% rename from src/content/docs/workers-ai/tools/function-calling/embedded/index.mdx rename to src/content/docs/workers-ai/features/function-calling/embedded/index.mdx diff --git a/src/content/docs/workers-ai/tools/function-calling/embedded/troubleshooting.mdx b/src/content/docs/workers-ai/features/function-calling/embedded/troubleshooting.mdx similarity index 100% rename from src/content/docs/workers-ai/tools/function-calling/embedded/troubleshooting.mdx rename to src/content/docs/workers-ai/features/function-calling/embedded/troubleshooting.mdx diff --git a/src/content/docs/workers-ai/tools/function-calling/index.mdx b/src/content/docs/workers-ai/features/function-calling/index.mdx similarity index 100% rename from src/content/docs/workers-ai/tools/function-calling/index.mdx rename to src/content/docs/workers-ai/features/function-calling/index.mdx diff --git a/src/content/docs/workers-ai/tools/function-calling/traditional.mdx b/src/content/docs/workers-ai/features/function-calling/traditional.mdx similarity index 100% rename from src/content/docs/workers-ai/tools/function-calling/traditional.mdx rename to src/content/docs/workers-ai/features/function-calling/traditional.mdx diff --git a/src/content/docs/workers-ai/tools/index.mdx b/src/content/docs/workers-ai/features/index.mdx similarity index 100% rename from src/content/docs/workers-ai/tools/index.mdx rename to src/content/docs/workers-ai/features/index.mdx diff --git a/src/content/docs/workers-ai/tools/json-mode/index.mdx b/src/content/docs/workers-ai/features/json-mode/index.mdx similarity index 100% rename from src/content/docs/workers-ai/tools/json-mode/index.mdx rename to src/content/docs/workers-ai/features/json-mode/index.mdx diff --git a/src/content/docs/workers-ai/tools/prompting/index.mdx b/src/content/docs/workers-ai/features/prompting/index.mdx similarity index 100% rename from src/content/docs/workers-ai/tools/prompting/index.mdx rename to src/content/docs/workers-ai/features/prompting/index.mdx From 73ef1b035693fbf5334383c6c8f0250d6fc47c16 Mon Sep 17 00:00:00 2001 From: Craig Dennis Date: Tue, 1 Apr 2025 16:32:35 -0700 Subject: [PATCH 04/12] Updates name to Features --- src/content/docs/workers-ai/features/index.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/content/docs/workers-ai/features/index.mdx b/src/content/docs/workers-ai/features/index.mdx index 503117de9202c3..61ef8aaa01b718 100644 --- a/src/content/docs/workers-ai/features/index.mdx +++ b/src/content/docs/workers-ai/features/index.mdx @@ -1,6 +1,6 @@ --- pcx_content_type: navigation -title: Tools +title: Features sidebar: group: hideIndex: true @@ -9,4 +9,4 @@ sidebar: import { DirectoryListing } from "~/components"; - \ No newline at end of file + From 098ba8f3f423dda5837634978f47681c5f2ba29c Mon Sep 17 00:00:00 2001 From: Craig Dennis Date: Tue, 1 Apr 2025 16:34:44 -0700 Subject: [PATCH 05/12] Renames once again --- src/content/docs/workers-ai/get-started/workers-wrangler.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/content/docs/workers-ai/get-started/workers-wrangler.mdx b/src/content/docs/workers-ai/get-started/workers-wrangler.mdx index 8fb75046cb70f6..d2fbb3a5f8210c 100644 --- a/src/content/docs/workers-ai/get-started/workers-wrangler.mdx +++ b/src/content/docs/workers-ai/get-started/workers-wrangler.mdx @@ -1,11 +1,11 @@ --- -title: Workers +title: Workers Bindings pcx_content_type: get-started sidebar: order: 1 head: - tag: title - content: Get started - Workers + content: Get started - Workers and Wrangler description: Deploy your first Cloudflare Workers AI project using the CLI. --- From 58fdaa4734b2ed91f9101deffc645ba505bad635 Mon Sep 17 00:00:00 2001 From: Craig Dennis Date: Tue, 1 Apr 2025 16:51:08 -0700 Subject: [PATCH 06/12] Hand rolled redirects instead of dynamic --- public/_redirects | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/public/_redirects b/public/_redirects index fa64261c479d8b..d93732529bd6d8 100644 --- a/public/_redirects +++ b/public/_redirects @@ -1671,8 +1671,15 @@ /workers-ai/function-calling /workers-ai/features/function-calling/ 301 /workers-ai/function-calling/ /workers-ai/features/function-calling/ 301 /workers-ai/function-calling/embedded/ /workers-ai/features/function-calling/embedded/ 301 +/workers-ai/function-calling/embedded/get-started /workers-ai/features/function-calling/embedded/get-started 301 +/workers-ai/function-calling/embedded/api-reference /workers-ai/features/function-calling/embedded/api-reference 301 +/workers-ai/function-calling/embedded/examples/ /workers-ai/features/function-calling/embedded/examples/ 301 +/workers-ai/function-calling/embedded/examples/kv /workers-ai/features/function-calling/embedded/examples/kv 301 +/workers-ai/function-calling/embedded/examples/openapi /workers-ai/features/function-calling/embedded/examples/openapi 301 +/workers-ai/function-calling/embedded/examples/fetch /workers-ai/features/function-calling/embedded/examples/fetch 301 +/workers-ai/function-calling/embedded/examples/troubleshooting /workers-ai/features/function-calling/embedded/examples/troubleshooting 301 /workers-ai/function-calling/traditional/ /workers-ai/features/function-calling/traditional/ 301 -/workers-ai/function-calling/index/ /workers-ai/features/function-calling/ 301 +/workers-ai/function-calling/ /workers-ai/features/function-calling/ 301 # JSON Mode /workers-ai/json-mode /workers-ai/features/json-mode/ 301 @@ -1681,6 +1688,8 @@ # Fine-tunes /workers-ai/fine-tunes /workers-ai/features/fine-tunes/ 301 /workers-ai/fine-tunes/ /workers-ai/features/fine-tunes/ 301 +/workers-ai/fine-tunes/public-loras /workers-ai/features/fine-tunes/public-loras 301 +/workers-ai/fine-tunes/loras /workers-ai/features/fine-tunes/loras 301 # Prompting /workers-ai/guides/prompting /workers-ai/features/prompting/ 301 @@ -1699,8 +1708,6 @@ /workers-ai/demos/ /workers-ai/guides/demos-architectures/ 301 /workers-ai/tutorials /workers-ai/guides/tutorials/ 301 /workers-ai/tutorials/ /workers-ai/guides/tutorials/ 301 -/workers-ai/demos/* /workers-ai/guides/demos-architectures/:splat 301 -/workers-ai/tutorials/* /workers-ai/guides/tutorials/:splat 301 # workflows @@ -2060,6 +2067,11 @@ /workers/templates/pages/* /workers/examples/:splat 301 /workers/observability/logging/* /workers/observability/logs/:splat 301 +# Workers AI +/workers-ai/demos/* /workers-ai/guides/demos-architectures/:splat 301 +/workers-ai/tutorials/* /workers-ai/guides/tutorials/:splat 301 + + # Others /ssl/custom-certificates/* /ssl/edge-certificates/custom-certificates/:splat 301 /logs/analytics-integrations/* /fundamentals/data-products/analytics-integrations/:splat 301 From 4872412f797e79f51bbfa697f8b7bfd616f056fe Mon Sep 17 00:00:00 2001 From: kodster28 Date: Thu, 3 Apr 2025 09:58:39 -0500 Subject: [PATCH 07/12] Cleaned up redirects --- public/__redirects | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/public/__redirects b/public/__redirects index 98de878412308f..76b0a61c928a73 100644 --- a/public/__redirects +++ b/public/__redirects @@ -1531,44 +1531,34 @@ # Workers AI reorganization redirects # Function calling /workers-ai/function-calling /workers-ai/features/function-calling/ 301 -/workers-ai/function-calling/ /workers-ai/features/function-calling/ 301 /workers-ai/function-calling/embedded/ /workers-ai/features/function-calling/embedded/ 301 -/workers-ai/function-calling/embedded/get-started /workers-ai/features/function-calling/embedded/get-started 301 -/workers-ai/function-calling/embedded/api-reference /workers-ai/features/function-calling/embedded/api-reference 301 +/workers-ai/function-calling/embedded/get-started/ /workers-ai/features/function-calling/embedded/get-started 301 +/workers-ai/function-calling/embedded/api-reference/ /workers-ai/features/function-calling/embedded/api-reference 301 /workers-ai/function-calling/embedded/examples/ /workers-ai/features/function-calling/embedded/examples/ 301 -/workers-ai/function-calling/embedded/examples/kv /workers-ai/features/function-calling/embedded/examples/kv 301 -/workers-ai/function-calling/embedded/examples/openapi /workers-ai/features/function-calling/embedded/examples/openapi 301 -/workers-ai/function-calling/embedded/examples/fetch /workers-ai/features/function-calling/embedded/examples/fetch 301 -/workers-ai/function-calling/embedded/examples/troubleshooting /workers-ai/features/function-calling/embedded/examples/troubleshooting 301 +/workers-ai/function-calling/embedded/examples/kv/ /workers-ai/features/function-calling/embedded/examples/kv 301 +/workers-ai/function-calling/embedded/examples/openapi/ /workers-ai/features/function-calling/embedded/examples/openapi 301 +/workers-ai/function-calling/embedded/examples/fetch/ /workers-ai/features/function-calling/embedded/examples/fetch 301 +/workers-ai/function-calling/embedded/examples/troubleshooting/ /workers-ai/features/function-calling/embedded/examples/troubleshooting 301 /workers-ai/function-calling/traditional/ /workers-ai/features/function-calling/traditional/ 301 -/workers-ai/function-calling/ /workers-ai/features/function-calling/ 301 # JSON Mode /workers-ai/json-mode /workers-ai/features/json-mode/ 301 -/workers-ai/json-mode/ /workers-ai/features/json-mode/ 301 # Fine-tunes /workers-ai/fine-tunes /workers-ai/features/fine-tunes/ 301 -/workers-ai/fine-tunes/ /workers-ai/features/fine-tunes/ 301 /workers-ai/fine-tunes/public-loras /workers-ai/features/fine-tunes/public-loras 301 /workers-ai/fine-tunes/loras /workers-ai/features/fine-tunes/loras 301 # Prompting -/workers-ai/guides/prompting /workers-ai/features/prompting/ 301 /workers-ai/guides/prompting/ /workers-ai/features/prompting/ 301 # Platform section -/workers-ai/privacy /workers-ai/platform/privacy/ 301 /workers-ai/privacy/ /workers-ai/platform/privacy/ 301 -/workers-ai/glossary /workers-ai/platform/glossary/ 301 /workers-ai/glossary/ /workers-ai/platform/glossary/ 301 -/workers-ai/workers-ai-errors /workers-ai/platform/errors/ 301 /workers-ai/workers-ai-errors/ /workers-ai/platform/errors/ 301 # Guides section -/workers-ai/demos /workers-ai/guides/demos-architectures/ 301 /workers-ai/demos/ /workers-ai/guides/demos-architectures/ 301 -/workers-ai/tutorials /workers-ai/guides/tutorials/ 301 /workers-ai/tutorials/ /workers-ai/guides/tutorials/ 301 # workflows From f68d18f0347aa9b4202ebe2c1ce497dc11ad9a05 Mon Sep 17 00:00:00 2001 From: kodster28 Date: Thu, 3 Apr 2025 10:00:48 -0500 Subject: [PATCH 08/12] trailing slash --- public/__redirects | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/__redirects b/public/__redirects index 76b0a61c928a73..6616957e22fe5c 100644 --- a/public/__redirects +++ b/public/__redirects @@ -1530,7 +1530,7 @@ # Workers AI reorganization redirects # Function calling -/workers-ai/function-calling /workers-ai/features/function-calling/ 301 +/workers-ai/function-calling/ /workers-ai/features/function-calling/ 301 /workers-ai/function-calling/embedded/ /workers-ai/features/function-calling/embedded/ 301 /workers-ai/function-calling/embedded/get-started/ /workers-ai/features/function-calling/embedded/get-started 301 /workers-ai/function-calling/embedded/api-reference/ /workers-ai/features/function-calling/embedded/api-reference 301 From 4f06c030d118bcf4c8f6deab81f64365ca3e0115 Mon Sep 17 00:00:00 2001 From: kodster28 Date: Thu, 3 Apr 2025 10:03:13 -0500 Subject: [PATCH 09/12] remove folders with one file --- .../workers-ai/features/{json-mode/index.mdx => json-mode.mdx} | 0 .../workers-ai/features/{prompting/index.mdx => prompting.mdx} | 0 .../{demos-architectures/index.mdx => demos-architectures.mdx} | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename src/content/docs/workers-ai/features/{json-mode/index.mdx => json-mode.mdx} (100%) rename src/content/docs/workers-ai/features/{prompting/index.mdx => prompting.mdx} (100%) rename src/content/docs/workers-ai/guides/{demos-architectures/index.mdx => demos-architectures.mdx} (100%) diff --git a/src/content/docs/workers-ai/features/json-mode/index.mdx b/src/content/docs/workers-ai/features/json-mode.mdx similarity index 100% rename from src/content/docs/workers-ai/features/json-mode/index.mdx rename to src/content/docs/workers-ai/features/json-mode.mdx diff --git a/src/content/docs/workers-ai/features/prompting/index.mdx b/src/content/docs/workers-ai/features/prompting.mdx similarity index 100% rename from src/content/docs/workers-ai/features/prompting/index.mdx rename to src/content/docs/workers-ai/features/prompting.mdx diff --git a/src/content/docs/workers-ai/guides/demos-architectures/index.mdx b/src/content/docs/workers-ai/guides/demos-architectures.mdx similarity index 100% rename from src/content/docs/workers-ai/guides/demos-architectures/index.mdx rename to src/content/docs/workers-ai/guides/demos-architectures.mdx From b2b1e48206878ca016982237986b542b8cc73b11 Mon Sep 17 00:00:00 2001 From: kodster28 Date: Thu, 3 Apr 2025 10:09:27 -0500 Subject: [PATCH 10/12] more slashes --- public/__redirects | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/public/__redirects b/public/__redirects index 6616957e22fe5c..18f508142afa2a 100644 --- a/public/__redirects +++ b/public/__redirects @@ -1532,22 +1532,22 @@ # Function calling /workers-ai/function-calling/ /workers-ai/features/function-calling/ 301 /workers-ai/function-calling/embedded/ /workers-ai/features/function-calling/embedded/ 301 -/workers-ai/function-calling/embedded/get-started/ /workers-ai/features/function-calling/embedded/get-started 301 -/workers-ai/function-calling/embedded/api-reference/ /workers-ai/features/function-calling/embedded/api-reference 301 +/workers-ai/function-calling/embedded/get-started/ /workers-ai/features/function-calling/embedded/get-started/ 301 +/workers-ai/function-calling/embedded/api-reference/ /workers-ai/features/function-calling/embedded/api-reference/ 301 /workers-ai/function-calling/embedded/examples/ /workers-ai/features/function-calling/embedded/examples/ 301 -/workers-ai/function-calling/embedded/examples/kv/ /workers-ai/features/function-calling/embedded/examples/kv 301 -/workers-ai/function-calling/embedded/examples/openapi/ /workers-ai/features/function-calling/embedded/examples/openapi 301 -/workers-ai/function-calling/embedded/examples/fetch/ /workers-ai/features/function-calling/embedded/examples/fetch 301 -/workers-ai/function-calling/embedded/examples/troubleshooting/ /workers-ai/features/function-calling/embedded/examples/troubleshooting 301 +/workers-ai/function-calling/embedded/examples/kv/ /workers-ai/features/function-calling/embedded/examples/kv/ 301 +/workers-ai/function-calling/embedded/examples/openapi/ /workers-ai/features/function-calling/embedded/examples/openapi/ 301 +/workers-ai/function-calling/embedded/examples/fetch/ /workers-ai/features/function-calling/embedded/examples/fetch/ 301 +/workers-ai/function-calling/embedded/examples/troubleshooting/ /workers-ai/features/function-calling/embedded/examples/troubleshooting/ 301 /workers-ai/function-calling/traditional/ /workers-ai/features/function-calling/traditional/ 301 # JSON Mode -/workers-ai/json-mode /workers-ai/features/json-mode/ 301 +/workers-ai/json-mode/ /workers-ai/features/json-mode/ 301 # Fine-tunes -/workers-ai/fine-tunes /workers-ai/features/fine-tunes/ 301 -/workers-ai/fine-tunes/public-loras /workers-ai/features/fine-tunes/public-loras 301 -/workers-ai/fine-tunes/loras /workers-ai/features/fine-tunes/loras 301 +/workers-ai/fine-tunes/ /workers-ai/features/fine-tunes/ 301 +/workers-ai/fine-tunes/public-loras /workers-ai/features/fine-tunes/public-loras/ 301 +/workers-ai/fine-tunes/loras /workers-ai/features/fine-tunes/loras/ 301 # Prompting /workers-ai/guides/prompting/ /workers-ai/features/prompting/ 301 From d3bf8d4474bed5b7853d9abe944c899078646196 Mon Sep 17 00:00:00 2001 From: kodster28 Date: Thu, 3 Apr 2025 10:32:47 -0500 Subject: [PATCH 11/12] fixes --- public/__redirects | 1 - .../docs/workers-ai/features/json-mode.mdx | 3 +-- .../docs/workers-ai/features/prompting.mdx | 1 - .../workers-ai/guides/demos-architectures.mdx | 16 +++++++++++++--- 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/public/__redirects b/public/__redirects index 18f508142afa2a..054142b2de9372 100644 --- a/public/__redirects +++ b/public/__redirects @@ -1559,7 +1559,6 @@ # Guides section /workers-ai/demos/ /workers-ai/guides/demos-architectures/ 301 -/workers-ai/tutorials/ /workers-ai/guides/tutorials/ 301 # workflows diff --git a/src/content/docs/workers-ai/features/json-mode.mdx b/src/content/docs/workers-ai/features/json-mode.mdx index f496af33345d58..7d170d08d8a440 100644 --- a/src/content/docs/workers-ai/features/json-mode.mdx +++ b/src/content/docs/workers-ai/features/json-mode.mdx @@ -1,7 +1,6 @@ --- pcx_content_type: navigation title: JSON Mode -hideChildren: true sidebar: order: 2 --- @@ -124,4 +123,4 @@ We will continue extending this list to keep up with new, and requested models. Note that Workers AI can't guarantee that the model responds according to the requested JSON Schema. Depending on the complexity of the task and adequacy of the JSON Schema, the model may not be able to satisfy the request in extreme situations. If that's the case, then an error `JSON Mode couldn't be met` is returned and must be handled. -JSON Mode currently doesn't support streaming. \ No newline at end of file +JSON Mode currently doesn't support streaming. diff --git a/src/content/docs/workers-ai/features/prompting.mdx b/src/content/docs/workers-ai/features/prompting.mdx index 0afeaafab85aaa..8d4084e1650b6c 100644 --- a/src/content/docs/workers-ai/features/prompting.mdx +++ b/src/content/docs/workers-ai/features/prompting.mdx @@ -1,7 +1,6 @@ --- pcx_content_type: concept title: Prompting -hideChildren: true sidebar: order: 4 --- diff --git a/src/content/docs/workers-ai/guides/demos-architectures.mdx b/src/content/docs/workers-ai/guides/demos-architectures.mdx index 979857d0025dfc..b8d09655662434 100644 --- a/src/content/docs/workers-ai/guides/demos-architectures.mdx +++ b/src/content/docs/workers-ai/guides/demos-architectures.mdx @@ -1,12 +1,15 @@ --- pcx_content_type: concept title: Demos and architectures -hideChildren: true sidebar: order: 2 --- -import { ExternalResources, GlossaryTooltip, ResourcesBySelector } from "~/components" +import { + ExternalResources, + GlossaryTooltip, + ResourcesBySelector, +} from "~/components"; Workers AI can be used to build dynamic and performant services. The following demo applications and reference architectures showcase how to use Workers AI optimally within your architecture. @@ -20,4 +23,11 @@ Explore the following demo applications Explore the following reference architectures that use Workers AI: - + From 56c4abfcd385631f08df5ac7d5c423924bf96285 Mon Sep 17 00:00:00 2001 From: kodster28 Date: Thu, 3 Apr 2025 11:09:43 -0500 Subject: [PATCH 12/12] broken links --- .../workers-ai/2025-02-25-json-mode.mdx | 49 ++++++++------- .../diagrams/ai/ai-rag.mdx | 2 +- .../diagrams/ai/bigquery-workers-ai.mdx | 19 +++--- .../docs/vectorize/get-started/embeddings.mdx | 2 +- .../reference/what-is-a-vector-database.mdx | 24 +++---- .../workers-ai/features/fine-tunes/index.mdx | 10 ++- .../workers-ai/features/fine-tunes/loras.mdx | 49 +++++++-------- .../embedded/api-reference.mdx | 48 +++++++------- .../function-calling/embedded/get-started.mdx | 5 +- .../features/function-calling/index.mdx | 4 +- .../features/function-calling/traditional.mdx | 62 ++++++++++--------- .../fine-tune-models-with-autotrain.mdx | 33 +++++----- .../using-bigquery-with-workers-ai.mdx | 2 +- .../docs/workers/platform/storage-options.mdx | 2 +- src/pages/index.astro | 2 +- 15 files changed, 154 insertions(+), 159 deletions(-) diff --git a/src/content/changelog/workers-ai/2025-02-25-json-mode.mdx b/src/content/changelog/workers-ai/2025-02-25-json-mode.mdx index 98d13202fe7903..cfddc344e570a6 100644 --- a/src/content/changelog/workers-ai/2025-02-25-json-mode.mdx +++ b/src/content/changelog/workers-ai/2025-02-25-json-mode.mdx @@ -6,7 +6,7 @@ date: 2025-02-25T15:00:00Z import { TypeScriptExample } from "~/components"; -Workers AI now supports structured JSON outputs with [JSON mode](/workers-ai/json-mode/), which allows you to request a structured output response when interacting with AI models. +Workers AI now supports structured JSON outputs with [JSON mode](/workers-ai/features/json-mode/), which allows you to request a structured output response when interacting with AI models. This makes it much easier to retrieve structured data from your AI models, and avoids the (error prone!) need to parse large unstructured text responses to extract your data. @@ -23,13 +23,13 @@ interface Env { // Define your JSON schema for a calendar event const CalendarEventSchema = { - type: 'object', - properties: { - name: { type: 'string' }, - date: { type: 'string' }, - participants: { type: 'array', items: { type: 'string' } }, - }, - required: ['name', 'date', 'participants'] + type: "object", + properties: { + name: { type: "string" }, + date: { type: "string" }, + participants: { type: "array", items: { type: "string" } }, + }, + required: ["name", "date", "participants"], }; export default { @@ -42,29 +42,32 @@ export default { }); const response = await client.chat.completions.create({ - model: 'gpt-4o-2024-08-06', - messages: [ - { role: 'system', content: 'Extract the event information.' }, - { role: 'user', content: 'Alice and Bob are going to a science fair on Friday.' }, - ], + model: "gpt-4o-2024-08-06", + messages: [ + { role: "system", content: "Extract the event information." }, + { + role: "user", + content: "Alice and Bob are going to a science fair on Friday.", + }, + ], // Use the `response_format` option to request a structured JSON output - response_format: { + response_format: { // Set json_schema and provide ra schema, or json_object and parse it yourself - type: 'json_schema', - schema: CalendarEventSchema, // provide a schema - }, - }); + type: "json_schema", + schema: CalendarEventSchema, // provide a schema + }, + }); // This will be of type CalendarEventSchema const event = response.choices[0].message.parsed; return Response.json({ - "calendar_event": event, - }) - } -} + calendar_event: event, + }); + }, +}; ``` -To learn more about JSON mode and structured outputs, visit the [Workers AI documentation](/workers-ai/json-mode/). \ No newline at end of file +To learn more about JSON mode and structured outputs, visit the [Workers AI documentation](/workers-ai/features/json-mode/). diff --git a/src/content/docs/reference-architecture/diagrams/ai/ai-rag.mdx b/src/content/docs/reference-architecture/diagrams/ai/ai-rag.mdx index 12ebcfc01e389e..d86fe31ef2d7de 100644 --- a/src/content/docs/reference-architecture/diagrams/ai/ai-rag.mdx +++ b/src/content/docs/reference-architecture/diagrams/ai/ai-rag.mdx @@ -49,6 +49,6 @@ In the context of Retrieval-Augmented Generation (RAG), knowledge seeding involv ## Related resources -- [Tutorial: Build a RAG AI](/workers-ai/tutorials/build-a-retrieval-augmented-generation-ai/) +- [Tutorial: Build a RAG AI](/workers-ai/guides/tutorials/build-a-retrieval-augmented-generation-ai/) - [Workers AI: Text embedding models](/workers-ai/models/) - [Workers AI: Text generation models](/workers-ai/models/) diff --git a/src/content/docs/reference-architecture/diagrams/ai/bigquery-workers-ai.mdx b/src/content/docs/reference-architecture/diagrams/ai/bigquery-workers-ai.mdx index ab41c5e0542bfc..f9b50e5401a66e 100644 --- a/src/content/docs/reference-architecture/diagrams/ai/bigquery-workers-ai.mdx +++ b/src/content/docs/reference-architecture/diagrams/ai/bigquery-workers-ai.mdx @@ -28,7 +28,7 @@ This version of the integration is aimed at workflows that require interaction w 1. A user makes a request to a [Worker](https://workers.cloudflare.com/) endpoint. (Which can optionally incorporate [Access](/cloudflare-one/policies/access/) in front of it to authenticate users). 2. Worker fetches [securely stored](/workers/configuration/secrets/) Google Cloud Platform service account information such as service key and generates a JSON Web Token to issue an authenticated API request to BigQuery. -3. Worker receives the data from BigQuery and [transforms it into a format](/workers-ai/tutorials/using-bigquery-with-workers-ai/#6-format-results-from-the-query) that will make it easier to iterate when interacting with Workers AI. +3. Worker receives the data from BigQuery and [transforms it into a format](/workers-ai/guides/tutorials/using-bigquery-with-workers-ai/#6-format-results-from-the-query) that will make it easier to iterate when interacting with Workers AI. 4. Using its [native integration](/workers-ai/configuration/bindings/) with Workers AI, the Worker forwards the data from BigQuery which is then run against one of Cloudflare's hosted AI models. 5. The original data retrieved from BigQuery alongside the AI-generated information is returned to the user as a response to the request initiated in step 1. @@ -40,20 +40,20 @@ For periodic or longer workflows, you may opt for a batch approach. This diagram 1. [A Cron Trigger](/workers/configuration/cron-triggers/) invokes the Worker without any user interaction. 2. Worker fetches [securely stored](/workers/configuration/secrets/) Google Cloud Platform service account information such as service key and generates a JSON Web Token to issue an authenticated API request to BigQuery. -3. Worker receives the data from BigQuery and [transforms it into a format](/workers-ai/tutorials/using-bigquery-with-workers-ai/#6-format-results-from-the-query) that will make it easier to iterate when interacting with Workers AI. +3. Worker receives the data from BigQuery and [transforms it into a format](/workers-ai/guides/tutorials/using-bigquery-with-workers-ai/#6-format-results-from-the-query) that will make it easier to iterate when interacting with Workers AI. 4. Using its [native integration](/workers-ai/configuration/bindings/) with Workers AI, the Worker forwards the data from BigQuery to generate some content related to it. 5. Optionally, you can store the BigQuery data and the AI-generated data in a variety of different Cloudflare services. - * Into [D1](/d1/), a SQL database. - * If in step four you used Workers AI to generate embeddings, you can store them in [Vectorize](/vectorize/). To learn more about this type of solution, please consider reviewing the reference architecture diagram on [Retrieval Augmented Generation](/reference-architecture/diagrams/ai/ai-rag/). - * To [Workers KV](/kv/) if the output of your data will be stored and consumed in a key/value fashion. - * If you prefer to save the data fetched from BigQuery and Workers AI into objects (such as images, files, JSONs), you can use [R2](/r2/), our egress-free object storage to do so. + - Into [D1](/d1/), a SQL database. + - If in step four you used Workers AI to generate embeddings, you can store them in [Vectorize](/vectorize/). To learn more about this type of solution, please consider reviewing the reference architecture diagram on [Retrieval Augmented Generation](/reference-architecture/diagrams/ai/ai-rag/). + - To [Workers KV](/kv/) if the output of your data will be stored and consumed in a key/value fashion. + - If you prefer to save the data fetched from BigQuery and Workers AI into objects (such as images, files, JSONs), you can use [R2](/r2/), our egress-free object storage to do so. 6. You can set up an integration so a system or a user gets notified whenever a new result is available or if an error occurs. It's also worth mentioning that Workers by themselves can already provide additional [observability](/workers/observability/). - * Sending an email with all the data retrieved and generated in the previous step is possible using [Email Routing](/email-routing/email-workers/send-email-workers/). - * Since Workers allows you to issue HTTP requests, you can notify a webhook or API endpoint once the process finishes or if there's an error. + - Sending an email with all the data retrieved and generated in the previous step is possible using [Email Routing](/email-routing/email-workers/send-email-workers/). + - Since Workers allows you to issue HTTP requests, you can notify a webhook or API endpoint once the process finishes or if there's an error. ## Related resources -- [Tutorial: Using BigQuery with Workers AI](/workers-ai/tutorials/using-bigquery-with-workers-ai/) +- [Tutorial: Using BigQuery with Workers AI](/workers-ai/guides/tutorials/using-bigquery-with-workers-ai/) - [Workers AI: Get Started](/workers-ai/get-started/workers-wrangler/) - [Workers: Secrets](/workers/configuration/secrets/) - [Workers: Cron Triggers](/workers/runtime-apis/handlers/scheduled/) @@ -65,4 +65,3 @@ For periodic or longer workflows, you may opt for a batch approach. This diagram - [Workers KV](/kv/) - [R2](/r2/) - [D1](/d1/) - diff --git a/src/content/docs/vectorize/get-started/embeddings.mdx b/src/content/docs/vectorize/get-started/embeddings.mdx index daf846a37a3643..2213f9ef775bc3 100644 --- a/src/content/docs/vectorize/get-started/embeddings.mdx +++ b/src/content/docs/vectorize/get-started/embeddings.mdx @@ -279,6 +279,6 @@ By finishing this tutorial, you have successfully created a Vectorize index, use ## Next steps -- Build a [generative AI chatbot](/workers-ai/tutorials/build-a-retrieval-augmented-generation-ai/) using Workers AI and Vectorize. +- Build a [generative AI chatbot](/workers-ai/guides/tutorials/build-a-retrieval-augmented-generation-ai/) using Workers AI and Vectorize. - Learn more about [how vector databases work](/vectorize/reference/what-is-a-vector-database/). - Read [examples](/vectorize/reference/client-api/) on how to use the Vectorize API from Cloudflare Workers. diff --git a/src/content/docs/vectorize/reference/what-is-a-vector-database.mdx b/src/content/docs/vectorize/reference/what-is-a-vector-database.mdx index 0602a8484c6cd0..794d95915eee2b 100644 --- a/src/content/docs/vectorize/reference/what-is-a-vector-database.mdx +++ b/src/content/docs/vectorize/reference/what-is-a-vector-database.mdx @@ -3,7 +3,6 @@ title: Vector databases pcx_content_type: concept sidebar: order: 2 - --- Vector databases are a key part of building scalable AI-powered applications. Vector databases provide long term memory, on top of an existing machine learning model. @@ -14,10 +13,10 @@ Without a vector database, you would need to train your model (or models) or re- A vector database determines what other data (represented as vectors) is near your input query. This allows you to build different use-cases on top of a vector database, including: -* Semantic search, used to return results similar to the input of the query. -* Classification, used to return the grouping (or groupings) closest to the input query. -* Recommendation engines, used to return content similar to the input based on different criteria (for example previous product sales, or user history). -* Anomaly detection, used to identify whether specific data points are similar to existing data, or different. +- Semantic search, used to return results similar to the input of the query. +- Classification, used to return the grouping (or groupings) closest to the input query. +- Recommendation engines, used to return content similar to the input based on different criteria (for example previous product sales, or user history). +- Anomaly detection, used to identify whether specific data points are similar to existing data, or different. Vector databases can also power [Retrieval Augmented Generation](https://arxiv.org/abs/2005.11401) (RAG) tasks, which allow you to bring additional context to LLMs (Large Language Models) by using the context from a vector search to augment the user prompt. @@ -44,16 +43,17 @@ Instead of passing the prompt directly to the LLM, in the RAG approach you: 1. Generate vector embeddings from an existing dataset or corpus (for example, the dataset you want to use to add additional context to the LLMs response). An existing dataset or corpus could be a product documentation, research data, technical specifications, or your product catalog and descriptions. 2. Store the output embeddings in a Vectorize database index. -When a user initiates a prompt, instead of passing it (without additional context) to the LLM, you *augment* it with additional context: +When a user initiates a prompt, instead of passing it (without additional context) to the LLM, you _augment_ it with additional context: 1. The user prompt is passed into the same ML model used for your dataset, returning a vector embedding representation of the query. 2. This embedding is used as the query (semantic search) against the vector database, which returns similar vectors. 3. These vectors are used to look up the content they relate to (if not embedded directly alongside the vectors as metadata). 4. This content is provided as context alongside the original user prompt, providing additional context to the LLM and allowing it to return an answer that is likely to be far more contextual than the standalone prompt. -Refer to the [RAG using Workers AI tutorial](/workers-ai/tutorials/build-a-retrieval-augmented-generation-ai/) to learn how to combine Workers AI and Vectorize for generative AI use-cases. +Refer to the [RAG using Workers AI tutorial](/workers-ai/guides/tutorials/build-a-retrieval-augmented-generation-ai/) to learn how to combine Workers AI and Vectorize for generative AI use-cases. -1 You can learn more about the theory behind RAG by reading the [RAG paper](https://arxiv.org/abs/2005.11401). +1 You can learn more about the theory behind RAG by reading the [RAG +paper](https://arxiv.org/abs/2005.11401). ## Terminology @@ -85,9 +85,9 @@ Refer to the [dimensions](/vectorize/best-practices/create-indexes/#dimensions) The distance metric is an index used for vector search. It defines how it determines how close your query vector is to other vectors within the index. -* Distance metrics determine how the vector search engine assesses similarity between vectors. -* Cosine, Euclidean (L2), and Dot Product are the most commonly used distance metrics in vector search. -* The machine learning model and type of embedding you use will determine which distance metric is best suited for your use-case. -* Different metrics determine different scoring characteristics. For example, the `cosine` distance metric is well suited to text, sentence similarity and/or document search use-cases. `euclidean` can be better suited for image or speech recognition use-cases. +- Distance metrics determine how the vector search engine assesses similarity between vectors. +- Cosine, Euclidean (L2), and Dot Product are the most commonly used distance metrics in vector search. +- The machine learning model and type of embedding you use will determine which distance metric is best suited for your use-case. +- Different metrics determine different scoring characteristics. For example, the `cosine` distance metric is well suited to text, sentence similarity and/or document search use-cases. `euclidean` can be better suited for image or speech recognition use-cases. Refer to the [distance metrics](/vectorize/best-practices/create-indexes/#distance-metrics) documentation to learn how to configure a distance metric when creating a Vectorize index. diff --git a/src/content/docs/workers-ai/features/fine-tunes/index.mdx b/src/content/docs/workers-ai/features/fine-tunes/index.mdx index ee433dc98e5fc2..429089165fc548 100644 --- a/src/content/docs/workers-ai/features/fine-tunes/index.mdx +++ b/src/content/docs/workers-ai/features/fine-tunes/index.mdx @@ -3,24 +3,22 @@ pcx_content_type: navigation title: Fine-tunes sidebar: order: 3 - --- -import { Feature } from "~/components" +import { Feature } from "~/components"; Learn how to use Workers AI to get fine-tuned inference. - + Upload a LoRA adapter and run fine-tuned inference with one of our base models. - -*** +--- ## What is fine-tuning? Fine-tuning is a general term for modifying an AI model by continuing to train it with additional data. The goal of fine-tuning is to increase the probability that a generation is similar to your dataset. Training a model from scratch is not practical for many use cases given how expensive and time consuming they can be to train. By fine-tuning an existing pre-trained model, you benefit from its capabilities while also accomplishing your desired task. -[Low-Rank Adaptation](https://arxiv.org/abs/2106.09685) (LoRA) is a specific fine-tuning method that can be applied to various model architectures, not just LLMs. It is common that the pre-trained model weights are directly modified or fused with additional fine-tune weights in traditional fine-tuning methods. LoRA, on the other hand, allows for the fine-tune weights and pre-trained model to remain separate, and for the pre-trained model to remain unchanged. The end result is that you can train models to be more accurate at specific tasks, such as generating code, having a specific personality, or generating images in a specific style. +[Low-Rank Adaptation](https://arxiv.org/abs/2106.09685) (LoRA) is a specific fine-tuning method that can be applied to various model architectures, not just LLMs. It is common that the pre-trained model weights are directly modified or fused with additional fine-tune weights in traditional fine-tuning methods. LoRA, on the other hand, allows for the fine-tune weights and pre-trained model to remain separate, and for the pre-trained model to remain unchanged. The end result is that you can train models to be more accurate at specific tasks, such as generating code, having a specific personality, or generating images in a specific style. diff --git a/src/content/docs/workers-ai/features/fine-tunes/loras.mdx b/src/content/docs/workers-ai/features/fine-tunes/loras.mdx index 094d93771fc37a..09d3e5db335131 100644 --- a/src/content/docs/workers-ai/features/fine-tunes/loras.mdx +++ b/src/content/docs/workers-ai/features/fine-tunes/loras.mdx @@ -9,26 +9,25 @@ head: - tag: title content: Fine-tuned inference with LoRA adapters description: Upload and use LoRA adapters to get fine-tuned inference on Workers AI. - --- -import { TabItem, Tabs } from "~/components" +import { TabItem, Tabs } from "~/components"; Workers AI supports fine-tuned inference with adapters trained with [Low-Rank Adaptation](https://blog.cloudflare.com/fine-tuned-inference-with-loras). This feature is in open beta and free during this period. ## Limitations -* We only support LoRAs for the following models (must not be quantized): - * `@cf/meta-llama/llama-2-7b-chat-hf-lora` - * `@cf/mistral/mistral-7b-instruct-v0.2-lora` - * `@cf/google/gemma-2b-it-lora` - * `@cf/google/gemma-7b-it-lora` -* Adapter must be trained with rank `r <=8`. You can check the rank of a pre-trained LoRA adapter through the adapter's `config.json` file -* LoRA adapter file must be < 100MB -* LoRA adapter files must be named `adapter_config.json` and `adapter_model.safetensors` exactly -* You can test up to 30 LoRA adapters per account +- We only support LoRAs for the following models (must not be quantized): + - `@cf/meta-llama/llama-2-7b-chat-hf-lora` + - `@cf/mistral/mistral-7b-instruct-v0.2-lora` + - `@cf/google/gemma-2b-it-lora` + - `@cf/google/gemma-7b-it-lora` +- Adapter must be trained with rank `r <=8`. You can check the rank of a pre-trained LoRA adapter through the adapter's `config.json` file +- LoRA adapter file must be < 100MB +- LoRA adapter files must be named `adapter_config.json` and `adapter_model.safetensors` exactly +- You can test up to 30 LoRA adapters per account -*** +--- ## Choosing compatible LoRA adapters @@ -38,15 +37,15 @@ We have started a [Hugging Face Collection](https://huggingface.co/collections/C ### Training your own LoRA adapters -To train your own LoRA adapter, follow the [tutorial](/workers-ai/tutorials/fine-tune-models-with-autotrain). +To train your own LoRA adapter, follow the [tutorial](/workers-ai/guides/tutorials/fine-tune-models-with-autotrain/). -*** +--- ## Uploading LoRA adapters -In order to run inference with LoRAs on Workers AI, you'll need to create a new fine tune on your account and upload your adapter files. You should have a `adapter_model.safetensors` file with model weights and `adapter_config.json` with your config information. *Note that we only accept adapter files in these types.* +In order to run inference with LoRAs on Workers AI, you'll need to create a new fine tune on your account and upload your adapter files. You should have a `adapter_model.safetensors` file with model weights and `adapter_config.json` with your config information. _Note that we only accept adapter files in these types._ -Right now, you can't edit a fine tune's asset files after you upload it. We will support this soon, but for now you will need to create a new fine tune and upload files again if you would like to use a new LoRA. +Right now, you can't edit a fine tune's asset files after you upload it. We will support this soon, but for now you will need to create a new fine tune and upload files again if you would like to use a new LoRA. Before you upload your LoRA adapter, you'll need to edit your `adapter_config.json` file to include `model_type` as one of `mistral`, `gemma` or `llama` like below. @@ -105,9 +104,9 @@ curl -X POST https://api.cloudflare.com/client/v4/accounts/{ACCOUNT_ID}/ai/finet #### Uploading your adapter weights and config -You have to call the upload endpoint each time you want to upload a new file, so you usually run this once for `adapter_model.safetensors` and once for `adapter_config.json`. Make sure you include the `@` before your path to files. +You have to call the upload endpoint each time you want to upload a new file, so you usually run this once for `adapter_model.safetensors` and once for `adapter_config.json`. Make sure you include the `@` before your path to files. -You can either use the finetune `name` or `id` that you used when you created the fine tune. +You can either use the finetune `name` or `id` that you used when you created the fine tune. ```bash title="cURL" ## Input: finetune_id, adapter_model.safetensors, then adapter_config.json @@ -159,7 +158,7 @@ curl -X GET https://api.cloudflare.com/client/v4/accounts/{ACCOUNT_ID}/ai/finetu -*** +--- ## Running inference with LoRAs @@ -169,12 +168,12 @@ To make inference requests and apply the LoRA adapter, you will need your model ```javascript null {5-6} const response = await env.AI.run( - "@cf/mistralai/mistral-7b-instruct-v0.2-lora", //the model supporting LoRAs - { - messages: [{"role": "user", "content": "Hello world"}], - raw: true, //skip applying the default chat template - lora: "00000000-0000-0000-0000-000000000", //the finetune id OR name - } + "@cf/mistralai/mistral-7b-instruct-v0.2-lora", //the model supporting LoRAs + { + messages: [{ role: "user", content: "Hello world" }], + raw: true, //skip applying the default chat template + lora: "00000000-0000-0000-0000-000000000", //the finetune id OR name + }, ); ``` diff --git a/src/content/docs/workers-ai/features/function-calling/embedded/api-reference.mdx b/src/content/docs/workers-ai/features/function-calling/embedded/api-reference.mdx index 00ef13dff952c3..d5b01d659e6911 100644 --- a/src/content/docs/workers-ai/features/function-calling/embedded/api-reference.mdx +++ b/src/content/docs/workers-ai/features/function-calling/embedded/api-reference.mdx @@ -6,31 +6,27 @@ sidebar: head: - tag: title content: API Reference - Embedded function calling - --- -Learn more about the API reference for [embedded function calling](/workers-ai/function-calling/embedded). +Learn more about the API reference for [embedded function calling](/workers-ai/features/function-calling/embedded). ## runWithTools This wrapper method enables you to do embedded function calling. You pass it the AI binding, model, inputs (`messages` array and `tools` array), and optional configurations. - - -* `AI Binding`Ai - * The AI binding, such as `env.AI`. -* `model`BaseAiTextGenerationModels - * The ID of the model that supports function calling. For example, `@hf/nousresearch/hermes-2-pro-mistral-7b`. -* `input`Object - * `messages`RoleScopedChatInput\[] - * `tools`AiTextGenerationToolInputWithFunction\[] -* `config`Object - * `streamFinalResponse`boolean optional - * `maxRecursiveToolRuns`number optional - * `strictValidation`boolean optional - * `verbose`boolean optional - * `trimFunction`boolean optional - For the `trimFunction`, you can pass it `autoTrimTools`, which is another helper method we've devised to automatically choose the correct tools (using an LLM) before sending it off for inference. This means that your final inference call will have fewer input tokens. - +- `AI Binding`Ai + - The AI binding, such as `env.AI`. +- `model`BaseAiTextGenerationModels + - The ID of the model that supports function calling. For example, `@hf/nousresearch/hermes-2-pro-mistral-7b`. +- `input`Object + - `messages`RoleScopedChatInput\[] + - `tools`AiTextGenerationToolInputWithFunction\[] +- `config`Object + - `streamFinalResponse`boolean optional + - `maxRecursiveToolRuns`number optional + - `strictValidation`boolean optional + - `verbose`boolean optional + - `trimFunction`boolean optional - For the `trimFunction`, you can pass it `autoTrimTools`, which is another helper method we've devised to automatically choose the correct tools (using an LLM) before sending it off for inference. This means that your final inference call will have fewer input tokens. ## createToolsFromOpenAPISpec @@ -38,13 +34,11 @@ This method lets you automatically create tool schemas based on OpenAPI specs, s `createToolsFromOpenAPISpec` has a config input that allows you to perform overrides if you need to provide headers like Authentication or User-Agent. - - -* `spec`string - * The OpenAPI specification in either JSON or YAML format, or a URL to a remote OpenAPI specification. -* `config`Config optional - Configuration options for the createToolsFromOpenAPISpec function - * `overrides`ConfigRule\[] optional - * `matchPatterns`RegExp\[] optional - * `options` Object optional \{ - `verbose` boolean optional +- `spec`string + - The OpenAPI specification in either JSON or YAML format, or a URL to a remote OpenAPI specification. +- `config`Config optional - Configuration options for the createToolsFromOpenAPISpec function + - `overrides`ConfigRule\[] optional + - `matchPatterns`RegExp\[] optional + - `options` Object optional \{ + `verbose` boolean optional \} diff --git a/src/content/docs/workers-ai/features/function-calling/embedded/get-started.mdx b/src/content/docs/workers-ai/features/function-calling/embedded/get-started.mdx index 3d3d654817866c..69af4181e06ffc 100644 --- a/src/content/docs/workers-ai/features/function-calling/embedded/get-started.mdx +++ b/src/content/docs/workers-ai/features/function-calling/embedded/get-started.mdx @@ -7,6 +7,7 @@ head: - tag: title content: Get Started --- + import { TypeScriptExample } from "~/components"; This guide will instruct you through setting up and deploying your first Workers AI project with embedded function calling. You will use Workers, a Workers AI binding, the [`ai-utils package`](https://github.com/cloudflare/ai-utils), and a large language model (LLM) to deploy your first AI-powered application on the Cloudflare global network with embedded function calling. @@ -27,7 +28,6 @@ npm install @cloudflare/ai-utils --save Update the `index.ts` file in your application directory with the following code: - ```ts @@ -80,6 +80,7 @@ export default { }, } satisfies ExportedHandler; ``` + This example imports the utils with `import { runWithTools} from "@cloudflare/ai-utils"` and follows the API reference below. @@ -115,4 +116,4 @@ Resources consumed (e.g. CPU time) during embedded functions' code execution wil ## API reference -For more details, refer to [API reference](/workers-ai/function-calling/embedded/api-reference/). +For more details, refer to [API reference](/workers-ai/features/function-calling/embedded/api-reference/). diff --git a/src/content/docs/workers-ai/features/function-calling/index.mdx b/src/content/docs/workers-ai/features/function-calling/index.mdx index dba495331ca59f..3c78488a01d6d6 100644 --- a/src/content/docs/workers-ai/features/function-calling/index.mdx +++ b/src/content/docs/workers-ai/features/function-calling/index.mdx @@ -17,9 +17,9 @@ In essence, function calling allows you to perform actions with LLMs by executin ## How can I use function calling? -Workers AI has [embedded function calling](/workers-ai/function-calling/embedded/) which allows you to execute function code alongside your inference calls. We have a package called [`@cloudflare/ai-utils`](https://www.npmjs.com/package/@cloudflare/ai-utils) to help facilitate this, which we have open-sourced on [Github](https://github.com/cloudflare/ai-utils). +Workers AI has [embedded function calling](/workers-ai/features/function-calling/embedded/) which allows you to execute function code alongside your inference calls. We have a package called [`@cloudflare/ai-utils`](https://www.npmjs.com/package/@cloudflare/ai-utils) to help facilitate this, which we have open-sourced on [Github](https://github.com/cloudflare/ai-utils). -For industry-standard function calling, take a look at the documentation on [Traditional Function Calling](/workers-ai/function-calling/traditional/). +For industry-standard function calling, take a look at the documentation on [Traditional Function Calling](/workers-ai/features/function-calling/traditional/). To show you the value of embedded function calling, take a look at the example below that compares traditional function calling with embedded function calling. Embedded function calling allowed us to cut down the lines of code from 77 to 31. diff --git a/src/content/docs/workers-ai/features/function-calling/traditional.mdx b/src/content/docs/workers-ai/features/function-calling/traditional.mdx index 310ba8bfe06bca..1b977b25304abd 100644 --- a/src/content/docs/workers-ai/features/function-calling/traditional.mdx +++ b/src/content/docs/workers-ai/features/function-calling/traditional.mdx @@ -8,41 +8,40 @@ sidebar: head: - tag: title content: Traditional function calling - --- -This page shows how you can do traditional function calling, as defined by industry standards. Workers AI also offers [embedded function calling](/workers-ai/function-calling/embedded/), which is drastically easier than traditional function calling. +This page shows how you can do traditional function calling, as defined by industry standards. Workers AI also offers [embedded function calling](/workers-ai/features/function-calling/embedded/), which is drastically easier than traditional function calling. With traditional function calling, you define an array of tools with the name, description, and tool arguments. The example below shows how you would pass a tool called `getWeather` in an inference request to a model. ```js title="Traditional function calling example" const response = await env.AI.run("@hf/nousresearch/hermes-2-pro-mistral-7b", { - messages: [ - { - role: "user", - content: "what is the weather in london?", - }, - ], - tools: [ - { - name: "getWeather", - description: "Return the weather for a latitude and longitude", - parameters: { - type: "object", - properties: { - latitude: { - type: "string", - description: "The latitude for the given location", - }, - longitude: { - type: "string", - description: "The longitude for the given location", - }, - }, - required: ["latitude", "longitude"], - }, - }, - ], + messages: [ + { + role: "user", + content: "what is the weather in london?", + }, + ], + tools: [ + { + name: "getWeather", + description: "Return the weather for a latitude and longitude", + parameters: { + type: "object", + properties: { + latitude: { + type: "string", + description: "The latitude for the given location", + }, + longitude: { + type: "string", + description: "The longitude for the given location", + }, + }, + required: ["latitude", "longitude"], + }, + }, + ], }); return new Response(JSON.stringify(response.tool_calls)); @@ -51,7 +50,12 @@ return new Response(JSON.stringify(response.tool_calls)); The LLM will then return a JSON object with the required arguments and the name of the tool that was called. You can then pass this JSON object to make an API call. ```json -[{"arguments":{"latitude":"51.5074","longitude":"-0.1278"},"name":"getWeather"}] +[ + { + "arguments": { "latitude": "51.5074", "longitude": "-0.1278" }, + "name": "getWeather" + } +] ``` For a working example on how to do function calling, take a look at our [demo app](https://github.com/craigsdennis/lightbulb-moment-tool-calling/blob/main/src/index.ts). diff --git a/src/content/docs/workers-ai/guides/tutorials/fine-tune-models-with-autotrain.mdx b/src/content/docs/workers-ai/guides/tutorials/fine-tune-models-with-autotrain.mdx index b581ea88e34c55..00cb6df1c84b26 100644 --- a/src/content/docs/workers-ai/guides/tutorials/fine-tune-models-with-autotrain.mdx +++ b/src/content/docs/workers-ai/guides/tutorials/fine-tune-models-with-autotrain.mdx @@ -5,12 +5,9 @@ pcx_content_type: tutorial title: Fine Tune Models With AutoTrain from HuggingFace tags: - AI - --- - - -Fine tuning an AI model gives you the opportunity to add additional training data to the model. Workers AI allows for [Low-Rank Adaptation, LoRA, adapters](/workers-ai/fine-tunes/loras/) that will allow you to finetune our models. +Fine tuning an AI model gives you the opportunity to add additional training data to the model. Workers AI allows for [Low-Rank Adaptation, LoRA, adapters](/workers-ai/features/fine-tunes/loras/) that will allow you to finetune our models. In this tutorial, we will explore how to create our own LoRAs. We will focus on [LLM Finetuning using AutoTrain](https://huggingface.co/docs/autotrain/llm_finetuning). @@ -55,12 +52,12 @@ The notebook contains a few interactive sections that we will need to change. Modify the following fields -* **project\_name**: Choose a descriptive name for you to remember later -* **model\_name**: Choose from the one of the official HuggingFace base models that we support: - * `mistralai/Mistral-7B-Instruct-v0.2` - * `google/gemma-2b-it` - * `google/gemma-7b-it` - * `meta-llama/llama-2-7b-chat-hf` +- **project_name**: Choose a descriptive name for you to remember later +- **model_name**: Choose from the one of the official HuggingFace base models that we support: + - `mistralai/Mistral-7B-Instruct-v0.2` + - `google/gemma-2b-it` + - `google/gemma-7b-it` + - `meta-llama/llama-2-7b-chat-hf` ### Optional Section: Push to Hub @@ -74,8 +71,8 @@ Follow the instructions [in the notebook](https://colab.research.google.com/gith We only need to change a few of these fields to ensure things work on Cloudflare Workers AI. -* **quantization**: Change the drop down to `none` -* **lora-r**: Change the value to `8` +- **quantization**: Change the drop down to `none` +- **lora-r**: Change the value to `8` :::caution @@ -112,16 +109,16 @@ subprocess.CalledProcessError: Command '['/usr/bin/python3', '-m', 'autotrain.tr ### Optional: HuggingFace -If you pushed to HuggingFace you will find your new model card that you named in **project\_name** above. Your model card is private by default. Navigate to the files and download the files listed below. +If you pushed to HuggingFace you will find your new model card that you named in **project_name** above. Your model card is private by default. Navigate to the files and download the files listed below. ### Notebook -In your Notebook you can also find the needed files. A new folder that matches your **project\_name** will be there. +In your Notebook you can also find the needed files. A new folder that matches your **project_name** will be there. Download the following files: -* `adapter_model.safetensors` -* `adapter_config.json` +- `adapter_model.safetensors` +- `adapter_config.json` ## 6. Update Adapter Config @@ -135,8 +132,8 @@ Where `model_type` is the architecture. Current valid values are `mistral`, `gem Now that you have your files, you can add them to your account. -You can either use the [REST API or Wrangler](/workers-ai/fine-tunes/loras/). +You can either use the [REST API or Wrangler](/workers-ai/features/fine-tunes/loras/). ## 8. Use your Fine Tune in your Generations -After you have your new fine tune all set up, you are ready to [put it to use in your inference requests](/workers-ai/fine-tunes/loras/#running-inference-with-loras). +After you have your new fine tune all set up, you are ready to [put it to use in your inference requests](/workers-ai/features/fine-tunes/loras/#running-inference-with-loras). diff --git a/src/content/docs/workers-ai/guides/tutorials/using-bigquery-with-workers-ai.mdx b/src/content/docs/workers-ai/guides/tutorials/using-bigquery-with-workers-ai.mdx index 439e067b8c9768..f88cbba1b04dd8 100644 --- a/src/content/docs/workers-ai/guides/tutorials/using-bigquery-with-workers-ai.mdx +++ b/src/content/docs/workers-ai/guides/tutorials/using-bigquery-with-workers-ai.mdx @@ -683,6 +683,6 @@ Once you obtained the results, you formatted them to later be passed to generati If, instead of displaying the results of ingesting the data to the AI model in a browser, your workflow requires fetching and store data (for example in [R2](/r2/) or [D1](/d1/)) on regular intervals, you may want to consider adding a [scheduled handler](/workers/runtime-apis/handlers/scheduled/) for this Worker. It allows triggering the Worker with a predefined cadence via a [Cron Trigger](/workers/configuration/cron-triggers/). Consider reviewing the Reference Architecture Diagrams on [Ingesting BigQuery Data into Workers AI](/reference-architecture/diagrams/ai/bigquery-workers-ai/). -A use case to ingest data from other sources, like you did in this tutorial, is to create a RAG system. If this sounds relevant to you, please check out the tutorial [Build a Retrieval Augmented Generation (RAG) AI](/workers-ai/tutorials/build-a-retrieval-augmented-generation-ai/). +A use case to ingest data from other sources, like you did in this tutorial, is to create a RAG system. If this sounds relevant to you, please check out the tutorial [Build a Retrieval Augmented Generation (RAG) AI](/workers-ai/guides/tutorials/build-a-retrieval-augmented-generation-ai/). To learn more about what other AI models you can use at Cloudflare, please visit the [Workers AI](/workers-ai) section of our docs. diff --git a/src/content/docs/workers/platform/storage-options.mdx b/src/content/docs/workers/platform/storage-options.mdx index 45aa2b104934a7..d105a7ea229fb3 100644 --- a/src/content/docs/workers/platform/storage-options.mdx +++ b/src/content/docs/workers/platform/storage-options.mdx @@ -196,7 +196,7 @@ Vectorize is a globally distributed vector database that enables you to build fu Vectorize allows you to: - Store embeddings from any vector embeddings model (Bring Your Own embeddings) for semantic search and classification tasks. -- Add context to Large Language Model (LLM) queries by using vector search as part of a [Retrieval Augmented Generation](/workers-ai/tutorials/build-a-retrieval-augmented-generation-ai/) (RAG) workflow. +- Add context to Large Language Model (LLM) queries by using vector search as part of a [Retrieval Augmented Generation](/workers-ai/guides/tutorials/build-a-retrieval-augmented-generation-ai/) (RAG) workflow. - [Filter on vector metadata](/vectorize/reference/metadata-filtering/) to reduce the search space and return more relevant results. To get started with Vectorize: diff --git a/src/pages/index.astro b/src/pages/index.astro index 539af5302d628d..6638e1625073c8 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -74,7 +74,7 @@ const topCards = [ links: [ { text: "Build a RAG app", - href: "/workers-ai/tutorials/build-a-retrieval-augmented-generation-ai/", + href: "/workers-ai/guides/tutorials/build-a-retrieval-augmented-generation-ai/", }, { text: "Workers AI", href: "/workers-ai/" }, { text: "Vectorize", href: "/vectorize/" },