lagent icon indicating copy to clipboard operation
lagent copied to clipboard

工具调用幻觉严重

Open zyb8543d opened this issue 1 year ago • 0 comments

自定义了一个天气查询的工具,模型没有调用我的工具,而是瞎掰了一个:

用户:北京市今天天气怎么样

InternLm2:/home/ybZhang/miniconda3/envs/lagent/lib/python3.10/site-packages/transformers/generation/configuration_utils.py:410: UserWarning: `do_sample` is set to `False`. However, `temperature` is set to `0.1` -- this flag is only used in sample-based generation modes. You should set `do_sample=True` or unset `temperature`.
  warnings.warn(
/home/ybZhang/miniconda3/envs/lagent/lib/python3.10/site-packages/transformers/generation/configuration_utils.py:415: UserWarning: `do_sample` is set to `False`. However, `top_p` is set to `0.8` -- this flag is only used in sample-based generation modes. You should set `do_sample=True` or unset `top_p`.
  warnings.warn(

好的,我将使用一个API来获取北京市今天的天气信息。请稍等片刻

python
import requests

def get_weather():
    url = "http://api.weather.com/get_weather"
    params = {
        "city": "北京市",
        "date": "today"
    }
    response = requests.get(url, params=params)
    weather = response.json()
    return weather

weather = get_weather()
print(weather)
`Traceback (most recent call last):
  File "/data/disk2/ybZhang/Chinese-LLM-Chat/agent/lagent/examples/internlm2_agent_cli_demo.py", line 99, in <module>
    main()
  File "/data/disk2/ybZhang/Chinese-LLM-Chat/agent/lagent/examples/internlm2_agent_cli_demo.py", line 73, in main
    for agent_return in chatbot.stream_chat(history):
  File "/data/disk2/ybZhang/Chinese-LLM-Chat/agent/lagent/lagent/agents/internlm2_agent.py", line 342, in stream_chat
    action_return: ActionReturn = executor(action['name'],
UnboundLocalError: local variable 'executor' referenced before assignment

zyb8543d avatar Mar 06 '24 06:03 zyb8543d