add schema_get_files_info and call_function
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
from google.genai import types
|
||||
from functions.get_files_info import schema_get_files_info
|
||||
|
||||
available_functions = types.Tool(
|
||||
function_declarations=[schema_get_files_info],
|
||||
)
|
||||
@@ -1,4 +1,5 @@
|
||||
import os
|
||||
from google.genai import types
|
||||
|
||||
def get_files_info(working_directory, directory="."):
|
||||
abs_path = os.path.abspath(working_directory)
|
||||
@@ -17,4 +18,19 @@ def get_files_info(working_directory, directory="."):
|
||||
dir_string += f"- {item}: file_size={os.path.getsize(f"{target_dir}/{item}")}, is_dir={os.path.isdir(f"{target_dir}/{item}")}\n"
|
||||
return dir_string
|
||||
except Exception as e:
|
||||
return f"Error: encountered during loop over dir_list: {e}"
|
||||
return f"Error: encountered during loop over dir_list: {e}"
|
||||
|
||||
|
||||
schema_get_files_info = types.FunctionDeclaration(
|
||||
name="get_files_info",
|
||||
description="Lists files in a specified directory relative to the working directory, providing file size and directory status",
|
||||
parameters=types.Schema(
|
||||
type=types.Type.OBJECT,
|
||||
properties={
|
||||
"directory": types.Schema(
|
||||
type=types.Type.STRING,
|
||||
description="Directory path to list files from, relative to the working directory (default is the working directory itself)",
|
||||
),
|
||||
},
|
||||
),
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user