tools:fs - decode

This commit is contained in:
lovebird 2025-04-18 10:01:48 +02:00
parent 9865b03586
commit e0bff7f8a0
4 changed files with 272 additions and 92 deletions

File diff suppressed because one or more lines are too long

View File

@ -25,6 +25,7 @@ export interface IKBotOptions {

01-ai/yi-large | paid
aetherwiing/mn-starcannon-12b | paid
agentica-org/deepcoder-14b-preview:free | free
ai21/jamba-1-5-large | paid
ai21/jamba-1-5-mini | paid
ai21/jamba-1.6-large | paid
@ -34,8 +35,8 @@ export interface IKBotOptions {
aion-labs/aion-1.0-mini | paid
aion-labs/aion-rp-llama-3.1-8b | paid
jondurbin/airoboros-l2-70b | paid
alfredpros/codellama-7b-instruct-solidity | paid
allenai/molmo-7b-d:free | free
allenai/olmo-2-0325-32b-instruct | paid
amazon/nova-lite-v1 | paid
amazon/nova-micro-v1 | paid
amazon/nova-pro-v1 | paid
@ -62,6 +63,7 @@ export interface IKBotOptions {
anthropic/claude-2.0:beta | paid
anthropic/claude-2.1 | paid
anthropic/claude-2.1:beta | paid
arliai/qwq-32b-arliai-rpr-v1:free | free
openrouter/auto | paid
bytedance-research/ui-tars-72b:free | free
cohere/command | paid
@ -93,23 +95,26 @@ export interface IKBotOptions {
cognitivecomputations/dolphin-mixtral-8x22b | paid
cognitivecomputations/dolphin3.0-mistral-24b:free | free
cognitivecomputations/dolphin3.0-r1-mistral-24b:free | free
eleutherai/llemma_7b | paid
eva-unit-01/eva-llama-3.33-70b | paid
eva-unit-01/eva-qwen-2.5-32b | paid
eva-unit-01/eva-qwen-2.5-72b | paid
sao10k/fimbulvetr-11b-v2 | paid
alpindale/goliath-120b | paid
google/gemini-2.0-flash-lite-001 | paid
google/gemini-2.0-flash-thinking-exp-1219:free | free
google/gemini-2.0-flash-thinking-exp:free | free
google/gemini-flash-1.5 | paid
google/gemini-flash-1.5-8b | paid
google/gemini-flash-1.5-8b-exp | paid
google/gemini-pro-1.5 | paid
google/gemini-2.0-flash-001 | paid
google/gemini-2.0-flash-exp:free | free
google/gemini-pro | paid
google/gemini-pro-1.5 | paid
google/gemini-2.0-pro-exp-02-05:free | free
google/gemini-2.0-flash-lite-001 | paid
google/gemini-2.0-flash-thinking-exp-1219:free | free
google/gemini-2.0-flash-thinking-exp:free | free
google/gemini-2.5-flash-preview | paid
google/gemini-2.5-flash-preview:thinking | paid
google/gemini-2.5-pro-exp-03-25:free | free
google/gemini-2.5-pro-preview-03-25 | paid
google/gemini-pro | paid
google/gemini-pro-vision | paid
google/gemma-2-27b-it | paid
google/gemma-2-9b-it | paid
@ -121,7 +126,6 @@ export interface IKBotOptions {
google/gemma-3-27b-it:free | free
google/gemma-3-4b-it | paid
google/gemma-3-4b-it:free | free
google/gemma-7b-it | paid
google/learnlm-1.5-pro-experimental:free | free
google/palm-2-chat-bison | paid
google/palm-2-chat-bison-32k | paid
@ -144,7 +148,6 @@ export interface IKBotOptions {
meta-llama/llama-2-70b-chat | paid
meta-llama/llama-3-70b-instruct | paid
meta-llama/llama-3-8b-instruct | paid
meta-llama/llama-3-8b-instruct:free | free
meta-llama/llama-3.1-405b | paid
meta-llama/llama-3.1-405b-instruct | paid
meta-llama/llama-3.1-70b-instruct | paid
@ -159,13 +162,15 @@ export interface IKBotOptions {
meta-llama/llama-3.2-90b-vision-instruct | paid
meta-llama/llama-3.3-70b-instruct | paid
meta-llama/llama-3.3-70b-instruct:free | free
meta-llama/llama-4-maverick | paid
meta-llama/llama-4-maverick:free | free
meta-llama/llama-4-scout | paid
meta-llama/llama-4-scout:free | free
meta-llama/llama-guard-2-8b | paid
microsoft/phi-4 | paid
microsoft/phi-4-multimodal-instruct | paid
microsoft/phi-3-medium-128k-instruct | paid
microsoft/phi-3-medium-128k-instruct:free | free
microsoft/phi-3-mini-128k-instruct | paid
microsoft/phi-3-mini-128k-instruct:free | free
microsoft/phi-3.5-mini-128k-instruct | paid
sophosympatheia/midnight-rose-70b | paid
minimax/minimax-01 | paid
@ -193,14 +198,13 @@ export interface IKBotOptions {
mistralai/mistral-small-3.1-24b-instruct | paid
mistralai/mistral-small-3.1-24b-instruct:free | free
mistralai/mixtral-8x22b-instruct | paid
mistralai/mixtral-8x7b | paid
mistralai/mixtral-8x7b-instruct | paid
mistralai/pixtral-12b | paid
mistralai/pixtral-large-2411 | paid
mistralai/mistral-saba | paid
moonshotai/kimi-vl-a3b-thinking:free | free
moonshotai/moonlight-16b-a3b-instruct:free | free
gryphe/mythomax-l2-13b | paid
gryphe/mythomax-l2-13b:free | free
neversleep/llama-3-lumimaid-70b | paid
neversleep/llama-3-lumimaid-8b | paid
neversleep/llama-3-lumimaid-8b:extended | paid
@ -215,6 +219,9 @@ export interface IKBotOptions {
nousresearch/hermes-2-pro-llama-3-8b | paid
nvidia/llama-3.1-nemotron-70b-instruct | paid
nvidia/llama-3.1-nemotron-70b-instruct:free | free
nvidia/llama-3.1-nemotron-nano-8b-v1:free | free
nvidia/llama-3.1-nemotron-ultra-253b-v1:free | free
nvidia/llama-3.3-nemotron-super-49b-v1:free | free
open-r1/olympiccoder-32b:free | free
open-r1/olympiccoder-7b:free | free
openai/chatgpt-4o-latest | paid
@ -231,6 +238,9 @@ export interface IKBotOptions {
openai/gpt-4-turbo | paid
openai/gpt-4-1106-preview | paid
openai/gpt-4-turbo-preview | paid
openai/gpt-4.1 | paid
openai/gpt-4.1-mini | paid
openai/gpt-4.1-nano | paid
openai/gpt-4.5-preview | paid
openai/gpt-4o | paid
openai/gpt-4o-2024-05-13 | paid
@ -247,11 +257,13 @@ export interface IKBotOptions {
openai/o1-preview | paid
openai/o1-preview-2024-09-12 | paid
openai/o1-pro | paid
openai/o3 | paid
openai/o3-mini | paid
openai/o3-mini-high | paid
openai/o4-mini | paid
openai/o4-mini-high | paid
openchat/openchat-7b | paid
openchat/openchat-7b:free | free
teknium/openhermes-2.5-mistral-7b | paid
all-hands/openhands-lm-32b-v0.1 | paid
perplexity/llama-3.1-sonar-large-128k-online | paid
perplexity/llama-3.1-sonar-small-128k-online | paid
perplexity/r1-1776 | paid
@ -262,14 +274,13 @@ export interface IKBotOptions {
perplexity/sonar-reasoning-pro | paid
pygmalionai/mythalion-13b | paid
qwen/qwen-2-72b-instruct | paid
qwen/qwen-2-7b-instruct | paid
qwen/qwen-2-7b-instruct:free | free
qwen/qwen-vl-max | paid
qwen/qwen-vl-plus | paid
qwen/qwen-max | paid
qwen/qwen-plus | paid
qwen/qwen-turbo | paid
qwen/qwen2.5-32b-instruct | paid
qwen/qwen2.5-coder-7b-instruct | paid
qwen/qwen2.5-vl-32b-instruct | paid
qwen/qwen2.5-vl-32b-instruct:free | free
qwen/qwen2.5-vl-3b-instruct:free | free
qwen/qwen2.5-vl-72b-instruct | paid
@ -284,6 +295,7 @@ export interface IKBotOptions {
qwen/qwen-2.5-72b-instruct | paid
qwen/qwen-2.5-72b-instruct:free | free
qwen/qwen-2.5-7b-instruct | paid
qwen/qwen-2.5-7b-instruct:free | free
qwen/qwen-2.5-coder-32b-instruct | paid
qwen/qwen-2.5-coder-32b-instruct:free | free
featherless/qwerky-72b:free | free
@ -296,13 +308,14 @@ export interface IKBotOptions {
sao10k/l3.1-70b-hanami-x1 | paid
sao10k/l3.1-euryale-70b | paid
sao10k/l3.3-euryale-70b | paid
shisa-ai/shisa-v2-llama3.3-70b:free | free
raifle/sorcererlm-8x22b | paid
steelskull/l3.3-electra-r1-70b | paid
tokyotech-llm/llama-3.1-swallow-70b-instruct-v0.3 | paid
thedrummer/anubis-pro-105b-v1 | paid
thedrummer/skyfall-36b-v2 | paid
thudm/glm-4-32b:free | free
thudm/glm-z1-32b:free | free
undi95/toppy-m-7b | paid
undi95/toppy-m-7b:free | free
scb10x/llama3.1-typhoon2-70b-instruct | paid
scb10x/llama3.1-typhoon2-8b-instruct | paid
thedrummer/unslopnemo-12b | paid
@ -310,6 +323,8 @@ export interface IKBotOptions {
microsoft/wizardlm-2-8x22b | paid
x-ai/grok-2-1212 | paid
x-ai/grok-2-vision-1212 | paid
x-ai/grok-3-beta | paid
x-ai/grok-3-mini-beta | paid
x-ai/grok-beta | paid
x-ai/grok-vision-beta | paid
xwin-lm/xwin-lm-70b | paid
@ -334,6 +349,12 @@ export interface IKBotOptions {
gpt-4-turbo
gpt-4-turbo-2024-04-09
gpt-4-turbo-preview
gpt-4.1
gpt-4.1-2025-04-14
gpt-4.1-mini
gpt-4.1-mini-2025-04-14
gpt-4.1-nano
gpt-4.1-nano-2025-04-14
gpt-4.5-preview
gpt-4.5-preview-2025-02-27
gpt-4o
@ -369,6 +390,8 @@ export interface IKBotOptions {
o1-pro-2025-03-19
o3-mini
o3-mini-2025-01-31
o4-mini
o4-mini-2025-04-16
omni-moderation-2024-09-26
omni-moderation-latest
text-embedding-3-large
@ -425,6 +448,8 @@ export interface IKBotOptions {
JSON,JSONUnescape,JSONPretty,AlphaSort,code,JSONParse,trim
*/
filters?: (string | ("JSON" | "JSONUnescape" | "JSONPretty" | "AlphaSort" | "code" | "JSONParse" | "trim")[] | string[] | ((...args_0: unknown[]) => unknown)[]);
/** JSONPath query to be used to transform input objects */
query?: (string | null);
/** Dry run - only write out parameters without making API calls */
dry?: (boolean | string);
/** Format for structured outputs. Can be a Zod schema, a Zod schema string, a JSON schema string, or a path to a JSON file. */

View File

@ -7,7 +7,8 @@ import { sync as write } from '@polymech/fs/write'
import { sync as read } from '@polymech/fs/read'
import { sync as rename } from '@polymech/fs/rename'
import { sync as exists } from '@polymech/fs/exists'
import { sanitizeFilename } from "@polymech/fs/utils"
import { sanitize } from "@polymech/fs/utils"
import { filesEx } from '@polymech/commons'
import { toolLogger } from '../../index.js'
@ -52,6 +53,51 @@ export const decode_base64 = (base64: string): string => {
}
};
// Helper function for smart Base64 decoding
const decodeContentSmart = (content: string, logger: any, identifier: string): string => {
if (!content || typeof content !== 'string') {
return content; // Return original content if null, undefined, or not a string
}
const lines = content.split(/\r?\n/);
const processedLines = lines.map(line => {
const trimmedLine = line.trim();
if (!trimmedLine) {
return ''; // Preserve empty lines between potential blocks but decode the blocks themselves
}
try {
// Attempt to decode Base64
const decodedLine = Buffer.from(trimmedLine, 'base64').toString('utf-8');
// Validate if it was actually Base64 by re-encoding
const reEncodedLine = Buffer.from(decodedLine, 'utf-8').toString('base64');
// Revised Validation Check:
// Compare original trimmed line with re-encoded line.
// Allow for potential padding differences by checking both exact match and no-pad match.
const originalNoPad = trimmedLine.replace(/={1,2}$/, '');
const reEncodedNoPad = reEncodedLine.replace(/={1,2}$/, '');
if (reEncodedLine === trimmedLine || reEncodedNoPad === originalNoPad) {
logger.debug(`Successfully decoded Base64 line for ${identifier}`);
return decodedLine;
}
// If validation fails, treat as plain text
logger.debug(`Re-encoding mismatch for ${identifier}. Original: '${trimmedLine}', Re-encoded: '${reEncodedLine}', using original trimmed line.`);
return trimmedLine;
} catch (decodeError) {
// If decoding throws an error, assume it's plain text
// Use debug level as this is expected for non-base64 lines
logger.debug(`Base64 decoding failed for line in ${identifier}, assuming plain text. Line: ${trimmedLine}`);
return trimmedLine; // Return original trimmed line
}
});
// Join the processed lines back together
return processedLines.join('\n');
};
export const tools = (target: string, options: IKBotTask): Array<any> => {
const logger = toolLogger('fs', options)
const category = 'fs'
@ -71,7 +117,7 @@ export const tools = (target: string, options: IKBotTask): Array<any> => {
},
function: async (params: any) => {
try {
const directory = path.join(target, params.directory);
const directory = path.join(target, sanitize(params.directory));
if (!exists(directory)) {
logger.debug(`Tool::ListFiles Directory ${directory} does not exist`);
return []
@ -150,7 +196,7 @@ export const tools = (target: string, options: IKBotTask): Array<any> => {
},
function: async (params: any) => {
try {
const filePath = path.join(target, params.path);
const filePath = path.join(target, sanitize(params.path));
logger.debug(`Tool::RemoveFile Removing file ${filePath}`);
rm(filePath);
return true;
@ -177,9 +223,10 @@ export const tools = (target: string, options: IKBotTask): Array<any> => {
},
function: async (params: any) => {
try {
const src = path.join(target, params.src)
logger.debug(`Tool::Rename file ${src} to ${params.dst}`)
rename(src, params.dst)
const src = path.join(target, sanitize(params.src))
const dst = path.join(target, sanitize(params.dst))
logger.debug(`Tool::Rename file ${src} to ${dst}`)
rename(src, dst)
rm(src)
return true
} catch (error) {
@ -224,24 +271,31 @@ export const tools = (target: string, options: IKBotTask): Array<any> => {
files = JSON.parse(files)
} catch (error: any) {
logger.error(`Tool::modify_project_files : Structure Error parsing files`, error, ret)
write(path.join(target, 'tools-output.json'), files)
// Consider writing the raw input for debugging if JSON parsing fails
// write(path.join(target, 'tools-output-error.json'), files)
return error.message
}
}
for (const file of files) {
const filePath = path.join(target, file.path);
const sanitizedPath = sanitize(file.path);
const filePath = path.join(target, sanitizedPath);
logger.debug(`Tool:modify_project_files writing file ${filePath}`)
try {
let content = decode_base64(file.content)
await write(filePath, content)
const contentToWrite = decodeContentSmart(file.content, logger, sanitizedPath);
try {
await write(filePath, contentToWrite)
} catch (writeError) {
logger.error(`Tool:modify_project_files Error writing file ${filePath}`, writeError)
}
} catch (error) {
logger.error(`Tool:modify_project_files Error writing file`, error)
logger.error(`Tool:modify_project_files Error processing file content for ${filePath}`, error)
}
}
} catch (error) {
logger.error(`Error creating project structure`, error)
}
},
parse: JSON.parse,
},
} as RunnableToolFunction<{ id: string }>,
@ -264,28 +318,42 @@ export const tools = (target: string, options: IKBotTask): Array<any> => {
required: ["file"],
},
function: async (params) => {
let fileInfo;
try {
if (isString(params)) {
try {
params = JSON.parse(params)
} catch (error: any) {
logger.error(`Tool::create_file : Structure Error parsing files`, error, params)
logger.error(`Tool::write_file : Structure Error parsing JSON`, error, params)
return error.message
}
}
let { file } = params as any
if (!target || !file.path || !file.content) {
logger.error(`Tool::create_file : Path/Target/Content are required to create file`, params)
return
fileInfo = (params as any).file; // Keep fileInfo accessible
if (!target || !fileInfo || !fileInfo.path || typeof fileInfo.content === 'undefined') {
logger.error(`Tool::write_file : Path/Target/Content are required`, fileInfo)
return false; // Indicate failure
}
const sanitizedPath = sanitize(fileInfo.path);
const filePath = path.join(target, sanitizedPath)
logger.debug(`Tool::write_file Writing file ${filePath}`)
try {
// Use the smart decoding helper function
const contentToWrite = decodeContentSmart(fileInfo.content, logger, sanitizedPath);
await write(filePath, contentToWrite)
return true
} catch (error) {
// Log error related to processing or writing the file
logger.error(`Tool:write_file Error processing or writing file ${sanitizedPath}`, error)
return false // Indicate failure
}
let content = decode_base64(file.content)
logger.debug(`Tool::create_file Writing file ${file.path} in ${target}`)
const filePath = path.join(target, file.path)
write(filePath, content)
return true
} catch (error) {
logger.error(`Tool:create_file Error writing file`, error)
return false
logger.error(`Tool:write_file Error writing file ${fileInfo?.path ? sanitize(fileInfo.path) : 'unknown'}`, error)
return false // Indicate failure
}
},
parse: JSON.parse,
@ -320,10 +388,11 @@ export const tools = (target: string, options: IKBotTask): Array<any> => {
}
const { file } = ret as any
if (!target || !file.path) {
logger.error(`Tool::file_exists : Path is required to `, ret)
logger.error(`Tool::file_exists : Path is required`, ret)
return
}
const filePath = path.join(target, file.path)
const sanitizedPath = sanitize(file.path);
const filePath = path.join(target, sanitizedPath)
const res = exists(filePath)
logger.debug(`Tool::file_exists ${filePath} exists: ${res}`)
return res ? true : false
@ -355,7 +424,8 @@ export const tools = (target: string, options: IKBotTask): Array<any> => {
function: async (ret) => {
try {
const { file } = ret as any
const filePath = path.join(target, file.path)
const sanitizedPath = sanitize(file.path);
const filePath = path.join(target, sanitizedPath)
logger.debug(`Tool::ReadFile Reading file ${filePath}`)
return read(filePath, 'string')
} catch (error) {

View File

@ -25,6 +25,7 @@ export interface IKBotOptions {

01-ai/yi-large | paid
aetherwiing/mn-starcannon-12b | paid
agentica-org/deepcoder-14b-preview:free | free
ai21/jamba-1-5-large | paid
ai21/jamba-1-5-mini | paid
ai21/jamba-1.6-large | paid
@ -34,8 +35,8 @@ export interface IKBotOptions {
aion-labs/aion-1.0-mini | paid
aion-labs/aion-rp-llama-3.1-8b | paid
jondurbin/airoboros-l2-70b | paid
alfredpros/codellama-7b-instruct-solidity | paid
allenai/molmo-7b-d:free | free
allenai/olmo-2-0325-32b-instruct | paid
amazon/nova-lite-v1 | paid
amazon/nova-micro-v1 | paid
amazon/nova-pro-v1 | paid
@ -62,6 +63,7 @@ export interface IKBotOptions {
anthropic/claude-2.0:beta | paid
anthropic/claude-2.1 | paid
anthropic/claude-2.1:beta | paid
arliai/qwq-32b-arliai-rpr-v1:free | free
openrouter/auto | paid
bytedance-research/ui-tars-72b:free | free
cohere/command | paid
@ -93,23 +95,26 @@ export interface IKBotOptions {
cognitivecomputations/dolphin-mixtral-8x22b | paid
cognitivecomputations/dolphin3.0-mistral-24b:free | free
cognitivecomputations/dolphin3.0-r1-mistral-24b:free | free
eleutherai/llemma_7b | paid
eva-unit-01/eva-llama-3.33-70b | paid
eva-unit-01/eva-qwen-2.5-32b | paid
eva-unit-01/eva-qwen-2.5-72b | paid
sao10k/fimbulvetr-11b-v2 | paid
alpindale/goliath-120b | paid
google/gemini-2.0-flash-lite-001 | paid
google/gemini-2.0-flash-thinking-exp-1219:free | free
google/gemini-2.0-flash-thinking-exp:free | free
google/gemini-flash-1.5 | paid
google/gemini-flash-1.5-8b | paid
google/gemini-flash-1.5-8b-exp | paid
google/gemini-pro-1.5 | paid
google/gemini-2.0-flash-001 | paid
google/gemini-2.0-flash-exp:free | free
google/gemini-pro | paid
google/gemini-pro-1.5 | paid
google/gemini-2.0-pro-exp-02-05:free | free
google/gemini-2.0-flash-lite-001 | paid
google/gemini-2.0-flash-thinking-exp-1219:free | free
google/gemini-2.0-flash-thinking-exp:free | free
google/gemini-2.5-flash-preview | paid
google/gemini-2.5-flash-preview:thinking | paid
google/gemini-2.5-pro-exp-03-25:free | free
google/gemini-2.5-pro-preview-03-25 | paid
google/gemini-pro | paid
google/gemini-pro-vision | paid
google/gemma-2-27b-it | paid
google/gemma-2-9b-it | paid
@ -121,7 +126,6 @@ export interface IKBotOptions {
google/gemma-3-27b-it:free | free
google/gemma-3-4b-it | paid
google/gemma-3-4b-it:free | free
google/gemma-7b-it | paid
google/learnlm-1.5-pro-experimental:free | free
google/palm-2-chat-bison | paid
google/palm-2-chat-bison-32k | paid
@ -144,7 +148,6 @@ export interface IKBotOptions {
meta-llama/llama-2-70b-chat | paid
meta-llama/llama-3-70b-instruct | paid
meta-llama/llama-3-8b-instruct | paid
meta-llama/llama-3-8b-instruct:free | free
meta-llama/llama-3.1-405b | paid
meta-llama/llama-3.1-405b-instruct | paid
meta-llama/llama-3.1-70b-instruct | paid
@ -159,13 +162,15 @@ export interface IKBotOptions {
meta-llama/llama-3.2-90b-vision-instruct | paid
meta-llama/llama-3.3-70b-instruct | paid
meta-llama/llama-3.3-70b-instruct:free | free
meta-llama/llama-4-maverick | paid
meta-llama/llama-4-maverick:free | free
meta-llama/llama-4-scout | paid
meta-llama/llama-4-scout:free | free
meta-llama/llama-guard-2-8b | paid
microsoft/phi-4 | paid
microsoft/phi-4-multimodal-instruct | paid
microsoft/phi-3-medium-128k-instruct | paid
microsoft/phi-3-medium-128k-instruct:free | free
microsoft/phi-3-mini-128k-instruct | paid
microsoft/phi-3-mini-128k-instruct:free | free
microsoft/phi-3.5-mini-128k-instruct | paid
sophosympatheia/midnight-rose-70b | paid
minimax/minimax-01 | paid
@ -193,14 +198,13 @@ export interface IKBotOptions {
mistralai/mistral-small-3.1-24b-instruct | paid
mistralai/mistral-small-3.1-24b-instruct:free | free
mistralai/mixtral-8x22b-instruct | paid
mistralai/mixtral-8x7b | paid
mistralai/mixtral-8x7b-instruct | paid
mistralai/pixtral-12b | paid
mistralai/pixtral-large-2411 | paid
mistralai/mistral-saba | paid
moonshotai/kimi-vl-a3b-thinking:free | free
moonshotai/moonlight-16b-a3b-instruct:free | free
gryphe/mythomax-l2-13b | paid
gryphe/mythomax-l2-13b:free | free
neversleep/llama-3-lumimaid-70b | paid
neversleep/llama-3-lumimaid-8b | paid
neversleep/llama-3-lumimaid-8b:extended | paid
@ -215,6 +219,9 @@ export interface IKBotOptions {
nousresearch/hermes-2-pro-llama-3-8b | paid
nvidia/llama-3.1-nemotron-70b-instruct | paid
nvidia/llama-3.1-nemotron-70b-instruct:free | free
nvidia/llama-3.1-nemotron-nano-8b-v1:free | free
nvidia/llama-3.1-nemotron-ultra-253b-v1:free | free
nvidia/llama-3.3-nemotron-super-49b-v1:free | free
open-r1/olympiccoder-32b:free | free
open-r1/olympiccoder-7b:free | free
openai/chatgpt-4o-latest | paid
@ -231,6 +238,9 @@ export interface IKBotOptions {
openai/gpt-4-turbo | paid
openai/gpt-4-1106-preview | paid
openai/gpt-4-turbo-preview | paid
openai/gpt-4.1 | paid
openai/gpt-4.1-mini | paid
openai/gpt-4.1-nano | paid
openai/gpt-4.5-preview | paid
openai/gpt-4o | paid
openai/gpt-4o-2024-05-13 | paid
@ -247,11 +257,13 @@ export interface IKBotOptions {
openai/o1-preview | paid
openai/o1-preview-2024-09-12 | paid
openai/o1-pro | paid
openai/o3 | paid
openai/o3-mini | paid
openai/o3-mini-high | paid
openai/o4-mini | paid
openai/o4-mini-high | paid
openchat/openchat-7b | paid
openchat/openchat-7b:free | free
teknium/openhermes-2.5-mistral-7b | paid
all-hands/openhands-lm-32b-v0.1 | paid
perplexity/llama-3.1-sonar-large-128k-online | paid
perplexity/llama-3.1-sonar-small-128k-online | paid
perplexity/r1-1776 | paid
@ -262,14 +274,13 @@ export interface IKBotOptions {
perplexity/sonar-reasoning-pro | paid
pygmalionai/mythalion-13b | paid
qwen/qwen-2-72b-instruct | paid
qwen/qwen-2-7b-instruct | paid
qwen/qwen-2-7b-instruct:free | free
qwen/qwen-vl-max | paid
qwen/qwen-vl-plus | paid
qwen/qwen-max | paid
qwen/qwen-plus | paid
qwen/qwen-turbo | paid
qwen/qwen2.5-32b-instruct | paid
qwen/qwen2.5-coder-7b-instruct | paid
qwen/qwen2.5-vl-32b-instruct | paid
qwen/qwen2.5-vl-32b-instruct:free | free
qwen/qwen2.5-vl-3b-instruct:free | free
qwen/qwen2.5-vl-72b-instruct | paid
@ -284,6 +295,7 @@ export interface IKBotOptions {
qwen/qwen-2.5-72b-instruct | paid
qwen/qwen-2.5-72b-instruct:free | free
qwen/qwen-2.5-7b-instruct | paid
qwen/qwen-2.5-7b-instruct:free | free
qwen/qwen-2.5-coder-32b-instruct | paid
qwen/qwen-2.5-coder-32b-instruct:free | free
featherless/qwerky-72b:free | free
@ -296,13 +308,14 @@ export interface IKBotOptions {
sao10k/l3.1-70b-hanami-x1 | paid
sao10k/l3.1-euryale-70b | paid
sao10k/l3.3-euryale-70b | paid
shisa-ai/shisa-v2-llama3.3-70b:free | free
raifle/sorcererlm-8x22b | paid
steelskull/l3.3-electra-r1-70b | paid
tokyotech-llm/llama-3.1-swallow-70b-instruct-v0.3 | paid
thedrummer/anubis-pro-105b-v1 | paid
thedrummer/skyfall-36b-v2 | paid
thudm/glm-4-32b:free | free
thudm/glm-z1-32b:free | free
undi95/toppy-m-7b | paid
undi95/toppy-m-7b:free | free
scb10x/llama3.1-typhoon2-70b-instruct | paid
scb10x/llama3.1-typhoon2-8b-instruct | paid
thedrummer/unslopnemo-12b | paid
@ -310,6 +323,8 @@ export interface IKBotOptions {
microsoft/wizardlm-2-8x22b | paid
x-ai/grok-2-1212 | paid
x-ai/grok-2-vision-1212 | paid
x-ai/grok-3-beta | paid
x-ai/grok-3-mini-beta | paid
x-ai/grok-beta | paid
x-ai/grok-vision-beta | paid
xwin-lm/xwin-lm-70b | paid
@ -334,6 +349,12 @@ export interface IKBotOptions {
gpt-4-turbo
gpt-4-turbo-2024-04-09
gpt-4-turbo-preview
gpt-4.1
gpt-4.1-2025-04-14
gpt-4.1-mini
gpt-4.1-mini-2025-04-14
gpt-4.1-nano
gpt-4.1-nano-2025-04-14
gpt-4.5-preview
gpt-4.5-preview-2025-02-27
gpt-4o
@ -369,6 +390,8 @@ export interface IKBotOptions {
o1-pro-2025-03-19
o3-mini
o3-mini-2025-01-31
o4-mini
o4-mini-2025-04-16
omni-moderation-2024-09-26
omni-moderation-latest
text-embedding-3-large
@ -425,6 +448,8 @@ export interface IKBotOptions {
JSON,JSONUnescape,JSONPretty,AlphaSort,code,JSONParse,trim
*/
filters?: (string | ("JSON" | "JSONUnescape" | "JSONPretty" | "AlphaSort" | "code" | "JSONParse" | "trim")[] | string[] | ((...args_0: unknown[]) => unknown)[]);
/** JSONPath query to be used to transform input objects */
query?: (string | null);
/** Dry run - only write out parameters without making API calls */
dry?: (boolean | string);
/** Format for structured outputs. Can be a Zod schema, a Zod schema string, a JSON schema string, or a path to a JSON file. */