leptonai / search_with_lepton

Building a quick conversation-based search demo with Lepton AI.
https://search.lepton.run
Apache License 2.0
7.51k stars 964 forks source link

openai.AuthenticationError: Unauthorized #89

Open goldwater668 opened 5 days ago

goldwater668 commented 5 days ago

2024-07-02 11:13:58.658 | INFO | main:init:426 - Creating KV. May take a while for the first time. 2024-07-02 11:13:58.662 | INFO | leptonai.photon.photon:_uvicorn_run:837 - Setting up signal handlers for graceful incoming traffic shutdown after 5 seconds. 2024-07-02 11:13:58,662 - INFO:
If you are using standard photon, a few urls that may be helpful:

If you are using python clients, here is an example code snippet: from leptonai.client import Client, local client = Client(local(port=8080)) client.healthz() # checks the health of the photon client.paths() # lists all the paths of the photon client.method_name? # If client has a method_name method, get the docstring client.method_name(...) # calls the method_name method If you are using ipython, you can use tab completion by typing client. and then press tab.

2024-07-02 11:13:58,672 - INFO: Started server process [778289] 2024-07-02 11:13:58,672 - INFO: Waiting for application startup. 2024-07-02 11:13:58.673 | INFO | leptonai.photon.photon:uvicorn_startup:776 - Starting photon app - running startup prep code. 2024-07-02 11:13:58,673 - INFO: Application startup complete. 2024-07-02 11:13:58,673 - INFO: Uvicorn running on http://0.0.0.0:8080 (Press CTRL+C to quit) 2024-07-02 11:14:03,179 - INFO: 127.0.0.1:50610 - "GET / HTTP/1.1" 307 Temporary Redirect 2024-07-02 11:14:03,198 - INFO: 127.0.0.1:50610 - "GET /ui/index.html HTTP/1.1" 304 Not Modified 2024-07-02 11:14:03,220 - INFO: 127.0.0.1:50610 - "GET /ui/_next/static/media/c9a5bc6a7c948fb0-s.p.woff2 HTTP/1.1" 304 Not Modified 2024-07-02 11:14:03,221 - INFO: 127.0.0.1:50614 - "GET /ui/_next/static/css/c45868dfc0d7a6fe.css HTTP/1.1" 304 Not Modified 2024-07-02 11:14:03,231 - INFO: 127.0.0.1:50614 - "GET /ui/_next/static/chunks/webpack-fc4785faa12a4784.js HTTP/1.1" 304 Not Modified 2024-07-02 11:14:03,232 - INFO: 127.0.0.1:50610 - "GET /ui/_next/static/chunks/fd9d1056-7fda3e9b28bca7f7.js HTTP/1.1" 304 Not Modified 2024-07-02 11:14:03,232 - INFO: 127.0.0.1:50622 - "GET /ui/_next/static/chunks/938-fe6b19e2b7ce9569.js HTTP/1.1" 304 Not Modified 2024-07-02 11:14:03,233 - INFO: 127.0.0.1:50644 - "GET /ui/_next/static/chunks/445-0d7890e16447ec0a.js HTTP/1.1" 304 Not Modified 2024-07-02 11:14:03,233 - INFO: 127.0.0.1:50632 - "GET /ui/_next/static/chunks/main-app-e7ab2f567f2172b4.js HTTP/1.1" 304 Not Modified 2024-07-02 11:14:03,234 - INFO: 127.0.0.1:50658 - "GET /ui/_next/static/chunks/app/page-aa89276e7ee62c06.js HTTP/1.1" 304 Not Modified 2024-07-02 11:14:09,343 - INFO: 127.0.0.1:50658 - "GET /ui/search.html.txt?q=%25E8%25A2%2581%25E6%25B3%2589%25E6%25BC%2594%25E4%25BA%2586%25E4%25B8%2580%25E4%25B8%25AA%25E4%25B9%2598%25E5%258A%25A1%25E5%2591%2598%25E6%2595%2591%25E4%25BA%2586%25E4%25B8%2580%25E9%25A3%259E%25E6%259C%25BA%25E7%259A%2584%25E4%25BA%25BA&rid=OJQXtgkJpBYDuAHvJsKxA&_rsc=9ehs5 HTTP/1.1" 404 Not Found 2024-07-02 11:14:09,359 - INFO: 127.0.0.1:50658 - "GET /ui/search.html?q=%25E8%25A2%2581%25E6%25B3%2589%25E6%25BC%2594%25E4%25BA%2586%25E4%25B8%2580%25E4%25B8%25AA%25E4%25B9%2598%25E5%258A%25A1%25E5%2591%2598%25E6%2595%2591%25E4%25BA%2586%25E4%25B8%2580%25E9%25A3%259E%25E6%259C%25BA%25E7%259A%2584%25E4%25BA%25BA&rid=OJQXtgkJpBYDuAHvJsKxA HTTP/1.1" 200 OK 2024-07-02 11:14:09,507 - INFO: 127.0.0.1:50658 - "GET /ui/_next/static/chunks/925-a4abdbbc3a2e2d8f.js HTTP/1.1" 304 Not Modified 2024-07-02 11:14:09,507 - INFO: 127.0.0.1:50632 - "GET /ui/_next/static/chunks/app/search/page-576f37977d880d6d.js HTTP/1.1" 304 Not Modified 2024-07-02 11:14:09,591 - INFO: 127.0.0.1:50632 - "GET /ui/bg.svg HTTP/1.1" 304 Not Modified 2024-07-02 11:14:09.612 | ERROR | main:query_function:572 - KV error: 'RAG' object has no attribute 'kv' Traceback (most recent call last): File "/media/soul/EC3C5BDA3C5B9E80/win10/soul_code/gpt/search_with_lepton/search_with_lepton.py", line 563, in query_function result = self.kv.get(search_uuid) AttributeError: 'RAG' object has no attribute 'kv' , will generate again. 2024-07-02 11:14:09.612 | INFO | main:search_with_searchapi:215 - {'q': '袁泉演了一个乘务员救了一飞机的人', 'engine': 'google', 'num': 10} {'Authorization': 'Bearer s6Zqers1erJh3KMFBybFtCv6', 'Content-Type': 'application/json'} s6Zqers1erJh3KMFBybFtCv6 袁泉演了一个乘务员救了一飞机的人 https://www.searchapi.io/api/v1/search 2024-07-02 11:14:13.058 | ERROR | main:query_function:620 - encountered error: Unauthorized Traceback (most recent call last): File "/media/soul/EC3C5BDA3C5B9E80/win10/soul_code/gpt/search_with_lepton/search_with_lepton.py", line 600, in query_function llm_response = client.chat.completions.create( File "/home/soul/anaconda3/envs/search/lib/python3.9/site-packages/openai/_utils/_utils.py", line 277, in wrapper return func(*args, **kwargs) File "/home/soul/anaconda3/envs/search/lib/python3.9/site-packages/openai/resources/chat/completions.py", line 643, in create return self._post( File "/home/soul/anaconda3/envs/search/lib/python3.9/site-packages/openai/_base_client.py", line 1250, in post return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls)) File "/home/soul/anaconda3/envs/search/lib/python3.9/site-packages/openai/_base_client.py", line 931, in request return self._request( File "/home/soul/anaconda3/envs/search/lib/python3.9/site-packages/openai/_base_client.py", line 1030, in _request raise self._make_status_error_from_response(err.response) from None openai.AuthenticationError: Unauthorized

2024-07-02 11:14:13,060 - INFO: 127.0.0.1:50632 - "POST /query HTTP/1.1" 200 OK 2024-07-02 11:14:13,062 - ERROR: Exception in ASGI application Traceback (most recent call last): File "/home/soul/anaconda3/envs/search/lib/python3.9/site-packages/starlette/responses.py", line 265, in call await wrap(partial(self.listen_for_disconnect, receive)) File "/home/soul/anaconda3/envs/search/lib/python3.9/site-packages/starlette/responses.py", line 261, in wrap await func() File "/home/soul/anaconda3/envs/search/lib/python3.9/site-packages/starlette/responses.py", line 238, in listen_for_disconnect message = await receive() File "/home/soul/anaconda3/envs/search/lib/python3.9/site-packages/uvicorn/protocols/http/httptools_impl.py", line 553, in receive await self.message_event.wait() File "/home/soul/anaconda3/envs/search/lib/python3.9/asyncio/locks.py", line 226, in wait await fut asyncio.exceptions.CancelledError: Cancelled by cancel scope 7f11dea3c610

During handling of the above exception, another exception occurred:

goldwater668 commented 5 days ago

It is correct to replace LEPTON_WORKSPACE_TOKEN with LEPTON_API_TOKEN. Why is this?