read url tool
This commit is contained in:
@@ -44,8 +44,8 @@ export const AllMediaTypes = [
|
||||
|
||||
2. EXTRACT NEW INFORMATION
|
||||
|
||||
New information will be pulled from the internet.
|
||||
If you do not see a web search tool, let me know.
|
||||
Fetch information from the internet using the search web and read url tools.
|
||||
If you do not see either of these tools, stop and let me know.
|
||||
|
||||
Retrieve the following sites per these providers, and consider these notes on how to extract the information:
|
||||
- "gemini": https://ai.google.dev/gemini-api/docs/models - maxCompletionTokens is called "Output token limit", contextLength is called "Input token limit"
|
||||
|
||||
@@ -11,6 +11,7 @@ export enum BuiltInToolNames {
|
||||
LSTool = "builtin_ls",
|
||||
CreateRuleBlock = "builtin_create_rule_block",
|
||||
RequestRule = "builtin_request_rule",
|
||||
ReadUrl = "builtin_read_url",
|
||||
|
||||
// excluded from allTools for now
|
||||
ViewRepoMap = "builtin_view_repo_map",
|
||||
|
||||
@@ -10,6 +10,7 @@ import { grepSearchImpl } from "./implementations/grepSearch";
|
||||
import { lsToolImpl } from "./implementations/lsTool";
|
||||
import { readCurrentlyOpenFileImpl } from "./implementations/readCurrentlyOpenFile";
|
||||
import { readFileImpl } from "./implementations/readFile";
|
||||
import { readUrlImpl } from "./implementations/readUrl";
|
||||
import { requestRuleImpl } from "./implementations/requestRule";
|
||||
import { runTerminalCommandImpl } from "./implementations/runTerminalCommand";
|
||||
import { searchWebImpl } from "./implementations/searchWeb";
|
||||
@@ -151,6 +152,8 @@ async function callBuiltInTool(
|
||||
return await runTerminalCommandImpl(args, extras);
|
||||
case BuiltInToolNames.SearchWeb:
|
||||
return await searchWebImpl(args, extras);
|
||||
case BuiltInToolNames.ReadUrl:
|
||||
return await readUrlImpl(args, extras);
|
||||
case BuiltInToolNames.ViewDiff:
|
||||
return await viewDiffImpl(args, extras);
|
||||
case BuiltInToolNames.LSTool:
|
||||
|
||||
@@ -14,6 +14,7 @@ export const editFileTool: Tool = {
|
||||
hasAlready: "edited {{{ filepath }}}",
|
||||
group: BUILT_IN_GROUP_NAME,
|
||||
readonly: false,
|
||||
isInstant: false,
|
||||
function: {
|
||||
name: BuiltInToolNames.EditExistingFile,
|
||||
description:
|
||||
|
||||
28
core/tools/definitions/readURL.ts
Normal file
28
core/tools/definitions/readURL.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
import { Tool } from "../..";
|
||||
import { BUILT_IN_GROUP_NAME, BuiltInToolNames } from "../builtIn";
|
||||
|
||||
export const readUrlTool: Tool = {
|
||||
type: "function",
|
||||
displayTitle: "Read URL",
|
||||
wouldLikeTo: "fetch {{{ url }}}",
|
||||
isCurrently: "fetching {{{ url }}}",
|
||||
hasAlready: "viewed {{{ url }}}",
|
||||
readonly: true,
|
||||
isInstant: true,
|
||||
group: BUILT_IN_GROUP_NAME,
|
||||
function: {
|
||||
name: BuiltInToolNames.ReadUrl,
|
||||
description:
|
||||
"Can be used to view the contents of a website using a URL. Do NOT use this for files.",
|
||||
parameters: {
|
||||
type: "object",
|
||||
required: ["url"],
|
||||
properties: {
|
||||
url: {
|
||||
type: "string",
|
||||
description: "The URL to read",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
6
core/tools/implementations/readUrl.ts
Normal file
6
core/tools/implementations/readUrl.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
import { ToolImpl } from ".";
|
||||
import { getUrlContextItems } from "../../context/providers/URLContextProvider";
|
||||
|
||||
export const readUrlImpl: ToolImpl = async (args, extras) => {
|
||||
return getUrlContextItems(args.url, extras.fetch);
|
||||
};
|
||||
@@ -7,6 +7,7 @@ import { grepSearchTool } from "./definitions/grepSearch";
|
||||
import { lsTool } from "./definitions/lsTool";
|
||||
import { readCurrentlyOpenFileTool } from "./definitions/readCurrentlyOpenFile";
|
||||
import { readFileTool } from "./definitions/readFile";
|
||||
import { readUrlTool } from "./definitions/readURL";
|
||||
import { requestRuleTool } from "./definitions/requestRule";
|
||||
import { runTerminalCommandTool } from "./definitions/runTerminalCommand";
|
||||
import { searchWebTool } from "./definitions/searchWeb";
|
||||
@@ -24,6 +25,7 @@ export const baseToolDefinitions = [
|
||||
readCurrentlyOpenFileTool,
|
||||
lsTool,
|
||||
createRuleBlock,
|
||||
readUrlTool,
|
||||
// replacing with ls tool for now
|
||||
// viewSubdirectoryTool,
|
||||
// viewRepoMapTool,
|
||||
|
||||
@@ -41,6 +41,7 @@ const toolCallIcons: Record<string, ComponentType> = {
|
||||
[BuiltInToolNames.LSTool]: FolderIcon,
|
||||
[BuiltInToolNames.ReadCurrentlyOpenFile]: DocumentTextIcon,
|
||||
[BuiltInToolNames.ReadFile]: DocumentIcon,
|
||||
[BuiltInToolNames.ReadUrl]: GlobeAltIcon,
|
||||
[BuiltInToolNames.SearchWeb]: GlobeAltIcon,
|
||||
[BuiltInToolNames.ViewDiff]: CodeBracketIcon,
|
||||
[BuiltInToolNames.ViewRepoMap]: MapIcon,
|
||||
|
||||
@@ -53,6 +53,7 @@ export const uiSlice = createSlice({
|
||||
[BuiltInToolNames.GrepSearch]: "allowedWithoutPermission",
|
||||
[BuiltInToolNames.FileGlobSearch]: "allowedWithoutPermission",
|
||||
[BuiltInToolNames.SearchWeb]: "allowedWithoutPermission",
|
||||
[BuiltInToolNames.ReadUrl]: "disabled",
|
||||
[BuiltInToolNames.ViewDiff]: "allowedWithoutPermission",
|
||||
[BuiltInToolNames.LSTool]: "allowedWithoutPermission",
|
||||
[BuiltInToolNames.CreateRuleBlock]: "allowedWithPermission",
|
||||
|
||||
Reference in New Issue
Block a user