refactor: link web-search/code-interpreter in ci (#71)

This commit is contained in:
sigoden
2024-07-10 23:52:38 +08:00
committed by GitHub
parent 732eae532c
commit 1f784e3db5
2 changed files with 14 additions and 1 deletions
+5
View File
@@ -40,6 +40,11 @@ jobs:
with: with:
python-version: '3.11' python-version: '3.11'
- name: Link web-search and code-interpreter
run: |
argc link-web-search search_tavily.sh
argc link-code-interpreter execute_py_code.py
- name: Run Test - name: Run Test
run: argc test run: argc test
env: env:
+9 -1
View File
@@ -259,6 +259,7 @@ build-declarations@agent() {
fi fi
not_found_agents=() not_found_agents=()
build_failed_agents=() build_failed_agents=()
exist_tools="$(ls -1 tools)"
for name in "${names[@]}"; do for name in "${names[@]}"; do
agent_dir="agents/$name" agent_dir="agents/$name"
declarations_file="$agent_dir/functions.json" declarations_file="$agent_dir/functions.json"
@@ -282,6 +283,12 @@ build-declarations@agent() {
fi fi
done done
if [[ -f "$tool_names_file" ]]; then if [[ -f "$tool_names_file" ]]; then
if grep -q '^web_search\.' "$tool_names_file" && ! grep -q '^web_search\.' <<<"$exist_tools"; then
echo "WARNING: no found web_search tool, please run \`argc link-web-search\` to set one."
fi
if grep -q '^code_interpreter\.' "$tool_names_file" && ! grep -q '^code_interpreter\.' <<<"$exist_tools"; then
echo "WARNING: no found code_interpreter tool, please run \`argc link-code-interpreter\` to set one."
fi
tools_json_data="$(argc build-declarations@tool --names-file="$tool_names_file" --declarations-file=-)" || { tools_json_data="$(argc build-declarations@tool --names-file="$tool_names_file" --declarations-file=-)" || {
ok=false ok=false
build_failed_agents+=("$name") build_failed_agents+=("$name")
@@ -545,8 +552,9 @@ _link_tool() {
if _is_win; then if _is_win; then
(cd tools && cmd <<< "mklink $to $from" > /dev/null) (cd tools && cmd <<< "mklink $to $from" > /dev/null)
else else
(cd tools && ln -rs $from $to) (cd tools && ln -s $from $to)
fi fi
(cd tools && ls -l $to)
} }
_ask_json_data() { _ask_json_data() {