GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • ADK for TypeScript: API Reference

This view

  • Original page
  • New address

GeezerVison is showing adk.dev — FilesRetrieval | ADK for TypeScript: API Reference - v2.5.0

  • FilesRetrieval

Class FilesRetrieval

A retrieval tool over the files in a local directory.

Ported from adk-python src/google/adk/tools/retrieval/files_retrieval.py at ref v0.1.0.

adk-python reads the directory and builds the index inside __init__. Both steps are asynchronous in LlamaIndexTS, so they live in the static create instead; the constructor takes the finished retriever, which also lets a caller supply one built some other way.

Example

const tool = await FilesRetrieval.create({
name: 'docs',
description: 'Company documentation.',
inputDir: './docs',
});

Hierarchy (View Summary)

  • LlamaIndexRetrieval
    • FilesRetrieval
  • Defined in core/src/tools/retrieval/files_retrieval.ts:87

Constructors

constructor

  • new FilesRetrieval(params: FilesRetrievalConstructorParams): FilesRetrieval

    Parameters

    • params: FilesRetrievalConstructorParams

    Returns FilesRetrieval

    Overrides LlamaIndexRetrieval.constructor

    • Defined in core/src/tools/retrieval/files_retrieval.ts:90

Properties

Readonly[BASE_RETRIEVAL_TOOL_SIGNATURE_SYMBOL]

"[BASE_RETRIEVAL_TOOL_SIGNATURE_SYMBOL]": true

Unique symbol to identify BaseRetrievalTool class.

Inherited from LlamaIndexRetrieval.[BASE_RETRIEVAL_TOOL_SIGNATURE_SYMBOL]

  • Defined in core/src/tools/retrieval/base_retrieval_tool.ts:47

Readonly[BASE_TOOL_SIGNATURE_SYMBOL]

"[BASE_TOOL_SIGNATURE_SYMBOL]": true

A unique symbol to identify ADK base tool class.

Inherited from LlamaIndexRetrieval.[BASE_TOOL_SIGNATURE_SYMBOL]

  • Defined in core/src/tools/base_tool.ts:83

Readonlydescription

description: string

Inherited from LlamaIndexRetrieval.description

  • Defined in core/src/tools/base_tool.ts:86

ReadonlyinputDir

inputDir: string
  • Defined in core/src/tools/retrieval/files_retrieval.ts:88

ReadonlyisLongRunning

isLongRunning: boolean

Inherited from LlamaIndexRetrieval.isLongRunning

  • Defined in core/src/tools/base_tool.ts:87

Readonlyname

name: string

Inherited from LlamaIndexRetrieval.name

  • Defined in core/src/tools/base_tool.ts:85

Readonlyretriever

retriever: LlamaIndexRetriever

Inherited from LlamaIndexRetrieval.retriever

  • Defined in core/src/tools/retrieval/llama_index_retrieval.ts:65

Accessors

apiVariant

  • get apiVariant(): GoogleLLMVariant

    The Google API LLM variant to use.

    Returns GoogleLLMVariant

    Inherited from LlamaIndexRetrieval.apiVariant

    • Defined in core/src/tools/base_tool.ts:198

Methods

_getDeclaration

  • _getDeclaration(): FunctionDeclaration

    Gets the OpenAPI specification of this tool in the form of a FunctionDeclaration.

    NOTE

    • Required if subclass uses the default implementation of processLlmRequest to add function declaration to LLM request.
    • Otherwise, can be skipped, e.g. for a built-in GoogleSearch tool for Gemini.

    Returns FunctionDeclaration

    The FunctionDeclaration of this tool, or undefined if it doesn't need to be added to LlmRequest.config.

    Inherited from LlamaIndexRetrieval._getDeclaration

    • Defined in core/src/tools/retrieval/base_retrieval_tool.ts:49

checkRequireConfirmation

  • checkRequireConfirmation(
        _args: Record<string, unknown>,
        _toolContext?: Context,
    ): Promise<boolean>

    Whether this tool needs a human to approve args before it runs.

    The gate itself lives in the tool that owns it (see FunctionTool), but the resume path has to ask the same question a turn later, to check that an approval it is about to honour belongs to a tool that gates at all. A tool that never gates returns false here, which is the safe default: an approval naming it is meaningless and gets rejected rather than executed. Mirrors Python's BaseTool.check_require_confirmation.

    Parameters

    • _args: Record<string, unknown>

      The arguments the tool would run with.

    • Optional_toolContext: Context

      The context of the call, when there is one.

    Returns Promise<boolean>

    Whether the call requires confirmation.

    Inherited from LlamaIndexRetrieval.checkRequireConfirmation

    • Defined in core/src/tools/base_tool.ts:144

processLlmRequest

  • processLlmRequest(request: ToolProcessLlmRequest): Promise<void>

    Processes the outgoing LLM request for this tool.

    Use cases:

    • Most common use case is adding this tool to the LLM request.
    • Some tools may just preprocess the LLM request before it's sent out.

    Parameters

    • request: ToolProcessLlmRequest

      The request to process the LLM request.

    Returns Promise<void>

    Inherited from LlamaIndexRetrieval.processLlmRequest

    • Defined in core/src/tools/base_tool.ts:160

runAsync

  • runAsync(request: RunAsyncToolRequest): Promise<unknown>

    Runs the tool with the given arguments and context.

    NOTE

    • Required if this tool needs to run at the client side.
    • Otherwise, can be skipped, e.g. for a built-in GoogleSearch tool for Gemini.

    Parameters

    • request: RunAsyncToolRequest

      The request to run the tool.

    Returns Promise<unknown>

    A promise that resolves to the tool response.

    Inherited from LlamaIndexRetrieval.runAsync

    • Defined in core/src/tools/retrieval/llama_index_retrieval.ts:72

Staticcreate

  • create(params: FilesRetrievalParams): Promise<FilesRetrieval>

    Indexes every file under inputDir and returns a tool that retrieves from it.

    Requires the optional llamaindex and @llamaindex/readers packages, and a configured LlamaIndex embedding model.

    Parameters

    • params: FilesRetrievalParams

    Returns Promise<FilesRetrieval>

    • Defined in core/src/tools/retrieval/files_retrieval.ts:106
Constructors
constructor
Properties
[BASE_RETRIEVAL_TOOL_SIGNATURE_SYMBOL][BASE_TOOL_SIGNATURE_SYMBOL]descriptioninputDirisLongRunningnameretriever
Accessors
apiVariant
Methods
_getDeclarationcheckRequireConfirmationprocessLlmRequestrunAsynccreate
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.