KO
베타 번역

@core / ai

1.0.0 ▾
인증됨MIT
GitHub

스트리밍 AI 채팅: 버전 관리 프롬프트, 도구 호출, 사용량·비용 기록, 모델은 환경 변수로 지정

코드파일 11개컨텍스트약 668토큰검사 통과

.genpmignore 적용 후 주입될 정확한 트리입니다. 고정 대상:

src/lib/ai/tools.ts읽기 전용 · 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;

@core/ai 신고

패키지를 신고하려면 GitHub로 로그인하세요.