char-fork/llama.cpp
git clone https://git.t4t.associates/char-fork/llama.cpp
0021a77de
char/aliceai-t5-moe
1import { CLI_FLAGS } from './cli-flags.constants' ; 2import { BuiltInTool , JsonSchemaType , ToolCallType } from '$lib/enums' ; 3import type { OpenAIToolDefinition } from '$lib/types' ; 4 5// get_info is served by the server, but the browser falls back to this 6// implementation when the server does not provide it - same wire name. 7export const BROWSER_INFO_TOOL_NAME = BuiltInTool . SERVER_GET_INFO ; 8 9/** UA token to OS name, first match wins - Android and iOS UAs also carry the Linux / Mac OS X tokens */ 10export const BROWSER_INFO_OS_UA_PATTERNS :readonly [ RegExp , string ][] = [ 11[ / Windows NT / , 'Windows' ], 12[ / Android / , 'Android' ], 13[ / iPhone|iPad|iPod / , 'iOS' ], 14[ / CrOS / , 'ChromeOS' ], 15[ / Mac OS X / , 'macOS' ], 16[ / Linux / , 'Linux' ] 17]; 18 19export const BROWSER_INFO_OS_UNKNOWN = 'unknown' ; 20 21/** Sent to the model as the `note` field of the tool result, next to the OS name */ 22export const BROWSER_INFO_NOTE = `This environment is browser-only, it cannot read or modify local files, and it cannot run shell commands. To get local file access, tell user to launch llama-server with the ${ CLI_FLAGS . AGENT } argument.` ; 23 24export function buildBrowserInfoToolDefinition () :OpenAIToolDefinition { 25return { 26function :{ 27description : 28'Get runtime info (OS name), may call when user asks about local files or shell commands' , 29name :BROWSER_INFO_TOOL_NAME , 30parameters :{ 31properties :{}, 32required :[], 33type :JsonSchemaType . OBJECT 34} 35}, 36type :ToolCallType . FUNCTION 37}; 38}