Skip to content

openai.APIConnectionError: Connection error. #2742

@kachihro

Description

@kachihro

Hello,

I've configured (deployed) the solution, with a number of configurations - and using PRIVATE ENDPOINTS - with APP SERVICE.

Have stepped through the VPN config - and can view the homepage/chat-app.

When using this command ;
.\scripts\prepdocs.ps1

The documents are ingested to Blob Storage - and - the Document intelligence is extracting text ("Splitting into sections")

But - then an error with OpenAI - can't connect...?

Running "prepdocs.py"
./app/backend/prepdocs.py "C:\Repos\AI POC/data/" --verbose
[16:06:32] INFO Loading azd env from C:\Repos\AI POC.azure\rg-qleave-ai-poc.env, which may override existing environment load_azd_env.py:28
variables
INFO Connecting to Azure services using the azd credential for tenant e4fc5309-2c24-4591-8d51-23b1610b78b8 prepdocs.py:440
INFO Using local files: C:\Repos\AI POC/data/
prepdocs.py:144
INFO OPENAI_HOST is azure, setting up Azure OpenAI client prepdocs.py:225
INFO Using Azure credential (passwordless authentication) for Azure OpenAI client prepdocs.py:235
INFO Checking whether search index gptkbindex exists... searchmanager.py:85
[16:06:35] INFO Search index gptkbindex already exists searchmanager.py:329
INFO Skipping 'C:\Repos\AI POC/data\1-solar-panel-popular.pdf', no changes detected. listfilestrategy.py:129
INFO Skipping 'C:\Repos\AI POC/data\12-malcoms-snowy-surprise.pdf', no changes detected. listfilestrategy.py:129
INFO Skipping 'C:\Repos\AI POC/data\1218770116.pdf', no changes detected. listfilestrategy.py:129
[16:06:36] INFO Uploading blob for document '1218770116_851933223851182171.pdf' blobmanager.py:430
INFO Ingesting '1218770116_851933223851182171.pdf' filestrategy.py:30
INFO Extracting text from 'C:\Repos\AI POC/data\1218770116_851933223851182171.pdf' using Azure Document Intelligence pdfparser.py:94
[16:06:41] INFO Splitting '1218770116_851933223851182171.pdf' into sections filestrategy.py:42
Traceback (most recent call last):
File "C:\Repos\AI POC.venv\Lib\site-packages\httpx_transports\default.py", line 69, in map_httpcore_exceptions
yield
File "C:\Repos\AI POC.venv\Lib\site-packages\httpx_transports\default.py", line 373, in handle_async_request
resp = await self._pool.handle_async_request(req)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Repos\AI POC.venv\Lib\site-packages\httpcore_async\connection_pool.py", line 256, in handle_async_request
raise exc from None
File "C:\Repos\AI POC.venv\Lib\site-packages\httpcore_async\connection_pool.py", line 236, in handle_async_request
response = await connection.handle_async_request(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Repos\AI POC.venv\Lib\site-packages\httpcore_async\connection.py", line 101, in handle_async_request
raise exc
File "C:\Repos\AI POC.venv\Lib\site-packages\httpcore_async\connection.py", line 78, in handle_async_request
stream = await self._connect(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Repos\AI POC.venv\Lib\site-packages\httpcore_async\connection.py", line 124, in _connect
stream = await self._network_backend.connect_tcp(**kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Repos\AI POC.venv\Lib\site-packages\httpcore_backends\auto.py", line 31, in connect_tcp
return await self._backend.connect_tcp(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Repos\AI POC.venv\Lib\site-packages\httpcore_backends\anyio.py", line 113, in connect_tcp
with map_exceptions(exc_map):
File "C:\Python311\Lib\contextlib.py", line 155, in exit
self.gen.throw(typ, value, traceback)
File "C:\Repos\AI POC.venv\Lib\site-packages\httpcore_exceptions.py", line 14, in map_exceptions
raise to_exc(exc) from exc
httpcore.ConnectError: [Errno 11001] getaddrinfo failed

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "C:\Repos\AI POC.venv\Lib\site-packages\openai_base_client.py", line 1529, in request
response = await self._client.send(
^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Repos\AI POC.venv\Lib\site-packages\httpx_client.py", line 1661, in send
response = await self._send_handling_auth(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Repos\AI POC.venv\Lib\site-packages\httpx_client.py", line 1689, in _send_handling_auth
response = await self._send_handling_redirects(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Repos\AI POC.venv\Lib\site-packages\httpx_client.py", line 1726, in _send_handling_redirects
response = await self._send_single_request(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Repos\AI POC.venv\Lib\site-packages\httpx_client.py", line 1763, in _send_single_request
response = await transport.handle_async_request(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Repos\AI POC.venv\Lib\site-packages\httpx_transports\default.py", line 372, in handle_async_request
with map_httpcore_exceptions():
File "C:\Python311\Lib\contextlib.py", line 155, in exit
self.gen.throw(typ, value, traceback)
File "C:\Repos\AI POC.venv\Lib\site-packages\httpx_transports\default.py", line 86, in map_httpcore_exceptions
raise mapped_exc(message) from exc
httpx.ConnectError: [Errno 11001] getaddrinfo failed

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "C:\Repos\AI POC\app\backend\prepdocs.py", line 600, in
loop.run_until_complete(main(ingestion_strategy, setup_index=not args.remove and not args.removeall))
File "C:\Python311\Lib\asyncio\base_events.py", line 650, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "C:\Repos\AI POC\app\backend\prepdocs.py", line 364, in main
await strategy.run()
File "C:\Repos\AI POC\app\backend\prepdocslib\filestrategy.py", line 123, in run
await self.search_manager.update_content(sections, url=file.url)
File "C:\Repos\AI POC\app\backend\prepdocslib\searchmanager.py", line 524, in update_content
embeddings = await self.embeddings.create_embeddings(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Repos\AI POC\app\backend\prepdocslib\embeddings.py", line 150, in create_embeddings
return await self.create_embedding_batch(texts, dimensions_args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Repos\AI POC\app\backend\prepdocslib\embeddings.py", line 106, in create_embedding_batch
async for attempt in AsyncRetrying(
File "C:\Repos\AI POC.venv\Lib\site-packages\tenacity\asyncio_init_.py", line 166, in anext
do = await self.iter(retry_state=self.retry_state)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Repos\AI POC.venv\Lib\site-packages\tenacity\asyncio_init
.py", line 153, in iter
result = await action(retry_state)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Repos\AI POC.venv\Lib\site-packages\tenacity_utils.py", line 99, in inner
return call(args, kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "C:\Repos\AI POC.venv\Lib\site-packages\tenacity_init_.py", line 400, in
self._add_action_func(lambda rs: rs.outcome.result())
^^^^^^^^^^^^^^^^^^^
File "C:\Python311\Lib\concurrent\futures_base.py", line 449, in result
return self.__get_result()
^^^^^^^^^^^^^^^^^^^
File "C:\Python311\Lib\concurrent\futures_base.py", line 401, in __get_result
raise self._exception
File "C:\Repos\AI POC\app\backend\prepdocslib\embeddings.py", line 113, in create_embedding_batch
emb_response = await client.embeddings.create(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Repos\AI POC.venv\Lib\site-packages\openai\resources\embeddings.py", line 251, in create
return await self._post(
^^^^^^^^^^^^^^^^^
File "C:\Repos\AI POC.venv\Lib\site-packages\openai_base_client.py", line 1794, in post
return await self.request(cast_to, opts, stream=stream, stream_cls=stream_cls)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Repos\AI POC.venv\Lib\site-packages\openai_base_client.py", line 1561, in request
r
aise APIConnectionError(request=request) from err
*

openai.APIConnectionError: Connection error.

Metadata

Metadata

Assignees

Labels

vnetRelated to the optional support for private endpoint and Virtual Network deployment

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions