We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to continue.

This lesson's interactive features are locked, please to keep using them

More Declarations

Now that our LLM agent is able to specify a function call to the get_files_info function, let's give it the ability to call the other functions as well.

Assignment

  1. - List files and directories
    

    Update it to have all four operations:

    - List files and directories
    - Read file contents
    - Execute Python files with optional arguments
    - Write or overwrite files
    
    • "read the contents of main.py" -> get_file_content({'file_path': 'main.py'})
    • "write 'hello' to main.txt" -> write_file({'file_path': 'main.txt', 'content': 'hello'})
    • "run main.py" -> run_python_file({'file_path': 'main.py'})
    • "list the contents of the pkg directory" -> get_files_info({'directory': 'pkg'})

The LLM is still just choosing which functions to call based on the user's request. We'll have it actually call functions soon.

Submit the CLI tests.

Tips

  • Add each function's required arguments to a required list inside parameters: file_path for get_file_content and run_python_file, and both file_path and content for write_file.
  • The write_file declaration needs both file_path and content in parameters.properties.
  • Most parameter types are "string", but the optional args parameter of run_python_file is an "array" whose "items" are "string".
  • Descriptions don't need to match the solution exactly, but they should clearly explain each function and parameter.