Closed HalberdOfPineapple closed 1 year ago
@lightaime @zhiyu-01 Could you have a check on this?
@lightaime @zhiyu-01 Could you have a check on this?
It may be caused by its default arguments: redirect=True, which redirect "KAUST" to "KAIST" and "KAIST" to "GIST". When I set redirect=False, it deals "KAIST" correctly, but search "KAUST" returns an error: An error occurred: "KAUST" resulted in a redirect. Set the redirect property to True to allow automatic redirects. I will remove the function "search_wiki_by_api" and try to fix it.
@lightaime @zhiyu-01 Could you have a check on this?
It may be caused by its default arguments: redirect=True, which redirect "KAUST" to "KAIST" and "KAIST" to "GIST". When I set redirect=False, it deals "KAIST" correctly, but search "KAUST" returns an error: An error occurred: "KAUST" resulted in a redirect. Set the redirect property to True to allow automatic redirects. I will remove the function "search_wiki_by_api" and try to fix it.
Thanks for your reply. I just found the reason should lie in auto_suggest
as said in https://stackoverflow.com/questions/66630711/the-wikipedia-api-seems-to-almost-always-get-the-word-in-question-wrong. I have modified a version and will push to a new branch soon.
@lightaime @zhiyu-01 Could you have a check on this?
It may be caused by its default arguments: redirect=True, which redirect "KAUST" to "KAIST" and "KAIST" to "GIST". When I set redirect=False, it deals "KAIST" correctly, but search "KAUST" returns an error: An error occurred: "KAUST" resulted in a redirect. Set the redirect property to True to allow automatic redirects. I will remove the function "search_wiki_by_api" and try to fix it.
Thanks for your reply. The reason should lie in
auto_suggest
as said in https://stackoverflow.com/questions/66630711/the-wikipedia-api-seems-to-almost-always-get-the-word-in-question-wrong. I have modified a version and will push to a new branch soon. This is my new code: result = wikipedia.search(entity) print(result) result = wikipedia.summary(result[0], sentences=5, redirect=False, auto_suggest=False) The result is: ['King Abdullah University of Science and Technology', 'Shaheen (supercomputer)', 'Thuwal', 'Saudi Arabia', 'Nadhmi Al-Nasr', 'Marc G. Genton', 'Jürgen Schmidhuber', 'Lubna Olayan', 'Amin H. Nasser', 'Koch snowflake']
King Abdullah University of Science and Technology (KAUST; Arabic: جامعة الملك عبد الله للعلوم و التقنية jāmiʿat al-malik ʿabd al-Lāh li-l-ʿulūm wa-t-teqniyya) is a public research university located in Thuwal, Saudi Arabia. Founded in 2009, the university provides research and graduate training programs in English as the official language of instruction. KAUST is the first mixed-gender university campus in Saudi Arabia. In 2013, the university was among the 500 fastest growing research and citation records in the world. In the 2016 Nature Index Rising Stars, the university ranked 19th in the world of the fastest rising universities for high quality research output.
Maybe you want take consider of the wikipedia.search() function, it will give a list contains what wikipedia can get.
Maybe you want take consider of the wikipedia.search() function, it will give a list contains what wikipedia can get.
True I have considered this. But it is a bit of tedious to iterate through the list. Actually the redirect
can be kept True to solve the ambiguity redirection. The original problem lies in auto_suggest
can directly change the search word (such as KAUST
-> KAIST
)
I just tried it, it looks good.
Required prerequisites
What version of camel are you using?
0.1.0
System information
3.10.10 (main, Mar 21 2023, 18:45:11) [GCC 11.2.0] linux 0.1.0
Problem description
There are some problems observed in running
role_playing_with_function_call.py
with using the modulecamel/functions/search_functions.py
updated in #253.To ensure the reproducibility, I set the temperature to be 0.0 in the example (though there can still occur some variations between different executions).
Firstly, we now have two functions performing almost the same functionality of searching information in Wikipedia but I have only observed the agent uses the original one (
search_wiki
, implemented by hand).Thus, to test the effect of the new function
search_wiki_by_api
, I removed the originalsearch_wiki
fromSEARCH_FUNCS
making the model only aware of the new function. Here comes a problem that the user becomes "idle", it can only output the single response "Apologies for the confusion, but as an AI, I'm ready to receive your instructions. Please proceed with the task., as shown below:where the execution was stuck into an infinite loop. And the first reponse returned by the assistant was incorrect, which did not call the search function and was about KAIST instead of KAUST.
I suspect the problem arises from that the annotations (note that the annotations are essentially the prompt to explain the function to the model) given to the new function
search_wiki_by_api
may be too implementation-related. And I replaced the annotation of it to be:After this I then called the
role_playing_with_function_call.py
, this time the function calling can be correctly called without the user being idle. But the problem is that, when "KAUST" is the entity word to be searched, the returned result by wikipedia API (wikipedia.summary
) is the summary about KAIST like below:Reproducible example code
The Python snippets:
Command lines:
Steps to reproduce:
pip install -e .
python examples/function_call/role_playing_with_function.py
Traceback
No response
Expected behavior
No response
Additional context
No response