OpenBMB / ToolBench

[ICLR'24 spotlight] An open platform for training, serving, and evaluating large language model for tool learning.
https://openbmb.github.io/ToolBench/
Apache License 2.0
4.6k stars 397 forks source link

TypeError: 'NoneType' object is not subscriptable #243

Open JingfengYang opened 4 months ago

JingfengYang commented 4 months ago

When I run

export TOOLBENCH_KEY=""
export OPENAI_KEY=""
export PYTHONPATH=./
python toolbench/inference/qa_pipeline.py \
    --tool_root_dir data/toolenv/tools/ \
    --backbone_model davinci \
    --openai_key $OPENAI_KEY \
    --max_observation_length 1024 \
    --method CoT@1 \
    --input_query_file data/test_instruction/G1_instruction.json \
    --output_answer_file data/our_generation/G1_instruction/davinci_cot_inference_result \
    --rapidapi_key "" \
    --use_rapidapi_key

I encounter the error below:

╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ /Volumes/workplace/agent/ToolBench/toolbench/inference/qa_pipeline.py:33 in <module>             │
│                                                                                                  │
│   30 │   args = parser.parse_args()                                                              │
│   31 │                                                                                           │
│   32 │   pipeline_runner = pipeline_runner(args)                                                 │
│ ❱ 33 │   pipeline_runner.run()                                                                   │
│   34                                                                                             │
│   35                                                                                             │
│                                                                                                  │
│ /Volumes/workplace/agent/ToolBench/toolbench/inference/Downstream_tasks/rapidapi.py:551 in run   │
│                                                                                                  │
│   548 │   │   │   retriever = None                                                               │
│   549 │   │   for k, task in enumerate(task_list):                                               │
│   550 │   │   │   print(f"process[{self.process_id}] doing task {k}/{len(task_list)}: real_tas   │
│ ❱ 551 │   │   │   result = self.run_single_task(*task, retriever=retriever, process_id=self.pr   │
│   552                                                                                            │
│   553                                                                                            │
│                                                                                                  │
│ /Volumes/workplace/agent/ToolBench/toolbench/inference/Downstream_tasks/rapidapi.py:497 in       │
│ run_single_task                                                                                  │
│                                                                                                  │
│   494 │   │   if (not server) and os.path.exists(output_file_path):                              │
│   495 │   │   │   return                                                                         │
│   496 │   │   [callback.on_tool_retrieval_start() for callback in callbacks]                     │
│ ❱ 497 │   │   env = rapidapi_wrapper(data_dict, tool_des, retriever, args, process_id=process_   │
│   498 │   │   [callback.on_tool_retrieval_end(                                                   │
│   499 │   │   │   tools=env.functions                                                            │
│   500 │   │   ) for callback in callbacks]                                                       │
│                                                                                                  │
│ /Volumes/workplace/agent/ToolBench/toolbench/inference/Downstream_tasks/rapidapi.py:124 in       │
│ __init__                                                                                         │
│                                                                                                  │
│   121 │   │   │   unduplicated_reflection[standardize_tool_name] = tool_des                      │
│   122 │   │                                                                                      │
│   123 │   │   for k,(standardize_tool_name, tool_des) in enumerate(unduplicated_reflection.ite   │
│ ❱ 124 │   │   │   striped = tool_des[:512].replace('\n','').strip()                              │
│   125 │   │   │   if striped == "":                                                              │
│   126 │   │   │   │   striped = "None"                                                           │
│   127 │   │   │   self.task_description += f"{k+1}.{standardize_tool_name}: {striped}\n"         │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
TypeError: 'NoneType' object is not subscriptable

Any suggestions? Thanks!