-
Notifications
You must be signed in to change notification settings - Fork 4
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
Error in api #5
Comments
Thanks for trying the script. I believe you tested an older version. Could you please try the Colab version instead? I strongly recommend using the Colab version as it is easier to run. This project was built a few years ago, and I'm not sure if some APIs in the Colab version, such as ChatGPT, have been updated. |
Hi, thanks for your help! As you said, I changed "def llm", "def predicate_generator", and updated my openai version == 1.9.0 , API problem seems to be solved! However, I'm still a bit puzzled, when my task id =1, currently my output looks like this: before running, all old files have been removed. setting:1 #---------- generating basic plan! ----------- #---------- generating situation! ----------- #---------- executing plan! ----------- action: ['find_table', 'rob', 'table_0', 'dining'] action: ['grasp_vacuum', 'rob', 'vacuum_2', 'dining'] action: ['plug_vacuum', 'rob', 'vacuum_2', 'outlet_1', 'dining'] action: ['turnon_vacuum', 'rob', 'vacuum_2', 'dining'] #---------- checking unexecuted actions! ----------- unexecuted action: ['turnon_vacuum', 'rob', 'vacuum_2', 'dining'] unexecuted action: ['clean_area', 'rob', 'vacuum_2', 'table_0', 'dining'] #---------- adding constraint ----------- #---------- generating modified_plan_1! ----------- #---------- call llm_object ----------- #---------- capable_objects: ---------- #---------- most possible object: ---------- no modified_plan_2 found! #---------- call llm_appliance ----------- ! prompt design ! prompt design ! prompt design ! prompt design ! prompt design ! prompt design ! prompt design ! prompt design ! prompt design no capable appliance found! no modified_plan_3 found! #---------- solution ----------- Is that right? |
Thank you for revising the "def llm" and "def predicate_generator". I'm glad to see that you achieved the desired result. In your case, where "there is a power outage," there is no solution to resolve this situation. This is an expected outcome, as we discussed similar cases in the paper. |
When I run the code "python main.py"
I received the following error
before running, all old files have been removed.
setting:0
#---------- generating basic plan! -----------
(find_table rob table_0 dining)
(walk rob dining kitchen)
(find_plate rob plate_1 kitchen)
(grasp_plate rob plate_1 kitchen)
(move_plate rob plate_1 kitchen table_0 dining)
(place_plate rob plate_1 table_0 dining)
(walk_table rob table_0 dining)
(find_chair rob chair_1 dining)
(pull_chair rob chair_1 dining)
(walk rob dining kitchen)
(find_burger rob burger_1 kitchen)
(find_fork rob fork_1 kitchen)
(grasp_burger rob burger_1 kitchen)
(move_burger rob burger_1 kitchen plate_1 dining)
(place_burger rob burger_1 plate_1 dining)
(walk rob dining kitchen)
(grasp_fork rob fork_1 kitchen)
(move_fork rob fork_1 kitchen plate_1 dining)
(place_fork rob fork_1 plate_1 dining)
; cost = 19 (unit cost)
Traceback (most recent call last):
File "/home/liushuo/anaconda3/envs/cowplanning/lib/python3.7/site-packages/openai/http_client.py", line 221, in request
**kwargs,
File "/home/liushuo/anaconda3/envs/cowplanning/lib/python3.7/site-packages/requests/sessions.py", line 589, in request
resp = self.send(prep, **send_kwargs)
File "/home/liushuo/anaconda3/envs/cowplanning/lib/python3.7/site-packages/requests/sessions.py", line 703, in send
r = adapter.send(request, **kwargs)
File "/home/liushuo/anaconda3/envs/cowplanning/lib/python3.7/site-packages/requests/adapters.py", line 497, in send
chunked=chunked,
File "/home/liushuo/anaconda3/envs/cowplanning/lib/python3.7/site-packages/urllib3/connectionpool.py", line 803, in urlopen
**response_kw,
File "/home/liushuo/anaconda3/envs/cowplanning/lib/python3.7/site-packages/urllib3/connectionpool.py", line 505, in _make_request
enforce_content_length=enforce_content_length,
File "/home/liushuo/anaconda3/envs/cowplanning/lib/python3.7/site-packages/urllib3/connection.py", line 394, in request
self.putheader(header, value)
File "/home/liushuo/anaconda3/envs/cowplanning/lib/python3.7/site-packages/urllib3/connection.py", line 308, in putheader
super().putheader(header, values)
File "/home/liushuo/anaconda3/envs/cowplanning/lib/python3.7/http/client.py", line 1259, in putheader
raise ValueError('Invalid header value %r' % (values[i],))
ValueError: Invalid header value b'Bearer sk-Ma4ZnyqCPja*********B4\n'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "main.py", line 77, in
situation_index, situation, situation_opp, situation_object, situation_predicate, situation_action = situation_simulator(task_id)
File "/home/liushuo/GPT-Planner/situation_simulator.py", line 824, in situation_simulator
situation_predicate = predicate_generator(situation)
File "/home/liushuo/GPT-Planner/utility.py", line 253, in predicate_generator
stop=['\n', '.']
File "/home/liushuo/anaconda3/envs/cowplanning/lib/python3.7/site-packages/openai/api_resources/completion.py", line 31, in create
return super().create(*args, **kwargs)
File "/home/liushuo/anaconda3/envs/cowplanning/lib/python3.7/site-packages/openai/api_resources/abstract/engine_api_resource.py", line 67, in create
"post", url, params, headers, stream=stream
File "/home/liushuo/anaconda3/envs/cowplanning/lib/python3.7/site-packages/openai/api_requestor.py", line 127, in request
method.lower(), url, params, headers, stream=stream
File "/home/liushuo/anaconda3/envs/cowplanning/lib/python3.7/site-packages/openai/api_requestor.py", line 322, in request_raw
method, abs_url, headers, post_data, stream=stream
File "/home/liushuo/anaconda3/envs/cowplanning/lib/python3.7/site-packages/openai/http_client.py", line 87, in request_with_retries
raise connection_error
File "/home/liushuo/anaconda3/envs/cowplanning/lib/python3.7/site-packages/openai/http_client.py", line 58, in request_with_retries
response = self.request(method, url, headers, post_data, stream=stream)
File "/home/liushuo/anaconda3/envs/cowplanning/lib/python3.7/site-packages/openai/http_client.py", line 246, in request
self._handle_request_error(e)
File "/home/liushuo/anaconda3/envs/cowplanning/lib/python3.7/site-packages/openai/http_client.py", line 306, in _handle_request_error
raise error.APIConnectionError(msg, should_retry=should_retry)
openai.error.APIConnectionError: Unexpected error communicating with OpenAI. It looks like there's
probably a configuration issue locally. If this problem persists, let
us know at support@openai.com.
(Network error: A ValueError was raised with error message Invalid header value b'Bearer sk-Ma4ZnyqCPja**********B4\n')
However, I have tested my api_key use the following code, and it can run sucessfully.
from langchain_openai import ChatOpenAI
llm = ChatOpenAI(
openai_api_base="https://api.xiaoai.plus/v1",
openai_api_key="sk-xxxxx"
)
res = llm.invoke("hello")
print(res.content)
How can I fix this error?
The text was updated successfully, but these errors were encountered: