Skip to main content

Class: AzureDynamicSessionTool

Azure Code Interpreter tool: A tool that allows you to interact with a dynamic session on Azure.

Implements

  • BaseTool<AzureDynamicSessionToolParams>

Constructors

new AzureDynamicSessionTool()

new AzureDynamicSessionTool(params?): AzureDynamicSessionTool

Parameters

params?: AzureDynamicSessionToolParams

Returns

AzureDynamicSessionTool

Source

packages/llamaindex/src/tools/AzureDynamicSessionTool.node.ts:189

Properties

azureADTokenProvider()

private azureADTokenProvider: () => Promise<string>

A function that returns the access token to use for the session pool.

Returns

Promise<string>

Source

packages/llamaindex/src/tools/AzureDynamicSessionTool.node.ts:187


metadata

metadata: ToolMetadata

The metadata for the tool.

Implementation of

BaseTool . metadata

Source

packages/llamaindex/src/tools/AzureDynamicSessionTool.node.ts:170


outputDir

private readonly outputDir: string

Source

packages/llamaindex/src/tools/AzureDynamicSessionTool.node.ts:165


poolManagementEndpoint

private poolManagementEndpoint: string

The endpoint of the Azure pool management service. This is where the tool will send requests to interact with the session pool. If not provided, the tool will use the value of the AZURE_CONTAINER_APP_SESSION_POOL_MANAGEMENT_ENDPOINT environment variable.

Source

packages/llamaindex/src/tools/AzureDynamicSessionTool.node.ts:182


sessionId

private sessionId: string

The session ID to use for the session pool. Defaults to a random UUID.

Source

packages/llamaindex/src/tools/AzureDynamicSessionTool.node.ts:175

Methods

_buildUrl()

_buildUrl(path): string

Parameters

path: string

Returns

string

Source

packages/llamaindex/src/tools/AzureDynamicSessionTool.node.ts:205


call()

call(code): Promise<InterpreterToolOutput>

This tool is used to execute python commands when you need to perform calculations or computations in a Session. Input should be a valid python command. The tool returns the result, stdout, and stderr.

Parameters

code: Pick<AzureDynamicSessionToolParams, "code">

Python code to be executed generated by llm.

Returns

Promise<InterpreterToolOutput>

The result, stdout, and stderr.

Implementation of

BaseTool . call

Source

packages/llamaindex/src/tools/AzureDynamicSessionTool.node.ts:324


downloadFile()

downloadFile(params): Promise<void | ReadableStream<any>>

Download a file from the session back to your local environment.

Parameters

params: DownloadFileMetadata

Returns

Promise<void | ReadableStream<any>>

The file as a ReadableStream if no localFilename is provided. Otherwise, the file is saved to the localFilename.

Source

packages/llamaindex/src/tools/AzureDynamicSessionTool.node.ts:252


exists()

private exists(file): Promise<boolean>

Check if a file exists.

Parameters

file: string

The file to check.

Returns

Promise<boolean>

True if the file exists, false otherwise.

Source

packages/llamaindex/src/tools/AzureDynamicSessionTool.node.ts:445


getOutputPath()

private getOutputPath(filename): Promise<string>

Get the output path for the file.

Parameters

filename: string

The filename to save the file as.

Returns

Promise<string>

The output path for the file.

Source

packages/llamaindex/src/tools/AzureDynamicSessionTool.node.ts:423


listFiles()

listFiles(): Promise<RemoteFileMetadata[]>

List the files in the session.

Returns

Promise<RemoteFileMetadata[]>

The metadata for the files in the session

Source

packages/llamaindex/src/tools/AzureDynamicSessionTool.node.ts:294


saveToDisk()

private saveToDisk(base64Data, ext): Promise<object>

Saves a base64 encoded file to the disk.

Parameters

base64Data: string

The base64 encoded data to save.

ext: string

The file extension.

Returns

Promise<object>

The path and filename to the saved file.

filename

filename: string

outputPath

outputPath: string

Source

packages/llamaindex/src/tools/AzureDynamicSessionTool.node.ts:388


uploadFile()

uploadFile(params): Promise<RemoteFileMetadata>

Upload a file to the session under the path /mnt/data.

Parameters

params: UploadFileMetadata

Returns

Promise<RemoteFileMetadata>

The remote file object. The list of metadatas for the uploaded files.

Source

packages/llamaindex/src/tools/AzureDynamicSessionTool.node.ts:221