feat: rename may_execute_* to execute_* (#56)

This commit is contained in:
sigoden
2024-07-03 16:18:32 +08:00
committed by GitHub
parent 970ed06d2b
commit 499b7cdef5
5 changed files with 6 additions and 14 deletions
+4 -4
View File
@@ -77,7 +77,7 @@ build() {
# @option --declarations-file=functions.json <FILE> Path to a json file to save function declarations # @option --declarations-file=functions.json <FILE> Path to a json file to save function declarations
# Example: # Example:
# get_current_weather.sh # get_current_weather.sh
# may_execute_js_code.js # execute_js_code.js
# @arg tools*[`_choice_tool`] The tool filenames # @arg tools*[`_choice_tool`] The tool filenames
build@tool() { build@tool() {
if [[ "${#argc_tools[@]}" -gt 0 ]]; then if [[ "${#argc_tools[@]}" -gt 0 ]]; then
@@ -347,9 +347,9 @@ test-execute-code-tools() {
ext=".cmd" ext=".cmd"
fi fi
test_cases=( \ test_cases=( \
'sh#may_execute_command#{"command":"echo \"✓\""}' \ 'sh#execute_command#{"command":"echo \"✓\""}' \
'js#may_execute_js_code#{"code":"console.log(\"✓\")"}' \ 'js#execute_js_code#{"code":"console.log(\"✓\")"}' \
'py#may_execute_py_code#{"code":"print(\"✓\")"}' \ 'py#execute_py_code#{"code":"print(\"✓\")"}' \
) )
for test_case in "${test_cases[@]}"; do for test_case in "${test_cases[@]}"; do
+2 -10
View File
@@ -45,23 +45,15 @@ ln -s "$(pwd)" "$(aichat --info | grep -w functions_dir | awk '{print $2}')"
argc install argc install
``` ```
Don't forget to add the following config to your AIChat `config.yaml` file:
```yaml
function_calling: true
```
AIChat will automatically load `functions.json` and execute commands located in the `./bin` directory based on your prompts. AIChat will automatically load `functions.json` and execute commands located in the `./bin` directory based on your prompts.
**4. Start using your functions:** **4. Start using your functions:**
Now you can interact with your LLM using natural language prompts that trigger your defined functions. Now you can interact with your LLM using natural language prompts that trigger your defined functions.
## AIChat Showcases ## Showcases
![retrieve-type-showcase](https://github.com/sigoden/llm-functions/assets/4012553/7e628834-9863-444a-bad8-7b51bfb18dff) ![tools-showcase](https://github.com/sigoden/aichat/assets/4012553/f9d7f827-9a2a-4ea1-8b8c-19e1c93178d4)
![execute-type-showcase](https://github.com/sigoden/llm-functions/assets/4012553/1dbc345f-daf9-4d65-a49f-3df8c7df1727)
![agent-showcase](https://github.com/sigoden/llm-functions/assets/4012553/05e1e57e-3bcc-4504-b78f-c36b27d16bfd) ![agent-showcase](https://github.com/sigoden/llm-functions/assets/4012553/05e1e57e-3bcc-4504-b78f-c36b27d16bfd)