meta-llama / llama-stack-apps

Agentic components of the Llama Stack APIs
MIT License
3.83k stars 557 forks source link

Generator cancelled - httpx.ReadTimeout #56

Open frieda-huang opened 2 months ago

frieda-huang commented 2 months ago

Hi! After I ran python3 /Users/friedahuang/Documents/eon/llama-agentic-system/examples/scripts/hello.py localhost 5001 --disable_safety, I encountered the following error. Any ideas?

For context, I'm using Apple M2 Pro

User> Hello
StepType.inference> Traceback (most recent call last):
  File "/Users/friedahuang/Documents/eon/.venv/lib/python3.12/site-packages/httpx/_transports/default.py", line 66, in map_httpcore_exceptions
    yield
  File "/Users/friedahuang/Documents/eon/.venv/lib/python3.12/site-packages/httpx/_transports/default.py", line 249, in __aiter__
    async for part in self._httpcore_stream:
  File "/Users/friedahuang/Documents/eon/.venv/lib/python3.12/site-packages/httpcore/_async/connection_pool.py", line 367, in __aiter__
    raise exc from None
  File "/Users/friedahuang/Documents/eon/.venv/lib/python3.12/site-packages/httpcore/_async/connection_pool.py", line 363, in __aiter__
    async for part in self._stream:
  File "/Users/friedahuang/Documents/eon/.venv/lib/python3.12/site-packages/httpcore/_async/http11.py", line 349, in __aiter__
    raise exc
  File "/Users/friedahuang/Documents/eon/.venv/lib/python3.12/site-packages/httpcore/_async/http11.py", line 341, in __aiter__
    async for chunk in self._connection._receive_response_body(**kwargs):
  File "/Users/friedahuang/Documents/eon/.venv/lib/python3.12/site-packages/httpcore/_async/http11.py", line 210, in _receive_response_body
    event = await self._receive_event(timeout=timeout)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/friedahuang/Documents/eon/.venv/lib/python3.12/site-packages/httpcore/_async/http11.py", line 224, in _receive_event
    data = await self._network_stream.read(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/friedahuang/Documents/eon/.venv/lib/python3.12/site-packages/httpcore/_backends/anyio.py", line 32, in read
    with map_exceptions(exc_map):
  File "/opt/homebrew/Cellar/python@3.12/3.12.4/Frameworks/Python.framework/Versions/3.12/lib/python3.12/contextlib.py", line 158, in __exit__
    self.gen.throw(value)
  File "/Users/friedahuang/Documents/eon/.venv/lib/python3.12/site-packages/httpcore/_exceptions.py", line 14, in map_exceptions
    raise to_exc(exc) from exc
httpcore.ReadTimeout

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

Traceback (most recent call last):
  File "/Users/friedahuang/Documents/eon/llama-agentic-system/examples/scripts/hello.py", line 34, in <module>
    fire.Fire(main)
  File "/Users/friedahuang/Documents/eon/.venv/lib/python3.12/site-packages/fire/core.py", line 143, in Fire
    component_trace = _Fire(component, args, parsed_flag_args, context, name)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/friedahuang/Documents/eon/.venv/lib/python3.12/site-packages/fire/core.py", line 477, in _Fire
    component, remaining_args = _CallAndUpdateTrace(
                                ^^^^^^^^^^^^^^^^^^^^
  File "/Users/friedahuang/Documents/eon/.venv/lib/python3.12/site-packages/fire/core.py", line 693, in _CallAndUpdateTrace
    component = fn(*varargs, **kwargs)
                ^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/friedahuang/Documents/eon/llama-agentic-system/examples/scripts/hello.py", line 18, in main
    asyncio.run(
  File "/opt/homebrew/Cellar/python@3.12/3.12.4/Frameworks/Python.framework/Versions/3.12/lib/python3.12/asyncio/runners.py", line 194, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/python@3.12/3.12.4/Frameworks/Python.framework/Versions/3.12/lib/python3.12/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/Cellar/python@3.12/3.12.4/Frameworks/Python.framework/Versions/3.12/lib/python3.12/asyncio/base_events.py", line 687, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/Users/friedahuang/Documents/eon/llama-agentic-system/examples/scripts/multi_turn.py", line 58, in run_main
    async for event, log in EventLogger().log(iterator):
  File "/Users/friedahuang/Documents/eon/.venv/lib/python3.12/site-packages/llama_toolchain/agentic_system/event_logger.py", line 51, in log
    async for chunk in event_generator:
  File "/Users/friedahuang/Documents/eon/.venv/lib/python3.12/site-packages/llama_toolchain/agentic_system/tools/custom/execute.py", line 45, in execute_with_custom_tools
    async for chunk in system.create_agentic_system_turn(request):
  File "/Users/friedahuang/Documents/eon/.venv/lib/python3.12/site-packages/llama_toolchain/agentic_system/client.py", line 84, in create_agentic_system_turn
    async for line in response.aiter_lines():
  File "/Users/friedahuang/Documents/eon/.venv/lib/python3.12/site-packages/httpx/_models.py", line 966, in aiter_lines
    async for text in self.aiter_text():
  File "/Users/friedahuang/Documents/eon/.venv/lib/python3.12/site-packages/httpx/_models.py", line 953, in aiter_text
    async for byte_content in self.aiter_bytes():
  File "/Users/friedahuang/Documents/eon/.venv/lib/python3.12/site-packages/httpx/_models.py", line 932, in aiter_bytes
    async for raw_bytes in self.aiter_raw():
  File "/Users/friedahuang/Documents/eon/.venv/lib/python3.12/site-packages/httpx/_models.py", line 990, in aiter_raw
    async for raw_stream_bytes in self.stream:
  File "/Users/friedahuang/Documents/eon/.venv/lib/python3.12/site-packages/httpx/_client.py", line 146, in __aiter__
    async for chunk in self._stream:
  File "/Users/friedahuang/Documents/eon/.venv/lib/python3.12/site-packages/httpx/_transports/default.py", line 248, in __aiter__
    with map_httpcore_exceptions():
  File "/opt/homebrew/Cellar/python@3.12/3.12.4/Frameworks/Python.framework/Versions/3.12/lib/python3.12/contextlib.py", line 158, in __exit__
    self.gen.throw(value)
  File "/Users/friedahuang/Documents/eon/.venv/lib/python3.12/site-packages/httpx/_transports/default.py", line 83, in map_httpcore_exceptions
    raise mapped_exc(message) from exc
httpx.ReadTimeout
Environment: ipython
Tools: brave_search, wolfram_alpha, photogen
Cutting Knowledge Date: December 2023
Today Date: 28 August 2024

INFO:     ::1:55142 - "POST /agentic_system/create HTTP/1.1" 200 OK
INFO:     ::1:55143 - "POST /agentic_system/session/create HTTP/1.1" 200 OK
INFO:     ::1:55144 - "POST /agentic_system/turn/create HTTP/1.1" 200 OK
role='user' content='Hello'
Pulling model: llama3.1:8b-instruct-fp16
Generator cancelled
yttbgf commented 2 months ago

excute[ ollama run llama3.1:8b-instruct-fp16 ]to warm in case of the time first time to load too long

frieda-huang commented 2 months ago

excute[ ollama run llama3.1:8b-instruct-fp16 ]to warm in case of the time first time to load too long

Thank you!! It works now!

Mmmmm92 commented 2 months ago

User> Hello StepType.inference> Traceback (most recent call last): File "/Users/friedahuang/Documents/eon/.venv/lib/python3.12/site-packages/httpx/_transports/default.py", line 66, in map_httpcore_exceptions yield File "/Users/friedahuang/Documents/eon/.venv/lib/python3.12/site-packages/httpx/_transports/default.py", line 249, in aiter async for part in self._httpcore_stream: File "/Users/friedahuang/Documents/eon/.venv/lib/python3.12/site-packages/httpcore/_async/connection_pool.py", line 367, in aiter raise exc from None File "/Users/friedahuang/Documents/eon/.venv/lib/python3.12/site-packages/httpcore/_async/connection_pool.py", line 363, in aiter async for part in self._stream: File "/Users/friedahuang/Documents/eon/.venv/lib/python3.12/site-packages/httpcore/_async/http11.py", line 349, in aiter raise exc File "/Users/friedahuang/Documents/eon/.venv/lib/python3.12/site-packages/httpcore/_async/http11.py", line 341, in aiter async for chunk in self._connection._receive_response_body(**kwargs): File "/Users/friedahuang/Documents/eon/.venv/lib/python3.12/site-packages/httpcore/_async/http11.py", line 210, in _receive_response_body event = await self._receive_event(timeout=timeout) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/friedahuang/Documents/eon/.venv/lib/python3.12/site-packages/httpcore/_async/http11.py", line 224, in _receive_event data = await self._network_stream.read( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/friedahuang/Documents/eon/.venv/lib/python3.12/site-packages/httpcore/_backends/anyio.py", line 32, in read with map_exceptions(exc_map): File "/opt/homebrew/Cellar/python@3.12/3.12.4/Frameworks/Python.framework/Versions/3.12/lib/python3.12/contextlib.py", line 158, in exit self.gen.throw(value) File "/Users/friedahuang/Documents/eon/.venv/lib/python3.12/site-packages/httpcore/_exceptions.py", line 14, in map_exceptions raise to_exc(exc) from exc httpcore.ReadTimeout

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

Traceback (most recent call last): File "/Users/friedahuang/Documents/eon/llama-agentic-system/examples/scripts/hello.py", line 34, in fire.Fire(main) File "/Users/friedahuang/Documents/eon/.venv/lib/python3.12/site-packages/fire/core.py", line 143, in Fire component_trace = _Fire(component, args, parsed_flag_args, context, name) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/friedahuang/Documents/eon/.venv/lib/python3.12/site-packages/fire/core.py", line 477, in _Fire component, remaining_args = _CallAndUpdateTrace( ^^^^^^^^^^^^^^^^^^^^ File "/Users/friedahuang/Documents/eon/.venv/lib/python3.12/site-packages/fire/core.py", line 693, in _CallAndUpdateTrace component = fn(*varargs, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^ File "/Users/friedahuang/Documents/eon/llama-agentic-system/examples/scripts/hello.py", line 18, in main asyncio.run( File "/opt/homebrew/Cellar/python@3.12/3.12.4/Frameworks/Python.framework/Versions/3.12/lib/python3.12/asyncio/runners.py", line 194, in run return runner.run(main) ^^^^^^^^^^^^^^^^ File "/opt/homebrew/Cellar/python@3.12/3.12.4/Frameworks/Python.framework/Versions/3.12/lib/python3.12/asyncio/runners.py", line 118, in run return self._loop.run_until_complete(task) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/homebrew/Cellar/python@3.12/3.12.4/Frameworks/Python.framework/Versions/3.12/lib/python3.12/asyncio/base_events.py", line 687, in run_until_complete return future.result() ^^^^^^^^^^^^^^^ File "/Users/friedahuang/Documents/eon/llama-agentic-system/examples/scripts/multi_turn.py", line 58, in run_main async for event, log in EventLogger().log(iterator): File "/Users/friedahuang/Documents/eon/.venv/lib/python3.12/site-packages/llama_toolchain/agentic_system/event_logger.py", line 51, in log async for chunk in event_generator: File "/Users/friedahuang/Documents/eon/.venv/lib/python3.12/site-packages/llama_toolchain/agentic_system/tools/custom/execute.py", line 45, in execute_with_custom_tools async for chunk in system.create_agentic_system_turn(request): File "/Users/friedahuang/Documents/eon/.venv/lib/python3.12/site-packages/llama_toolchain/agentic_system/client.py", line 84, in create_agentic_system_turn async for line in response.aiter_lines(): File "/Users/friedahuang/Documents/eon/.venv/lib/python3.12/site-packages/httpx/_models.py", line 966, in aiter_lines async for text in self.aiter_text(): File "/Users/friedahuang/Documents/eon/.venv/lib/python3.12/site-packages/httpx/_models.py", line 953, in aiter_text async for byte_content in self.aiter_bytes(): File "/Users/friedahuang/Documents/eon/.venv/lib/python3.12/site-packages/httpx/_models.py", line 932, in aiter_bytes async for raw_bytes in self.aiter_raw(): File "/Users/friedahuang/Documents/eon/.venv/lib/python3.12/site-packages/httpx/_models.py", line 990, in aiter_raw async for raw_stream_bytes in self.stream: File "/Users/friedahuang/Documents/eon/.venv/lib/python3.12/site-packages/httpx/_client.py", line 146, in aiter async for chunk in self._stream: File "/Users/friedahuang/Documents/eon/.venv/lib/python3.12/site-packages/httpx/_transports/default.py", line 248, in aiter with map_httpcore_exceptions(): File "/opt/homebrew/Cellar/python@3.12/3.12.4/Frameworks/Python.framework/Versions/3.12/lib/python3.12/contextlib.py", line 158, in exit self.gen.throw(value) File "/Users/friedahuang/Documents/eon/.venv/lib/python3.12/site-packages/httpx/_transports/default.py", line 83, in map_httpcore_exceptions raise mapped_exc(message) from exc httpx.ReadTimeout