Open xiguiw opened 2 days ago
@xiguiw , I see the error logs said you didn't provide huggingface token:
Value error, Could not authenticate with huggingface_hub. Please check your API token.
Please make sure you have specified below env: HF_TOKEN="xxxxxxxxxxxxx" HUGGINGFACEHUB_API_TOKEN=${HF_TOKEN}
@xiguiw , I see the error logs said you didn't provide huggingface token:
Value error, Could not authenticate with huggingface_hub. Please check your API token.
Please make sure you have specified below env: HF_TOKEN="xxxxxxxxxxxxx" HUGGINGFACEHUB_API_TOKEN=${HF_TOKEN}
Yes I found the log messages. The fact is huggingface token is set.
Here is what I set
Set the Environment
export ip_address=$(hostname -I | awk '{print $1}') export model="Intel/neural-chat-7b-v3-3" export HUGGINGFACEHUB_API_TOKEN=${HUGGINGFACEHUB_API_TOKEN} export HF_TOKEN=${HUGGINGFACEHUB_API_TOKEN}
I wonder the "huggingface token" I set it part of the input.
@xiguiw , may you also check the endpoint you provided, I saw logs show something as below
[type=value_error, input_value={'endpoint_url': 'http://...://10.239.182.158:8080'}
in
2024-10-21T04:10:05.346595464Z pydantic_core._pydantic_core.ValidationError: 1 validation error for HuggingFaceEndpoint
2024-10-21T04:10:05.346602020Z Value error, Could not authenticate with huggingface_hub. Please check your API token. [type=value_error, input_value={'endpoint_url': 'http://...://10.239.182.158:8080'}, input_type=dict]
2024-10-21T04:10:05.346611397Z For further information visit https://errors.pydantic.dev/2.9/v/value_error
@xuechendi Thanks Chendi,
it seems agent cannot access local TGI services (the llm endpoint) . After I added ip_address to the no_proxy environment and set no_proxy to the agent. it can access the TGI services.
But it raised another error this time:
Ratelimit
.
duckduckgo_search.exceptions.RatelimitException: https://duckduckgo.com/ 202 Ratelimit
2024-10-23T01:34:13.742835233Z > Entering new AgentExecutor chain...
2024-10-23T01:34:13.742842816Z ---
2024-10-23T01:34:13.742848336Z Knowing the weather helps us plan our day
2024-10-23T01:34:13.742854873Z Action: duckduckgo_search
2024-10-23T01:34:13.742860706Z Action Input: 'weather today in Austin'
2024-10-23T01:34:13.742866428Z ObservationThe token has not been saved to the git credentials helper. Pass `add_to_git_credential=True` in this function directly or `--add-to-git-credential` if using via `huggingface-cli` if you want to set the git credential as well.
2024-10-23T01:34:13.742875048Z Token is valid (permission: read).
2024-10-23T01:34:13.742880653Z Your token has been saved to /home/user/.cache/huggingface/token
2024-10-23T01:34:13.742886173Z Login successful
2024-10-23T01:34:13.742891724Z [DuckDuckGoSearchRun(api_wrapper=DuckDuckGoSearchAPIWrapper(region='wt-wt', safesearch='moderate', time='y', max_results=5, backend='api', source='text'))]
2024-10-23T01:34:13.742897976Z -----------STREAMING-------------
2024-10-23T01:34:13.742903408Z INFO: 10.239.182.158:60956 - "POST /v1/chat/completions HTTP/1.1" 200 OK
2024-10-23T01:34:13.760912905Z /home/user/.local/lib/python3.11/site-packages/huggingface_hub/inference/_generated/_async_client.py:2091: FutureWarning: `stop_sequences` is a deprecated argument for `text_generation` task and will be removed in version '0.28.0'. Use `stop` instead.
2024-10-23T01:34:13.761000314Z warnings.warn(
2024-10-23T01:34:19.292844549Z ERROR: Exception in ASGI application
2024-10-23T01:34:19.292909574Z Traceback (most recent call last):
2024-10-23T01:34:19.292917586Z File "/home/user/.local/lib/python3.11/site-packages/starlette/responses.py", line 257, in __call__
2024-10-23T01:34:19.292924780Z await wrap(partial(self.listen_for_disconnect, receive))
2024-10-23T01:34:19.293049607Z File "/home/user/.local/lib/python3.11/site-packages/starlette/responses.py", line 253, in wrap
2024-10-23T01:34:19.293056358Z await func()
2024-10-23T01:34:19.293061949Z File "/home/user/.local/lib/python3.11/site-packages/starlette/responses.py", line 230, in listen_for_disconnect
2024-10-23T01:34:19.293068815Z message = await receive()
2024-10-23T01:34:19.293074145Z ^^^^^^^^^^^^^^^
2024-10-23T01:34:19.293080118Z File "/home/user/.local/lib/python3.11/site-packages/uvicorn/protocols/http/h11_impl.py", line 534, in receive
2024-10-23T01:34:19.293086675Z await self.message_event.wait()
2024-10-23T01:34:19.293092365Z File "/usr/local/lib/python3.11/asyncio/locks.py", line 213, in wait
2024-10-23T01:34:19.293098129Z await fut
2024-10-23T01:34:19.293103345Z asyncio.exceptions.CancelledError: Cancelled by cancel scope 7c96024c43d0
2024-10-23T01:34:19.293109309Z
2024-10-23T01:34:19.293114734Z During handling of the above exception, another exception occurred:
2024-10-23T01:34:19.293120429Z
2024-10-23T01:34:19.293125825Z + Exception Group Traceback (most recent call last):
2024-10-23T01:34:19.293131369Z | File "/home/user/.local/lib/python3.11/site-packages/uvicorn/protocols/http/h11_impl.py", line 406, in run_asgi
2024-10-23T01:34:19.293137818Z | result = await app( # type: ignore[func-returns-value]
2024-10-23T01:34:19.293143320Z | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-10-23T01:34:19.293149115Z | File "/home/user/.local/lib/python3.11/site-packages/uvicorn/middleware/proxy_headers.py", line 70, in __call__
2024-10-23T01:34:19.293155025Z | return await self.app(scope, receive, send)
2024-10-23T01:34:19.293160354Z | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-10-23T01:34:19.293165735Z | File "/home/user/.local/lib/python3.11/site-packages/fastapi/applications.py", line 1054, in __call__
2024-10-23T01:34:19.293171625Z | await super().__call__(scope, receive, send)
2024-10-23T01:34:19.293177015Z | File "/home/user/.local/lib/python3.11/site-packages/starlette/applications.py", line 113, in __call__
2024-10-23T01:34:19.293182822Z | await self.middleware_stack(scope, receive, send)
2024-10-23T01:34:19.293208194Z | File "/home/user/.local/lib/python3.11/site-packages/starlette/middleware/errors.py", line 187, in __call__
2024-10-23T01:34:19.293213247Z | raise exc
2024-10-23T01:34:19.293217027Z | File "/home/user/.local/lib/python3.11/site-packages/starlette/middleware/errors.py", line 165, in __call__
2024-10-23T01:34:19.293223629Z | await self.app(scope, receive, _send)
2024-10-23T01:34:19.293227785Z | File "/home/user/.local/lib/python3.11/site-packages/prometheus_fastapi_instrumentator/middleware.py", line 174, in __call__
2024-10-23T01:34:19.293232389Z | raise exc
2024-10-23T01:34:19.293236187Z | File "/home/user/.local/lib/python3.11/site-packages/prometheus_fastapi_instrumentator/middleware.py", line 172, in __call__
2024-10-23T01:34:19.293240729Z | await self.app(scope, receive, send_wrapper)
2024-10-23T01:34:19.293244665Z | File "/home/user/.local/lib/python3.11/site-packages/starlette/middleware/cors.py", line 85, in __call__
2024-10-23T01:34:19.293249000Z | await self.app(scope, receive, send)
2024-10-23T01:34:19.293253020Z | File "/home/user/.local/lib/python3.11/site-packages/starlette/middleware/exceptions.py", line 62, in __call__
2024-10-23T01:34:19.293257655Z | await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
2024-10-23T01:34:19.293262034Z | File "/home/user/.local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 62, in wrapped_app
2024-10-23T01:34:19.293267138Z | raise exc
2024-10-23T01:34:19.293270780Z | File "/home/user/.local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 51, in wrapped_app
2024-10-23T01:34:19.293275318Z | await app(scope, receive, sender)
2024-10-23T01:34:19.293279280Z | File "/home/user/.local/lib/python3.11/site-packages/starlette/routing.py", line 715, in __call__
2024-10-23T01:34:19.293284329Z | await self.middleware_stack(scope, receive, send)
2024-10-23T01:34:19.293288214Z | File "/home/user/.local/lib/python3.11/site-packages/starlette/routing.py", line 735, in app
2024-10-23T01:34:19.293293005Z | await route.handle(scope, receive, send)
2024-10-23T01:34:19.293296998Z | File "/home/user/.local/lib/python3.11/site-packages/starlette/routing.py", line 288, in handle
2024-10-23T01:34:19.293301338Z | await self.app(scope, receive, send)
2024-10-23T01:34:19.293305255Z | File "/home/user/.local/lib/python3.11/site-packages/starlette/routing.py", line 76, in app
2024-10-23T01:34:19.293309540Z | await wrap_app_handling_exceptions(app, request)(scope, receive, send)
2024-10-23T01:34:19.293313935Z | File "/home/user/.local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 62, in wrapped_app
2024-10-23T01:34:19.293318334Z | raise exc
2024-10-23T01:34:19.293321915Z | File "/home/user/.local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 51, in wrapped_app
2024-10-23T01:34:19.293331895Z | await app(scope, receive, sender)
2024-10-23T01:34:19.293336018Z | File "/home/user/.local/lib/python3.11/site-packages/starlette/routing.py", line 74, in app
2024-10-23T01:34:19.293340755Z | await response(scope, receive, send)
2024-10-23T01:34:19.293344635Z | File "/home/user/.local/lib/python3.11/site-packages/starlette/responses.py", line 250, in __call__
2024-10-23T01:34:19.293349038Z | async with anyio.create_task_group() as task_group:
2024-10-23T01:34:19.293353009Z | File "/home/user/.local/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 685, in __aexit__
2024-10-23T01:34:19.293357307Z | raise BaseExceptionGroup(
2024-10-23T01:34:19.293361078Z | ExceptionGroup: unhandled errors in a TaskGroup (1 sub-exception)
2024-10-23T01:34:19.293365205Z +-+---------------- 1 ----------------
2024-10-23T01:34:19.293369054Z | Traceback (most recent call last):
2024-10-23T01:34:19.293372827Z | File "/home/user/.local/lib/python3.11/site-packages/starlette/responses.py", line 253, in wrap
2024-10-23T01:34:19.293377407Z | await func()
2024-10-23T01:34:19.293381185Z | File "/home/user/.local/lib/python3.11/site-packages/starlette/responses.py", line 242, in stream_response
2024-10-23T01:34:19.293385695Z | async for chunk in self.body_iterator:
2024-10-23T01:34:19.293389600Z | File "/home/user/comps/agent/langchain/src/strategy/react/planner.py", line 59, in stream_generator
2024-10-23T01:34:19.293394292Z | async for chunk in self.app.astream(initial_state, config=config):
2024-10-23T01:34:19.293398495Z | File "/home/user/.local/lib/python3.11/site-packages/langchain/agents/agent.py", line 1810, in astream
2024-10-23T01:34:19.293402938Z | async for step in iterator:
2024-10-23T01:34:19.293406834Z | File "/home/user/.local/lib/python3.11/site-packages/langchain/agents/agent_iterator.py", line 266, in __aiter__
2024-10-23T01:34:19.293411335Z | async for chunk in self.agent_executor._aiter_next_step(
2024-10-23T01:34:19.293415440Z | File "/home/user/.local/lib/python3.11/site-packages/langchain/agents/agent.py", line 1556, in _aiter_next_step
2024-10-23T01:34:19.293419847Z | result = await asyncio.gather(
2024-10-23T01:34:19.293423638Z | ^^^^^^^^^^^^^^^^^^^^^
2024-10-23T01:34:19.293427425Z | File "/home/user/.local/lib/python3.11/site-packages/langchain/agents/agent.py", line 1589, in _aperform_agent_action
2024-10-23T01:34:19.293431945Z | observation = await tool.arun(
2024-10-23T01:34:19.293435820Z | ^^^^^^^^^^^^^^^^
2024-10-23T01:34:19.293439807Z | File "/home/user/.local/lib/python3.11/site-packages/langchain_core/tools/base.py", line 808, in arun
2024-10-23T01:34:19.293444185Z | raise error_to_raise
2024-10-23T01:34:19.293448095Z | File "/home/user/.local/lib/python3.11/site-packages/langchain_core/tools/base.py", line 775, in arun
2024-10-23T01:34:19.293457149Z | response = await asyncio.create_task(coro, context=context) # type: ignore
2024-10-23T01:34:19.293462938Z | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-10-23T01:34:19.293467000Z | File "/home/user/.local/lib/python3.11/site-packages/langchain_core/tools/base.py", line 575, in _arun
2024-10-23T01:34:19.293471658Z | return await run_in_executor(None, self._run, *args, **kwargs)
2024-10-23T01:34:19.293475652Z | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-10-23T01:34:19.293479627Z | File "/home/user/.local/lib/python3.11/site-packages/langchain_core/runnables/config.py", line 590, in run_in_executor
2024-10-23T01:34:19.293484098Z | return await asyncio.get_running_loop().run_in_executor(
2024-10-23T01:34:19.293488127Z | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-10-23T01:34:19.293492095Z | File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run
2024-10-23T01:34:19.293496458Z | result = self.fn(*self.args, **self.kwargs)
2024-10-23T01:34:19.293500625Z | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-10-23T01:34:19.293504647Z | File "/home/user/.local/lib/python3.11/site-packages/langchain_core/runnables/config.py", line 581, in wrapper
2024-10-23T01:34:19.293509081Z | return func(*args, **kwargs)
2024-10-23T01:34:19.293512987Z | ^^^^^^^^^^^^^^^^^^^^^
2024-10-23T01:34:19.293516940Z | File "/home/user/.local/lib/python3.11/site-packages/langchain_community/tools/ddg_search/tool.py", line 73, in _run
2024-10-23T01:34:19.293521349Z | return self.api_wrapper.run(query)
2024-10-23T01:34:19.293525125Z | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-10-23T01:34:19.293529015Z | File "/home/user/.local/lib/python3.11/site-packages/langchain_community/utilities/duckduckgo_search.py", line 97, in run
2024-10-23T01:34:19.293533674Z | results = self._ddgs_text(query)
2024-10-23T01:34:19.293537645Z | ^^^^^^^^^^^^^^^^^^^^^^
2024-10-23T01:34:19.293541618Z | File "/home/user/.local/lib/python3.11/site-packages/langchain_community/utilities/duckduckgo_search.py", line 64, in _ddgs_text
2024-10-23T01:34:19.293546918Z | ddgs_gen = ddgs.text(
2024-10-23T01:34:19.293551265Z | ^^^^^^^^^^
2024-10-23T01:34:19.293555065Z | File "/home/user/.local/lib/python3.11/site-packages/duckduckgo_search/duckduckgo_search.py", line 239, in text
2024-10-23T01:34:19.293559465Z | results = self._text_api(keywords, region, safesearch, timelimit, max_results)
2024-10-23T01:34:19.293563569Z | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-10-23T01:34:19.293567909Z | File "/home/user/.local/lib/python3.11/site-packages/duckduckgo_search/duckduckgo_search.py", line 273, in _text_api
2024-10-23T01:34:19.293577535Z | vqd = self._get_vqd(keywords)
2024-10-23T01:34:19.293581575Z | ^^^^^^^^^^^^^^^^^^^^^^^
2024-10-23T01:34:19.293585360Z | File "/home/user/.local/lib/python3.11/site-packages/duckduckgo_search/duckduckgo_search.py", line 134, in _get_vqd
2024-10-23T01:34:19.293590235Z | resp_content = self._get_url("POST", "https://duckduckgo.com", data={"q": keywords})
2024-10-23T01:34:19.293595707Z | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-10-23T01:34:19.293599925Z | File "/home/user/.local/lib/python3.11/site-packages/duckduckgo_search/duckduckgo_search.py", line 129, in _get_url
2024-10-23T01:34:19.293604360Z | raise RatelimitException(f"{resp.url} {resp.status_code} Ratelimit")
2024-10-23T01:34:19.293608938Z | duckduckgo_search.exceptions.RatelimitException: https://duckduckgo.com/ 202 Ratelimit
2024-10-23T01:34:19.293613247Z +------------------------------------
Follow agent comp started the TGI and Agent service, agent service failed.
start agent microservices with tgi
TGI service works, however, validate agent service failed.
Set the Environment
docker run -d -it --name "comps-tgi-xeon-service" -p 8080:80 -v ./data:/data -e HF_TOKEN=$HF_TOKEN -e HUGGINGFACEHUB_API_TOKEN=${HUGGINGFACEHUB_API_TOKEN} -e http_proxy=${http_proxy} -e https_proxy=${https_proxy} -e OMPI_MCA_btl_vader_single_copy_mechanism=none --cap-add=sys_nice --ipc=host -e no_proxy=${no_proxy} ghcr.io/huggingface/text-generation-inference:sha-e4201f4-intel-cpu --model-id $model --max-input-tokens 4096 --max-total-tokens 8092 --cuda-graphs 0
1.1 validate TGI service works
output correct:
check status
docker logs comps-langchain-agent-endpoint
The following Validate Microservice fails
expected output
Actual result:
Note HUGGINGFACEHUB_API_TOKEN is set and used in first TGI services. But the log to check HUGGINGFACEHUB_API_TOKEN.
(2024-10-21T04:10:05.346595464Z pydantic_core._pydantic_core.ValidationError: 1 validation error for HuggingFaceEndpoint 2024-10-21T04:10:05.346602020Z Value error, Could not authenticate with huggingface_hub. Please check your API token. [type=value_error, input_value={'endpoint_url': 'http://...://10.239.182.158:8080'}, input_type=dict] 2024-10-21T04:10:05.346611397Z For further information visit https://errors.pydantic.dev/2.9/v/value_error )