Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Maximum context length exceeded after google_search #2871

Closed
1 task done
xixixi2000 opened this issue Apr 22, 2023 · 4 comments · Fixed by #3222
Closed
1 task done

Maximum context length exceeded after google_search #2871

xixixi2000 opened this issue Apr 22, 2023 · 4 comments · Fixed by #3222
Labels
bug Something isn't working function: browse

Comments

@xixixi2000
Copy link

⚠️ Search for existing issues first ⚠️

  • I have searched the existing issues, and there is no existing issue for my problem

Which Operating System are you using?

Linux

Which version of Auto-GPT are you using?

Latest Release

GPT-3 or GPT-4?

GPT-3.5

Steps to reproduce 🕹

After Auto-GPT make 2 or 3 repeated queries, the result is not so big, no split_text called , but the error occurs, Auto-GPT adds the 2-3 results together ?

THOUGHTS: I think we should start by searching for some popular tourist destinations in Xinjiang and then plan our itinerary accordingly. We can also look for some car rental services in the area.
REASONING: By searching for popular tourist destinations, we can get an idea of what places are worth visiting and plan our itinerary accordingly. Additionally, by looking for car rental services, we can determine the feasibility of renting a car for the trip.
PLAN:

  • Search for popular tourist destinations in Xinjiang
  • Look for car rental services in the area
  • Plan itinerary based on the destinations found
    CRITICISM: I need to make sure that I am not just relying on the most popular tourist destinations and that I am considering other factors such as cost and time constraints.
    NEXT ACTION: COMMAND = google ARGUMENTS = {'input': '新疆旅游景点'}
    Enter 'y' to authorise command, 'y -N' to run N continuous commands, 'n' to exit program, or enter feedback for ...
    Input:y

