fs

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 19, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ReadToolName 文件读取工具名
	ReadToolName = "Read"
	// MaxReadSize 最大读取大小 1MB
	MaxReadSize = 1 << 20
)

Variables

This section is empty.

Functions

func DefineReadTool

func DefineReadTool(g *genkit.Genkit) ai.ToolRef

DefineReadTool 定义文件读取工具

Types

type ReadInput

type ReadInput struct {
	// 文件路径(绝对路径或相对路径)
	Path string `json:"path"`
	// 可选:读取的起始字节位置
	Offset int64 `json:"offset,omitempty"`
	// 可选:读取的最大字节数,0 表示使用默认值 1MB,最大不能超过 1MB
	Limit int64 `json:"limit,omitempty"`
}

ReadInput 文件读取输入

type ReadOutput

type ReadOutput struct {
	// 文件内容
	Content string `json:"content"`
	// 文件大小(字节)
	Size int64 `json:"size"`
	// 实际读取的字节数
	BytesRead int64 `json:"bytesRead"`
	// 是否被截断(文件更大但未读完)
	Truncated bool `json:"truncated,omitempty"`
}

ReadOutput 文件读取输出

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL