Team Ai
Datasetpublic

Brunobkr/llama.cpp_AlgMor24_github

ΩFFFΣLLIa • llama.cpp • AlgMor24 ██████╗ ███████╗███████╗███████╗██╗ ██╗ ██╗ █████╗ ██╔═══██╗██╔════╝██╔════╝██╔════╝██║ ██║ ██║██╔══██╗ ██║ ██║█████╗ █████╗ █████╗ ██║ ██║ ██║███████║ ██║ ██║██╔══╝ ██╔══╝ ██╔══╝ ██║ ██║ ██║██╔══██║ ╚██████╔╝██║ ██║ ███████╗███████╗███████╗██║██║ ██║ ╚═════╝ ╚═╝ ╚═╝ ╚══════╝╚══════╝╚══════╝╚═╝╚═╝ ╚═╝ High-Performance LLM / VLM Inference & Autonomous Agentic Ecosystem… See the full description on the dataset page: https://huggingface.co/datasets/Brunobkr/llama.cpp_AlgMor24_github.

sourceHugging Faceupdated 2mo agoView on Hugging Face
0likes3kdownloads
index.js309 linesDownload Raw Back to utils
1/**2 * @import { EmbeddedResource, ResourceLink, CallToolResult, ReadResourceResult, GetPromptResult,  CompleteResult } from "../validation/index.js";3 */4 5/**6 * @satisfies {Record<string, (...args: any[])=>CallToolResult<any>>}7 */8export const tool = {9	/**10	 * @param {string} text11	 */12	text(text) {13		return {14			content: [15				{16					type: /** @type {const} */ ('text'),17					text,18				},19			],20		};21	},22	/**23	 * @param {string} text24	 */25	error(text) {26		return {27			isError: true,28			content: [29				{30					type: /** @type {const} */ ('text'),31					text,32				},33			],34		};35	},36	/**37	 * @param {"audio" | "image"} type38	 * @param {string} data39	 * @param {string} mime_type40	 */41	media(type, data, mime_type) {42		return {43			content: [44				{45					type,46					data,47					mimeType: mime_type,48				},49			],50		};51	},52	/**53	 * @param {EmbeddedResource["resource"]} resource54	 */55	resource(resource) {56		return {57			content: [58				{59					type: /** @type {const} */ ('resource'),60					resource,61				},62			],63		};64	},65 66	/**67	 * @param {Omit<ResourceLink, "type">} resource_link68	 */69	resourceLink(resource_link) {70		return {71			content: [72				{73					type: /** @type {const} */ ('resource_link'),74					...resource_link,75				},76			],77		};78	},79	/**80	 * @template {Record<string, unknown>} T81	 * @param {T} obj82	 */83	structured(obj) {84		return /** @type {const} */ ({85			content: [86				{87					type: 'text',88					text: JSON.stringify(obj),89				},90			],91			structuredContent: obj,92		});93	},94	/**95	 * @template {Record<string, unknown> | undefined} [T=undefined]96	 * @param {Array<CallToolResult<undefined>>} results97	 * @param {T} [obj]98	 */99	mix(results, obj) {100		return /** @type {CallToolResult<T>} */ ({101			isError: results.some((r) => r.isError),102			content: results.flatMap((r) => (r.content ? r.content : [])),103			structuredContent: obj,104		});105	},106};107/**108 * @satisfies {Record<string, (...args: any[])=>ReadResourceResult>}109 */110export const resource = {111	/**112	 * @param {string} uri113	 * @param {string} text114	 * @param {string} [mime_type]115	 */116	text(uri, text, mime_type) {117		return {118			contents: [119				{120					uri,121					text,122					mimeType: mime_type,123				},124			],125		};126	},127	/**128	 * @param {string} uri129	 * @param {string} blob130	 * @param {string} [mime_type]131	 */132	blob(uri, blob, mime_type) {133		return {134			contents: [135				{136					uri,137					blob,138					mimeType: mime_type,139				},140			],141		};142	},143	/**144	 *145	 * @param {Array<ReadResourceResult>} resources146	 */147	mix(resources) {148		return {149			contents: resources.flatMap((resource) => resource.contents),150		};151	},152};153 154/**155 * @satisfies {Record<string, (...args: any[])=>GetPromptResult>}156 */157export const prompt = {158	/**159	 *160	 * @param {string} text161	 */162	message(text) {163		return {164			messages: [165				{166					role: 'user',167					content: {168						type: 'text',169						text,170					},171				},172			],173		};174	},175	/**176	 * Alias for message177	 * @param {string} text178	 */179	text(text) {180		return {181			messages: [182				{183					role: 'user',184					content: {185						type: 'text',186						text,187					},188				},189			],190		};191	},192	/**193	 *194	 * @param {"audio" | "image"} type195	 * @param {string} data196	 * @param {string} mime_type197	 */198	media(type, data, mime_type) {199		return {200			messages: [201				{202					role: 'user',203					content: {204						type,205						data,206						mimeType: mime_type,207					},208				},209			],210		};211	},212	/**213	 * @param {EmbeddedResource["resource"]} resource214	 */215	resource(resource) {216		return {217			messages: [218				{219					role: 'user',220					content: {221						type: 'resource',222						resource,223					},224				},225			],226		};227	},228 229	/**230	 * @param {Omit<ResourceLink, "type">} resource231	 */232	resourceLink(resource) {233		return {234			messages: [235				{236					role: 'user',237					content: {238						type: 'resource_link',239						...resource,240					},241				},242			],243		};244	},245	/**246	 *247	 * @param {Array<GetPromptResult>} messages248	 */249	mix(messages) {250		return {251			messages: messages.flatMap((m) => m.messages),252		};253	},254	/**255	 *256	 * @param {Array<string>} messages257	 * @returns258	 */259	messages(messages) {260		return {261			messages: messages.map((message) => {262				return {263					role: 'user',264					content: {265						type: 'text',266						text: message,267					},268				};269			}),270		};271	},272	/**273	 *274	 * @param {Array<GetPromptResult["messages"][number]["content"]>} messages275	 * @returns276	 * @deprecated Use `mix` instead277	 */278	various(messages) {279		return {280			messages: messages.map((content) => {281				return {282					role: 'user',283					content,284				};285			}),286		};287	},288};289/**290 * @satisfies {Record<string, (...args: any[])=>CompleteResult>}291 */292export const complete = {293	/**294	 *295	 * @param {Array<string>} values296	 * @param {boolean} [has_more]297	 * @param {number} [total]298	 */299	values(values, has_more, total) {300		return {301			completion: {302				values,303				hasMore: has_more,304				total,305			},306		};307	},308};309 
Brunobkr/llama.cpp_AlgMor24_github · Team Ai