char-fork/llama.cpp
git clone https://git.t4t.associates/char-fork/llama.cpp
e21152dc9
char/aliceai-t5-moe
1import { 2SANDBOX_TIMEOUT_MS_DEFAULT , 3SANDBOX_TIMEOUT_MS_MAX , 4SANDBOX_TOOL_NAME 5} from '$lib/constants' ; 6import { JsonSchemaType , ToolCallType } from '$lib/enums' ; 7import type { OpenAIToolDefinition } from '$lib/types' ; 8 9const NERDAMER_DESCRIPTION = ` 10Symbolic/numeric math via \`nerdamer\` 11nerdamer(expr,subs?,opts?)/nerdamer.func(...)→Expression Format via .text(fmt?) (fmt: 'decimals'|'fractions'|'scientific') eval via .evaluate(subs?) 12nerdamer(expr,{x:2}) substitutes numeric via opts 'numer' or .evaluate() 13simplify/expand/factor(expr) div/gcd/lcm(...) coeffs/partfrac(expr,var) 14diff/integrate(expr,var) defint(expr,lo,hi,var?) sum/product(expr,var,lo,hi) limit(expr,var,pt) 15solve(expr,var) solveEquations([eq1,eq2],[var1,var2]) 16polarform/rectform/arg/realpart/imagpart(z) 17set/get Var/Constant(name,val?) setFunction(name,[params],body) 18IMPORTANT:Identifier 'nerdamer' has already been declared, use it directly` ; 19 20/** 21* Build the sandbox tool definition. When `includeSymbolicMath` is true, 22* the description includes nerdamer API documentation; otherwise it 23* describes a plain JavaScript sandbox. 24*/ 25export function buildSandboxToolDefinition ( includeSymbolicMath :boolean ) :OpenAIToolDefinition { 26return { 27function :{ 28description :includeSymbolicMath 29 ?`Execute JS in a sandboxed browser worker (no DOM/page access). Top-level await ok; console.log for intermediates; top-level return is captured as result. ${ NERDAMER_DESCRIPTION } ` 30 :'Execute JS in a sandboxed browser worker (no DOM/page access). Top-level await ok; console.log for intermediates; top-level return is captured as result.' , 31name :SANDBOX_TOOL_NAME , 32parameters :{ 33properties :{ 34code :{ 35description :'JavaScript source to execute' , 36type :JsonSchemaType . STRING 37}, 38timeout_ms :{ 39description :`Execution timeout in milliseconds, default ${ SANDBOX_TIMEOUT_MS_DEFAULT } , max ${ SANDBOX_TIMEOUT_MS_MAX } ` , 40type :JsonSchemaType . NUMBER 41} 42}, 43required :[ 'code' ], 44type :JsonSchemaType . OBJECT 45} 46}, 47type :ToolCallType . FUNCTION 48}; 49} 50 51/** @deprecated Use {@link buildSandboxToolDefinition} instead. Kept for backward compatibility. */ 52export const SANDBOX_TOOL_DEFINITION = buildSandboxToolDefinition ( true );