From 51e528e3adcb131f08adad24348ff2b9668e58d8 Mon Sep 17 00:00:00 2001 From: Charly POLY Date: Mon, 25 Nov 2024 11:50:11 +0100 Subject: [PATCH] docs(ai): minor fixes and enhancements --- .../steps-workflows/step-ai-orchestration.mdx | 26 ++++++++++--------- shared/Docs/Navigation.tsx | 6 ++++- shared/Docs/Tag.tsx | 7 +++-- shared/Docs/navigationStructure.ts | 3 ++- 4 files changed, 26 insertions(+), 16 deletions(-) diff --git a/pages/docs/features/inngest-functions/steps-workflows/step-ai-orchestration.mdx b/pages/docs/features/inngest-functions/steps-workflows/step-ai-orchestration.mdx index 9c812c393..28d55b3c6 100644 --- a/pages/docs/features/inngest-functions/steps-workflows/step-ai-orchestration.mdx +++ b/pages/docs/features/inngest-functions/steps-workflows/step-ai-orchestration.mdx @@ -2,11 +2,11 @@ import { Callout, GuideSelector, GuideSection, CodeGroup } from "src/shared/Docs # AI Inference -You can build complex AI workflows and call model providers as steps using two step methods, `step.ai.infer` and `step.ai.wrap`, or our AgentKit SDK. They work with any model provider, and all offer full AI observability: +You can build complex AI workflows and call model providers as steps using two step methods, `step.ai.infer()` and `step.ai.wrap()`, or our AgentKit SDK. They work with any model provider, and all offer full AI observability: - [AgentKit](/docs/agent-kit/overview) allows you to easily create single model calls or agentic workflows. Read the AgentKit docs here -- `step.ai.wrap` wraps other AI SDKs as a step. This works with every SDK, including OpenAI, Anthropic, and Vercel’s AI SDK -- `step.ai.infer` offloads the inference request to Inngest’s infrastructure, pausing your function execution until the request finishes. This can be a significant cost saver if you deploy to serverless functions +- `step.ai.wrap()` wraps other AI SDKs (OpenAI, Anthropic, and Vercel AI SDK) as a step, augmenting the observability of your Inngest Functions with information such as prompts and tokens used. +- `step.ai.infer()` offloads the inference request to Inngest's infrastructure, pausing your function execution until the request finishes. This can be a significant cost saver if you deploy to serverless functions ### Benefits @@ -31,9 +31,9 @@ Using [AgentKit](/docs/agent-kit/overview) and `step.ai` allows you to: ## AgentKit: AI and agent orchestration -AgentKit is a simple, standardized way to implement model calling — either as individual calls, a comoplex workflow, or agentic flows. +AgentKit is a simple, standardized way to implement model calling — either as individual calls, a complex workflow, or agentic flows. -Here's an exmaple of a single model call: +Here's an example of a single model call: ```ts {{ title: "TypeScript" }} @@ -64,13 +64,15 @@ export default inngest.createFunction( ## Step tools: `step.ai` -### `step.ai.infer` +### `step.ai.infer()` -Using `step.ai.infer` allows you to call any inference provider’s endpoints, tracking the requests and responses automatically within your workflow traces. +Using `step.ai.infer()` allows you to call any inference provider's endpoints by offloading it to Inngest's infrastructure. +All requests and responses are automatically tracked within your workflow traces. **Request offloading** -This step method also offloads requests to Inngest’s infrastructure. On serverless environments, your function is not executing while the request is in progress — which means you don’t pay for function execution while waiting for the provider’s response. Once the request finishes, your function restarts with the inference result’s data. Inngest never logs or stores your API keys or authentication headers. Authentication originates from your own functions. +On serverless environments, your function is not executing while the request is in progress — which means you don't pay for function execution while waiting for the provider's response. +Once the request finishes, your function restarts with the inference result's data. Inngest never logs or stores your API keys or authentication headers. Authentication originates from your own functions. Here's an example which calls OpenAI: @@ -101,9 +103,9 @@ export default inngest.createFunction( ``` -### `step.ai.wrap` (TypeScript only) +### `step.ai.wrap()` (TypeScript only) -Using `step.ai.wrap` allows you to wrap other TypeScript AI SDKs, treating each inference call as a step. This allows you to easily convert AI calls to steps with full observability, without changing much application-level code: +Using `step.ai.wrap()` allows you to wrap other TypeScript AI SDKs, treating each inference call as a step. This allows you to easily convert AI calls to steps with full observability, without changing much application-level code: ```ts {{ title: "Vercel AI SDK" }} @@ -147,11 +149,11 @@ export default inngest.createFunction( ``` -In this case, instead of calling the SDK directly, you specifyc the SDK function you want to call and the function's arguments separately within `step.ai.wrap`. +In this case, instead of calling the SDK directly, you specifyc the SDK function you want to call and the function's arguments separately within `step.ai.wrap()`. ### Supported providers -The list of current providers supported for `step.ai.infer` is: +The list of current providers supported for `step.ai.infer()` is: - `openai`, including any OpenAI compatible API such as Perplexity - `gemini` diff --git a/shared/Docs/Navigation.tsx b/shared/Docs/Navigation.tsx index 6a9fd7d1d..47a2965db 100644 --- a/shared/Docs/Navigation.tsx +++ b/shared/Docs/Navigation.tsx @@ -132,7 +132,11 @@ function NavLink({ {!isAnchorLink && } {children} - {tag && {tag}} + {tag && ( + + {tag} + + )} ); } diff --git a/shared/Docs/Tag.tsx b/shared/Docs/Tag.tsx index a0b73d92f..fbb77f7c1 100644 --- a/shared/Docs/Tag.tsx +++ b/shared/Docs/Tag.tsx @@ -41,18 +41,21 @@ export function Tag({ variant = "medium", color = valueColorMap[children.toLowerCase()] ?? "indigo", background = "default", + className, }: { children: string; variant?: "small" | "medium"; color?: string; + className?: string; background?: "default" | "page"; }) { return ( {children} diff --git a/shared/Docs/navigationStructure.ts b/shared/Docs/navigationStructure.ts index 0b7bb3dd3..096612183 100644 --- a/shared/Docs/navigationStructure.ts +++ b/shared/Docs/navigationStructure.ts @@ -513,6 +513,7 @@ const sectionHome: (NavGroup | NavLink)[] = [ }, { title: "AI Inference", + tag: "new", href: "/docs/features/inngest-functions/steps-workflows/step-ai-orchestration", }, { title: "Guides" }, @@ -839,7 +840,7 @@ const sectionHome: (NavGroup | NavLink)[] = [ href: "/docs/agent-kit/ai-agent-network-state-routing", }, ], - } + }, ], }, { title: "References", links: sectionReference },