KNIME AI Extension: Proxy settings are not taken over!

Hi, I have KNIME 5.1 installed on a WIN10 company PC, with a proxy set.
Experimenting with the ‘KNIME AI Extension’ I got the problem, that the node ‘OpenAI Authenticator’ failed , presenting the final (but wrong) Error Message ‘API key is not valid. - see snippet below’.

Realizing, that the problem occurs accessing the API (…/v1/models) within the file ‘api_requestor.py’ I simply extended this file by inserting the proxy settings (those set in ‘Preferences’!) manually on the very top of this file:

import os
proxy = ‘my-proxy settings’

*os.environ[‘http_proxy’] = proxy *
os.environ[‘HTTP_PROXY’] = proxy
os.environ[‘https_proxy’] = proxy
os.environ[‘HTTPS_PROXY’] = proxy

which solved my problem! Obviously, my proxy settings as defined in ‘Preferences/General/Network’ are not taken over by this extension - a behavior, I observed by several other nodes/components in the past!

Best
Erich

Snippet:
Traceback (most recent call last):
File “C:\Data\knime_5.1.0\plugins\org.knime.python.llm_5.1.0.202307290225\src\main\python\src\models\openai.py”, line 507, in execute
openai.Model.list()
File “C:\Data\knime_5.1.0\plugins\org.knime.python.llm.channel.bin.win32.x86_64_5.1.0.202307290225\env\Lib\site-packages\openai\api_resources\abstract\listable_api_resource.py”, line 60, in list
response, _, api_key = requestor.request(
^^^^^^^^^^^^^^^^^^
File “C:\Data\knime_5.1.0\plugins\org.knime.python.llm.channel.bin.win32.x86_64_5.1.0.202307290225\env\Lib\site-packages\openai\api_requestor.py”, line 288, in request
result = self.request_raw(
^^^^^^^^^^^^^^^^^
File “C:\Data\knime_5.1.0\plugins\org.knime.python.llm.channel.bin.win32.x86_64_5.1.0.202307290225\env\Lib\site-packages\openai\api_requestor.py”, line 609, in request_raw
raise error.APIConnectionError(
openai.error.APIConnectionError: Error communicating with OpenAI: HTTPSConnectionPool(host=‘api.openai.com’, port=443): Max retries exceeded with url: /v1/models (Caused by NewConnectionError(‘<urllib3.connection.HTTPSConnection object at 0x0000023197CA6B10>: Failed to establish a new connection: [WinError 10061] Es konnte keine Verbindung hergestellt werden, da der Zielcomputer die Verbindung verweigerte’))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “C:\Data\knime_5.1.0\plugins\org.knime.python3.nodes_5.1.0.v202307101500\src\main\python_node_backend_launcher.py”, line 652, in execute
outputs = self._node.execute(exec_context, *inputs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “C:\Data\knime_5.1.0\plugins\org.knime.python.llm_5.1.0.202307290225\src\main\python\src\models\openai.py”, line 509, in execute
raise knext.InvalidParametersError(“API key is not valid.”)
knime.extension.nodes.InvalidParametersError: API key is not valid.

2023-09-06 13:37:04,079 : ERROR : KNIME-Worker-14-OpenAI Authenticator 3:106 : : Node : OpenAI Authenticator : 3:106 : Execute failed: API key is not valid.
org.knime.core.node.InvalidSettingsException: API key is not valid.

Hm, seems that I’m the only one having this problem?

Hello @Erich_Gstrein,

thanks for reporting this problem. We will work on transferring the KNIME Proxy settings in all Python Nodes (internal number (AP-20960)). It should be included in the next version!

Best regards
Jonas

3 Likes

@Erich_Gstrein you can try and do an offline installation with a

@jonasklotz very good if there can be progress with this problem :slight_smile:

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.