FR
Traduction bêta

@core / ai

1.0.0 ▾
vérifiéMIT
GitHub

Chat IA en streaming : prompts versionnés, appels d’outils, suivi d’usage et de coût ; modèle via env

Code11 fichiersContexte~668 tokensanalyse réussie

L’arborescence exacte qui sera injectée, après .genpmignore. Épinglée à

src/lib/ai/tools.tslecture seule · 5b1e62b
// Scaffold de tool-calling. Cada tool: descripción clara para el modelo, `inputSchema` en zod y `execute` en el
// servidor. Valida y autoriza dentro de `execute`: el modelo decide cuándo llamarla, no si el usuario puede.
import { tool } from 'ai';
import { z } from 'zod';

export const tools = {
  currentTime: tool({
    description: 'Current date and time, optionally in an IANA time zone such as "Europe/Madrid".',
    inputSchema: z.object({ timeZone: z.string().optional() }),
    execute: async ({ timeZone }) => ({
      iso: new Date().toISOString(),
      local: new Date().toLocaleString('en-US', timeZone ? { timeZone } : {}),
    }),
  }),
};

export type AppTools = typeof tools;

Signaler @core/ai

Connectez-vous avec GitHub pour signaler un paquet.