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

Azure API Bug #174

Open
skypoc opened this issue Nov 10, 2023 · 3 comments
Open

Azure API Bug #174

skypoc opened this issue Nov 10, 2023 · 3 comments

Comments

@skypoc
Copy link

skypoc commented Nov 10, 2023

Hello, I encountered some difficulties while using it, so I would like to ask for your advice.

Describe the bug
export OPENAI_KEY= 'My Azure API'
Then
pentestgpt-connection --baseURL https://{MY-resource-name}.openai.azure.com/openai/deployments/{MY-deployment-id}/completions?api-version={2023-07-01-preview}

The following error occurred

Your CHATGPT_COOKIE is not set. Please set it in the environment variable.
You're testing the connection for PentestGPT v 0.11.0
#### Test connection for OpenAI api (GPT-4)
Traceback (most recent call last):
  File "/Users/mypc/venv/lib/python3.9/site-packages/pentestgpt/utils/APIs/chatgpt_api.py", line 81, in _chat_completion
    response = openai.ChatCompletion.create(
  File "/Users/mypc/venv/lib/python3.9/site-packages/openai/api_resources/chat_completion.py", line 25, in create
    return super().create(*args, **kwargs)
  File "/Users/mypc/venv/lib/python3.9/site-packages/openai/api_resources/abstract/engine_api_resource.py", line 153, in create
    response, _, api_key = requestor.request(
  File "/Users/mypc/venv/lib/python3.9/site-packages/openai/api_requestor.py", line 298, in request
    resp, got_stream = self._interpret_response(result, stream)
  File "/Users/mypc/venv/lib/python3.9/site-packages/openai/api_requestor.py", line 700, in _interpret_response
    self._interpret_response_line(
  File "/Users/mypc/venv/lib/python3.9/site-packages/openai/api_requestor.py", line 765, in _interpret_response_line
    raise self.handle_error_response(
openai.error.InvalidRequestError: Resource not found

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/mypc/venv/bin/pentestgpt-connection", line 8, in <module>
    sys.exit(main())
  File "/Users/mypc/venv/lib/python3.9/site-packages/pentestgpt/test_connection.py", line 47, in main
    result, conversation_id = chatgpt.send_new_message("Hi how are you?")
  File "/Users/mypc/venv/lib/python3.9/site-packages/pentestgpt/utils/llm_api.py", line 225, in send_new_message
    response = self._chat_completion(history)
  File "/Users/mypc/venv/lib/python3.9/site-packages/pentestgpt/utils/APIs/chatgpt_api.py", line 119, in _chat_completion
    response = openai.ChatCompletion.create(
  File "/Users/mypc/venv/lib/python3.9/site-packages/openai/api_resources/chat_completion.py", line 25, in create
    return super().create(*args, **kwargs)
  File "/Users/mypc/venv/lib/python3.9/site-packages/openai/api_resources/abstract/engine_api_resource.py", line 153, in create
    response, _, api_key = requestor.request(
  File "/Users/mypc/venv/lib/python3.9/site-packages/openai/api_requestor.py", line 298, in request
    resp, got_stream = self._interpret_response(result, stream)
  File "/Users/mypc/venv/lib/python3.9/site-packages/openai/api_requestor.py", line 700, in _interpret_response
    self._interpret_response_line(
  File "/Users/mypc/venv/lib/python3.9/site-packages/openai/api_requestor.py", line 765, in _interpret_response_line
    raise self.handle_error_response(
openai.error.InvalidRequestError: Resource not found

I can be sure that there is no problem with my API and URL, it can be used.

Version
GPT-4

Thank you very much.

@GreyDGL
Copy link
Owner

GreyDGL commented Nov 13, 2023

Hey there, sorry I don't have an API key for Azure, so I cannot do debugging/fixing right now.
I'll find some way to test it with Azure and update the code.

@skypoc
Copy link
Author

skypoc commented Nov 13, 2023

thank you so much!

@Lorenzofini
Copy link

I have the same error, how should it be configured using the Azure API? Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants