@lunora/ai 1.0.0-alpha.93 → 1.0.0-alpha.94
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -65,8 +65,14 @@ When a function uses AI, codegen wires a typed **`ctx.ai`** onto the action cont
|
|
|
65
65
|
import { action, v } from "@/lunora/_generated/server";
|
|
66
66
|
import { generateText } from "@lunora/ai";
|
|
67
67
|
|
|
68
|
-
export const summarize = action.input({ text: v.string() }).action(async ({ args: { text }, ctx }) => {
|
|
68
|
+
export const summarize = action.input({ text: v.string().max(20_000) }).action(async ({ args: { text }, ctx }) => {
|
|
69
69
|
const { text: summary } = await generateText({
|
|
70
|
+
// Both ends of the token bill are bounded: the input by `.max()` above,
|
|
71
|
+
// the completion here. An `action` is public RPC and inference is
|
|
72
|
+
// metered, so an unbounded completion is a denial-of-wallet vector — a
|
|
73
|
+
// short prompt can ask for an arbitrarily long answer, and output
|
|
74
|
+
// tokens are the expensive half.
|
|
75
|
+
maxOutputTokens: 300,
|
|
70
76
|
model: ctx.ai.model("@cf/meta/llama-3.3-70b-instruct-fp8-fast"),
|
|
71
77
|
prompt: `Summarize:\n\n${text}`,
|
|
72
78
|
});
|