new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

AI SDK · Providers · all subjects

cloudflare-workers-ai/capabilities

5 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

Cloudflare Workers AI streamText capability

Cloudflare Workers AI language models support streaming text generation using the streamText function from the AI SDK.

Cloudflare Workers AI structured output capability

Some Cloudflare Workers AI language models support structured data generation using the Output API with Zod schemas.

Cloudflare Workers AI generateText capability

Cloudflare Workers AI language models support text generation using the generateText function from the AI SDK.

Cloudflare Workers AI streamText example

import { createWorkersAI } from 'workers-ai-provider'; import { createTextStreamResponse, streamText, toTextStream } from 'ai'; type Env = { AI: Ai; }; export default { async fetch(_: Request, env: Env) { const workersai = createWorkersAI({ binding: env.AI }); const result = streamText({ model: workersai('@cf/meta/llama-2-7b-chat-int8'), prompt: 'Write a 50-word essay about hello world.', }); return createTextStreamResponse({ stream: toTextStream({ stream: result.stream }), headers: { 'Content-Type': 'text/x-unknown', 'content-encoding': 'identity', 'transfer-encoding': 'chunked', }, }); }, };

Cloudflare Workers AI structured output example

import { createWorkersAI } from 'workers-ai-provider'; import { generateText, Output } from 'ai'; import { z } from 'zod'; type Env = { AI: Ai; }; export default { async fetch(_: Request, env: Env) { const workersai = createWorkersAI({ binding: env.AI }); const result = await generateText({ model: workersai('@cf/meta/llama-3.1-8b-instruct'), prompt: 'Generate a Lasagna recipe', output: Output.object({ schema: z.object({ recipe: z.object({ ingredients: z.array(z.string()), description: z.string(), }), }), }), }); return Response.json(result.output); }, };

Give your agent this brain