Traceback (most recent call last):
File "/usr/lib/python3.9/runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/lib/python3.9/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/root/Auto-GPT/autogpt/main.py", line 5, in
autogpt.cli.main()
File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 1130, in call
return self.main(*args, **kwargs)
File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 1055, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 1635, in invoke
rv = super().invoke(ctx)
File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 760, in invoke
return __callback(*args, **kwargs)
File "/usr/local/lib/python3.9/dist-packages/click/decorators.py", line 26, in new_func
return f(get_current_context(), *args, **kwargs)
File "/root/Auto-GPT/autogpt/cli.py", line 151, in main
agent.start_interaction_loop()
File "/root/Auto-GPT/autogpt/agent/agent.py", line 75, in start_interaction_loop
assistant_reply = chat_with_ai(
File "/root/Auto-GPT/autogpt/chat.py", line 85, in chat_with_ai
else permanent_memory.get_relevant(str(full_message_history[-9:]), 10)
File "/root/Auto-GPT/autogpt/memory/local.py", line 124, in get_relevant
embedding = create_embedding_with_ada(text)
File "/root/Auto-GPT/autogpt/llm_utils.py", line 155, in create_embedding_with_ada
return openai.Embedding.create(
File "/usr/local/lib/python3.9/dist-packages/openai/api_resources/embedding.py", line 33, in create
response = super().create(*args, **kwargs)
File "/usr/local/lib/python3.9/dist-packages/openai/api_resources/abstract/engine_api_resource.py", line 153, in create
response, _, api_key = requestor.request(
File "/usr/local/lib/python3.9/dist-packages/openai/api_requestor.py", line 226, in request
resp, got_stream = self._interpret_response(result, stream)
File "/usr/local/lib/python3.9/dist-packages/openai/api_requestor.py", line 619, in _interpret_response
self._interpret_response_line(
File "/usr/local/lib/python3.9/dist-packages/openai/api_requestor.py", line 682, in _interpret_response_line
raise self.handle_error_response(
openai.error.InvalidRequestError: This model's maximum context length is 8191 tokens, however you requested 9564 tokens (9564 in your prompt; 0 for the completion). Please reduce your prompt; or completion length.

Current behavior 😯

No response

Expected behavior 🤔

No response

Your prompt 📝

# Paste your prompt here

Name: 小吉导游
Role: 设计一个从乌鲁木齐出发和结束的新疆10日旅游详细方案,使用中文回复和搜索
Goals: ['使用中文回复和采用中文关键字搜索', '包含详细的路线和价格预算', '适合暑假7月底出游', '休闲不要太赶路', '适合包车或者自驾']

Your Logs 📒

<insert your logs here>

THOUGHTS: I think we should start by searching for some popular tourist destinations in Xinjiang and then plan our itinerary accordingly. We can also look for some car rental services in the area.
REASONING: By searching for popular tourist destinations, we can get an idea of what places are worth visiting and plan our itinerary accordingly. Additionally, by looking for car rental services, we can determine the feasibility of renting a car for the trip.
PLAN:

  • Search for popular tourist destinations in Xinjiang
  • Look for car rental services in the area
  • Plan itinerary based on the destinations found
    CRITICISM: I need to make sure that I am not just relying on the most popular tourist destinations and that I am considering other factors such as cost and time constraints.
    NEXT ACTION: COMMAND = google ARGUMENTS = {'input': '新疆旅游景点'}
    Enter 'y' to authorise command, 'y -N' to run N continuous commands, 'n' to exit program, or enter feedback for ...
    Input:y

Traceback (most recent call last):
File "/usr/lib/python3.9/runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/lib/python3.9/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/root/Auto-GPT/autogpt/main.py", line 5, in
autogpt.cli.main()
File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 1130, in call
return self.main(*args, **kwargs)
File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 1055, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 1635, in invoke
rv = super().invoke(ctx)
File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 760, in invoke
return __callback(*args, **kwargs)
File "/usr/local/lib/python3.9/dist-packages/click/decorators.py", line 26, in new_func
return f(get_current_context(), *args, **kwargs)
File "/root/Auto-GPT/autogpt/cli.py", line 151, in main
agent.start_interaction_loop()
File "/root/Auto-GPT/autogpt/agent/agent.py", line 75, in start_interaction_loop
assistant_reply = chat_with_ai(
File "/root/Auto-GPT/autogpt/chat.py", line 85, in chat_with_ai
else permanent_memory.get_relevant(str(full_message_history[-9:]), 10)
File "/root/Auto-GPT/autogpt/memory/local.py", line 124, in get_relevant
embedding = create_embedding_with_ada(text)
File "/root/Auto-GPT/autogpt/llm_utils.py", line 155, in create_embedding_with_ada
return openai.Embedding.create(
File "/usr/local/lib/python3.9/dist-packages/openai/api_resources/embedding.py", line 33, in create
response = super().create(*args, **kwargs)
File "/usr/local/lib/python3.9/dist-packages/openai/api_resources/abstract/engine_api_resource.py", line 153, in create
response, _, api_key = requestor.request(
File "/usr/local/lib/python3.9/dist-packages/openai/api_requestor.py", line 226, in request
resp, got_stream = self._interpret_response(result, stream)
File "/usr/local/lib/python3.9/dist-packages/openai/api_requestor.py", line 619, in _interpret_response
self._interpret_response_line(
File "/usr/local/lib/python3.9/dist-packages/openai/api_requestor.py", line 682, in _interpret_response_line
raise self.handle_error_response(
openai.error.InvalidRequestError: This model's maximum context length is 8191 tokens, however you requested 9564 tokens (9564 in your prompt; 0 for the completion). Please reduce your prompt; or completion length.

@Pwuts Pwuts changed the title maximum context length exceed after making 2 or 3 same query loop google_search: maximum context length exceeded Apr 22, 2023
@Pwuts Pwuts added bug Something isn't working and removed needs investigation labels Apr 22, 2023
@Pwuts Pwuts moved this to 🔖 Ready in AutoGPT development kanban Apr 22, 2023
@Pwuts Pwuts changed the title google_search: maximum context length exceeded Maximum context length exceeded in google_search Apr 22, 2023
@Pwuts Pwuts changed the title Maximum context length exceeded in google_search Maximum context length exceeded after google_search Apr 22, 2023
@Tonic3
Copy link

Tonic3 commented Apr 23, 2023

I just got a similar issue I think on windows,

Describe Request failed with status code: 401
Response content: b'{"detail":{"status":"quota_exceeded","message":"This request exceeds your quota. You have 19 characters remaining, while 43 characters are required for this request.","character_used":10024,"character_limit":10000}}'

@xixixi2000
Copy link
Author

I just got a similar issue I think on windows,

Describe Request failed with status code: 401 Response content: b'{"detail":{"status":"quota_exceeded","message":"This request exceeds your quota. You have 19 characters remaining, while 43 characters are required for this request.","character_used":10024,"character_limit":10000}}'

try check
https://platform.openai.com/account/usage

@Tonic3
Copy link

Tonic3 commented Apr 24, 2023

Usage is fine under 1.00 and it’s all good there, continue to see this error pop up, it then gets stuck in a loop. This is 3.5 mode only

@xixixi2000
Copy link
Author

xixixi2000 commented Apr 27, 2023

got this error today after pulling the newest code

THOUGHTS: 我们可以使用google命令搜索一些旅游路线和价格预算,以及自驾或包车的相关信息。我们可以使用以下关键字进行搜索:新疆旅游路线、新疆旅游价格预算、新疆自驾游攻略、新疆包车旅游攻略。
REASONING: 通过使用google命令搜索一些旅游路线和价格预算,以及自驾或包车的相关信息,我们可以更好地制定旅游计划。
PLAN:

  • 使用google命令搜索一些旅游路线和价格预算,以及自驾或包车的相关信息\n- 根据搜索结果制定旅游计划
    CRITICISM: 暂无
    NEXT ACTION: COMMAND = google ARGUMENTS = {'input': '新疆旅游路线、新疆旅游价格预算、新疆自驾游攻略、新疆包车旅游攻略'}
    Enter 'y' to authorise command, 'y -N' to run N continuous commands, 'n' to exit program, or enter feedback for ...
    Input:y
    -=-=-=-=-=-=-= COMMAND AUTHORISED BY USER -=-=-=-=-=-=-=
    SYSTEM: Command google returned: [ { "title": "新疆自驾游大约多少钱?费用估算 - 知乎 - 知乎专栏", "href": "https://zhuanlan.zhihu.com/p/372030888", "body": "地处我国西北部,是目前面积最大的省份,这里自古就是西域文化繁荣的地方,历史悠久,文化底蕴深厚,地大物博,是旅游胜地,下面给大家分享新疆自驾游大约多少钱?要注意什么? 费用预算当地办一张石油加油卡,存5…" }, { "title": "新疆旅游一个月,该如何安排?大概的花销是多少? - 知乎", "href": "https://www.zhihu.com/question/497670127", "body": "新疆地域宽广,自驾旅行一定注意合理安排每天的行程,不要太累,可以根据这个新疆全境路线图,结合自己的时间来选择都是去哪些地方。 1、北疆比较值得一去的就是可可托海,禾木村,喀纳斯,通常秋天是zui美的,颜色更丰富一些,但其它季节去景色也很 ..." }, { "title": "想去新疆旅游,大概多少预算够呢,加机票? - 知乎", "href": "https://www.zhihu.com/question/314884471", "body": "预算就6K左右,不算上到新疆的往返交通, 如果你人够多, 要求在降低一些,5K左右也没问题的 新疆私藏最佳野景安利 精伊牧道: 这是震撼景色下原始牧道,解忧公主和亲时走过的丝绸古道,托乎拉苏草原坐落在这里,独家牧道,感受一个人的草原,只有硬派越野车可通过,不顾车损,也要体验的秘境,只为这99%的惊叹。 伊犁最佳观星点是 阿克塔苏牧场 ,当星空遇见纯净草原的惊喜夜晚,浪漫的无可救药。 天然未被开发的原生草原— 巩乃斯森林公园 ,这里丝毫不输出名的那拉提,甚至由有过之,没有烦人的区间车,不挤,感觉整片草原都是你的 喀赞其 是北疆唯一一个以维吾尔族民俗风情为主题的地方,各种彩色房屋和各样美食,让这里成为网红打卡点,照片有小摩洛哥的感觉。 此外我还喜欢伊犁最原始的样子,原始的草场,原始的民族风情。" }, { "title": "旅游账单:去新疆旅游,准备多少钱才够用?详细攻略 - 知乎", "href": "https://zhuanlan.zhihu.com/p/86683476", "body": "很多人想感受一把新疆的大自然风光,但是毕竟新疆一个省就占了全国的六分之一,省内游玩几天也得大几千,那么如果到新疆旅游要准备多少钱才够呢? 最后面有我们某个游客的14天账单详细情况。 到新疆旅游的花费不外乎吃、住、行、购。 先说说到新疆的飞机票,这一项支出可以说是最大的开销了,不过在淡季时,飞机票也相对比较便宜,比旺季可以便宜上一半以上。 去程的折扣机票 回程的价格更是良心…… 注意这是双人份哦 到新疆省内游玩的话,自驾游和包车游的价格差别不大。 至于跟团游,真心不建议。 亲眼看见一路长长的队伍被导游指挥着排队上厕所的时候,我觉得这个团再便宜,我也不会去跟 ,这简直丧失了出来玩的乐趣!" }, { "title": "新疆自由行自驾游行程攻略7条全疆环线•一篇攻略游全疆 - 马蜂窝", "href": "https://www.mafengwo.cn/gonglve/ziyouxing/408919.html", "body": "新疆整个自驾游的成本都比内地要高很多,所以不要图便宜哦,请多多留意细节,多多注意品质和服务。 2、火车交通 火车这种交通方式,性价比较高,特别是往来于新疆内部城市。 除了价格便宜,火车受天气影响的程度也较飞机、汽车小很多,一般都能按时出发与到达。 但劣势是火车只能在固定的线路上往返,灵活性低,无法随心领略路途风景。 除此之外,火车票是比较的紧张,所以请务必安排好时间提前预定,否则很有可能是买不到车票。 但对于游玩人数较少,包车不方便的人来说,是一种不错的交通方式。 新疆境内铁道线路虽然不算多,但普遍里程较长, 主要有兰新铁路新疆段、北疆铁路和南疆铁路等几段重要铁路。 乌鲁木齐、吐鲁番、哈密、阿勒泰、伊宁、喀什、和田等重要城市都可乘火车抵达。 Tips:" }, { "title": "相约新疆|北疆大环线6-12天自驾游攻略详解 - 马蜂窝", "href": "https://www.mafengwo.cn/gonglve/ziyouxing/397072.html", "body": "没来过新疆不知道新疆之大,此生必驾独库公路,是很多爱好自驾的旅游者,必体验的,其中独库公路经典路段主要是在北疆,新疆的主要游玩景点也是集中在北疆,到新疆自驾怎么玩,什么季节适合自驾,自驾的线路及景点详细介绍,都会依依通过这篇攻略给 ..." }, { "title": "新疆旅游攻略:四大黄金自驾游线路,日程、住宿地、景点详细讲解_腾讯新闻", "href": "https://new.qq.com/rain/a/20210717A00JJ000", "body": "新疆旅游攻略:四大黄金自驾游线路,日程、住宿地、景点详细讲解. 新疆旅游攻略:四大黄金自驾游线路,日程、住宿地、景点详细讲解. 听正在新疆自驾游的朋友诉苦:新疆各大公路经常堵车,堵车的原因不是因为路况问题,而是因为要统一地安排游客去做 ..." }, { "title": "去新疆旅游,怎么规划线路?5-40天的6种经典线路,建议收藏", "href": "https://new.qq.com/rain/a/20220430A0B8LV00", "body": "以下介绍5-40天的6种经典线路,各位自驾车友可根据自己的时间选择最佳自驾路线。 一、5-7天 适合线路:喀纳斯环线,总里程2200公里,最佳旅游时间9-11月。 喀纳斯是北疆最著名的景点,与禾木图瓦人村落、白哈巴同为一个景区,被称为"童话世界"、"上帝打翻的调色板"。 该线路的主要景点:天山天池、可可托海、布尔津五彩滩、喀纳斯、禾木村、乌尔禾魔鬼城。 二、6-8天 适合线路:伊犁环线,总里程2400公里,最佳旅游时间5-8月。 "新疆的夏天,是伊犁的夏天"。 伊犁是整个新疆夏季景色最美的地方,一圈伊犁环线下来全是精华美景。 代表景点:赛里木湖、霍尔果斯口岸、伊昭公路、独库公路、霍城薰衣草庄园、特克斯八卦城、那拉提草原、拉拉君草原、巴音布鲁克草原、吐鲁番火焰山。 三、9-13天" } ]

Traceback (most recent call last):
File "/usr/lib/python3.9/runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/lib/python3.9/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/root/Auto-GPT/autogpt/main.py", line 5, in
autogpt.cli.main()
File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 1130, in call
return self.main(*args, **kwargs)
File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 1055, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 1635, in invoke
rv = super().invoke(ctx)
File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python3.9/dist-packages/click/core.py", line 760, in invoke
return __callback(*args, **kwargs)
File "/usr/local/lib/python3.9/dist-packages/click/decorators.py", line 26, in new_func
return f(get_current_context(), *args, **kwargs)
File "/root/Auto-GPT/autogpt/cli.py", line 151, in main
agent.start_interaction_loop()
File "/root/Auto-GPT/autogpt/agent/agent.py", line 75, in start_interaction_loop
assistant_reply = chat_with_ai(
File "/root/Auto-GPT/autogpt/chat.py", line 85, in chat_with_ai
else permanent_memory.get_relevant(str(full_message_history[-9:]), 10)
File "/root/Auto-GPT/autogpt/memory/local.py", line 124, in get_relevant
embedding = create_embedding_with_ada(text)
File "/root/Auto-GPT/autogpt/llm_utils.py", line 155, in create_embedding_with_ada
return openai.Embedding.create(
File "/usr/local/lib/python3.9/dist-packages/openai/api_resources/embedding.py", line 33, in create
response = super().create(*args, **kwargs)
File "/usr/local/lib/python3.9/dist-packages/openai/api_resources/abstract/engine_api_resource.py", line 153, in create
response, _, api_key = requestor.request(
File "/usr/local/lib/python3.9/dist-packages/openai/api_requestor.py", line 226, in request
resp, got_stream = self._interpret_response(result, stream)
File "/usr/local/lib/python3.9/dist-packages/openai/api_requestor.py", line 619, in _interpret_response
self._interpret_response_line(
File "/usr/local/lib/python3.9/dist-packages/openai/api_requestor.py", line 682, in _interpret_response_line
raise self.handle_error_response(
openai.error.InvalidRequestError: This model's maximum context length is 8191 tokens, however you requested 8743 tokens (8743 in your prompt; 0 for the completion). Please reduce your prompt; or completion length.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working function: browse
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants