Coder Social home page Coder Social logo

[Bug] [Proxy] The request to OpenAI's URL went through a proxy, with "PROXY_SERVER_URL" configured as the proxy's URL, resulting in a 400 error. about db-gpt HOT 7 CLOSED

gary163 avatar gary163 commented on June 8, 2024
[Bug] [Proxy] The request to OpenAI's URL went through a proxy, with "PROXY_SERVER_URL" configured as the proxy's URL, resulting in a 400 error.

from db-gpt.

Comments (7)

fangyinc avatar fangyinc commented on June 8, 2024

Hi, @gary163, you can refer here

from db-gpt.

gary163 avatar gary163 commented on June 8, 2024

Hi, @gary163, you can refer here

I've looked into it, but regarding the command line method, how do I make requests to OpenAI through configuration?

from db-gpt.

gary163 avatar gary163 commented on June 8, 2024

Unable to configure in the configuration file, can you provide a demo? @fangyinc

from db-gpt.

fangyinc avatar fangyinc commented on June 8, 2024

Unable to configure in the configuration file, can you provide a demo? @fangyinc

  1. Enable network forward for api.openai.com
dbgpt net forward --local-port 5010 \
--remote-host api.openai.com \
--remote-port 443 \
--ssl \
--proxies https://username:[email protected]:443 \
--timeout 30 
  1. Modify your .env
PROXY_SERVER_URL=https://127.0.0.1:5010/v1/chat/completions
PROXY_API_KEY={your api key}
  1. Restart your DB-GPT.

from db-gpt.

gary163 avatar gary163 commented on June 8, 2024

Still encountering errors, please see the following error message:
`2024-04-18 10:14:33 -Pro.local dbgpt.storage.vector_store.chroma_store[48818] INFO Check persist_dir: /DB-GPT/pilot/data/SR_FIN_ADS_profile.vectordb
2024-04-18 10:14:33 -Pro.local dbgpt.rag.summary.db_summary_client[48818] INFO Vector store name SR_FIN_ADS_profile exist
2024-04-18 10:14:33 -Pro.local dbgpt.rag.summary.db_summary_client[48818] INFO initialize db summary profile success...
2024-04-18 10:14:33 -Pro.local dbgpt.rag.summary.db_summary_client[48818] INFO db summary embedding success
2024-04-18 10:14:34 -Pro.local dbgpt.model.cluster.worker.default_worker[48818] ERROR Model inference error, detail: Traceback (most recent call last):
File "/DB-GPT/venv/lib/python3.11/site-packages/openai/_base_client.py", line 1457, in _request
response = await self._client.send(
^^^^^^^^^^^^^^^^^^^^^^^^
File "/DB-GPT/venv/lib/python3.11/site-packages/httpx/_client.py", line 1661, in send
response = await self._send_handling_auth(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/DB-GPT/venv/lib/python3.11/site-packages/httpx/_client.py", line 1689, in _send_handling_auth
response = await self._send_handling_redirects(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/DB-GPT/venv/lib/python3.11/site-packages/httpx/_client.py", line 1726, in _send_handling_redirects
response = await self._send_single_request(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/DB-GPT/venv/lib/python3.11/site-packages/httpx/_client.py", line 1763, in _send_single_request
response = await transport.handle_async_request(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/DB-GPT/venv/lib/python3.11/site-packages/httpx/_transports/default.py", line 373, in handle_async_request
resp = await self._pool.handle_async_request(req)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/DB-GPT/venv/lib/python3.11/site-packages/httpcore/_async/connection_pool.py", line 216, in handle_async_request
raise exc from None
File "/DB-GPT/venv/lib/python3.11/site-packages/httpcore/_async/connection_pool.py", line 196, in handle_async_request
response = await connection.handle_async_request(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/DB-GPT/venv/lib/python3.11/site-packages/httpcore/_async/connection.py", line 99, in handle_async_request
raise exc
File "/DB-GPT/venv/lib/python3.11/site-packages/httpcore/_async/connection.py", line 76, in handle_async_request
stream = await self._connect(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/DB-GPT/venv/lib/python3.11/site-packages/httpcore/_async/connection.py", line 154, in _connect
stream = await stream.start_tls(**kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/DB-GPT/venv/lib/python3.11/site-packages/httpcore/_backends/anyio.py", line 78, in start_tls
raise exc
File "/DB-GPT/venv/lib/python3.11/site-packages/httpcore/_backends/anyio.py", line 69, in start_tls
ssl_stream = await anyio.streams.tls.TLSStream.wrap(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/DB-GPT/venv/lib/python3.11/site-packages/anyio/streams/tls.py", line 132, in wrap
await wrapper._call_sslobject_method(ssl_object.do_handshake)
File "/DB-GPT/venv/lib/python3.11/site-packages/anyio/streams/tls.py", line 140, in _call_sslobject_method
result = func(*args)
^^^^^^^^^^^
File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/ssl.py", line 979, in do_handshake
self._sslobj.do_handshake()
ssl.SSLError: [SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1002)

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

Traceback (most recent call last):
File "/DB-GPT/dbgpt/model/cluster/worker/default_worker.py", line 246, in async_generate_stream
async for output in generate_stream_func(
File "/DB-GPT/dbgpt/model/proxy/llms/chatgpt.py", line 43, in chatgpt_generate_stream
async for r in client.generate_stream(request):
File "/DB-GPT/dbgpt/model/proxy/llms/chatgpt.py", line 230, in generate_stream
async for r in self.generate_stream_v1(messages, payload):
File "/DB-GPT/dbgpt/model/proxy/llms/chatgpt.py", line 258, in generate_stream_v1
chat_completion = await self.client.chat.completions.create(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/DB-GPT/venv/lib/python3.11/site-packages/openai/resources/chat/completions.py", line 1330, in create
return await self._post(
^^^^^^^^^^^^^^^^^
File "/DB-GPT/venv/lib/python3.11/site-packages/openai/_base_client.py", line 1725, in post
return await self.request(cast_to, opts, stream=stream, stream_cls=stream_cls)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/DB-GPT/venv/lib/python3.11/site-packages/openai/_base_client.py", line 1428, in request
return await self._request(
^^^^^^^^^^^^^^^^^^^^
File "/DB-GPT/venv/lib/python3.11/site-packages/openai/_base_client.py", line 1481, in _request
return await self._retry_request(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/DB-GPT/venv/lib/python3.11/site-packages/openai/_base_client.py", line 1550, in _retry_request
return await self._request(
^^^^^^^^^^^^^^^^^^^^
File "/DB-GPT/venv/lib/python3.11/site-packages/openai/_base_client.py", line 1481, in _request
return await self._retry_request(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/DB-GPT/venv/lib/python3.11/site-packages/openai/_base_client.py", line 1550, in _retry_request
return await self._request(
^^^^^^^^^^^^^^^^^^^^
File "/DB-GPT/venv/lib/python3.11/site-packages/openai/_base_client.py", line 1491, in _request
raise APIConnectionError(request=request) from err
openai.APIConnectionError: Connection error.`

The proxy server reported the following error:

Among them, https://xx:[email protected]:443 has been anonymized by me.

(venv) $ dbgpt net forward --local-port 5010 \

--remote-host api.openai.com
--remote-port 443
--ssl
--proxies https://xx:[email protected]:443
--timeout 30
INFO: Started server process [48248]
INFO: Waiting for application startup.
INFO: Application startup complete.
INFO: Uvicorn running on http://0.0.0.0:5010 (Press CTRL+C to quit)
WARNING: Invalid HTTP request received.
WARNING: Invalid HTTP request received.
WARNING: Invalid HTTP request received.

from db-gpt.

github-actions avatar github-actions commented on June 8, 2024

This issue has been marked as stale, because it has been over 30 days without any activity.

from db-gpt.

github-actions avatar github-actions commented on June 8, 2024

This issue bas been closed, because it has been marked as stale and there has been no activity for over 7 days.

from db-gpt.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.