Cntrl+F gives some errors
odarcan opened this issue · 4 comments
Cntrl+F gives this:
Traceback (most recent call last):
File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "/home/x/.local/lib/python3.10/site-packages/shelloracle/main.py", line 24, in
main()
File "/home/x/.local/lib/python3.10/site-packages/shelloracle/main.py", line 20, in main
shelloracle.cli()
File "/home/x/.local/lib/python3.10/site-packages/shelloracle/shelloracle.py", line 66, in cli
asyncio.run(shell_oracle())
File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/usr/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
return future.result()
File "/home/x/.local/lib/python3.10/site-packages/shelloracle/shelloracle.py", line 49, in shell_oracle
provider = get_provider(config.global_config.provider)()
File "/home/x/.local/lib/python3.10/site-packages/shelloracle/provider.py", line 38, in get_provider
from .providers import Ollama, OpenAI
File "/home/x/.local/lib/python3.10/site-packages/shelloracle/providers/init.py", line 2, in
from .openai import OpenAI
File "/home/x/.local/lib/python3.10/site-packages/shelloracle/providers/openai.py", line 4, in
from openai import AsyncOpenAI as OpenAIClient
ImportError: cannot import name 'AsyncOpenAI' from 'openai' (/home/x/.local/lib/python3.10/site-packages/openai/init.py)
zsh
> list
| ExceptionGroup: multiple connection attempts failed (2 sub-exceptions)
+-+---------------- 1 ----------------
| Traceback (most recent call last):
| File "/home/ben/.local/lib/python3.11/site-packages/anyio/_core/_sockets.py", line 170, in try_connect
| stream = await asynclib.connect_tcp(remote_host, remote_port, local_address)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/home/ben/.local/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 2258, in connect_tcp
| await get_running_loop().create_connection(
| File "/usr/lib/python3.11/asyncio/base_events.py", line 1085, in create_connection
| raise exceptions[0]
| File "/usr/lib/python3.11/asyncio/base_events.py", line 1069, in create_connection
| sock = await self._connect_sock(
| ^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/usr/lib/python3.11/asyncio/base_events.py", line 973, in _connect_sock
| await self.sock_connect(sock, address)
| File "/usr/lib/python3.11/asyncio/selector_events.py", line 634, in sock_connect
| return await fut
| ^^^^^^^^^
| File "/usr/lib/python3.11/asyncio/selector_events.py", line 674, in _sock_connect_cb
| raise OSError(err, f'Connect call failed {address}')
| ConnectionRefusedError: [Errno 111] Connect call failed ('::1', 11434, 0, 0)
+---------------- 2 ----------------
| Traceback (most recent call last):
| File "/home/ben/.local/lib/python3.11/site-packages/anyio/_core/_sockets.py", line 170, in try_connect
| stream = await asynclib.connect_tcp(remote_host, remote_port, local_address)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/home/ben/.local/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 2258, in connect_tcp
| await get_running_loop().create_connection(
| File "/usr/lib/python3.11/asyncio/base_events.py", line 1085, in create_connection
| raise exceptions[0]
| File "/usr/lib/python3.11/asyncio/base_events.py", line 1069, in create_connection
| sock = await self._connect_sock(
| ^^^^^^^^^^^^^^^^^^^^^^^^^
| File "/usr/lib/python3.11/asyncio/base_events.py", line 973, in _connect_sock
| await self.sock_connect(sock, address)
| File "/usr/lib/python3.11/asyncio/selector_events.py", line 634, in sock_connect
| return await fut
| ^^^^^^^^^
| File "/usr/lib/python3.11/asyncio/selector_events.py", line 674, in _sock_connect_cb
| raise OSError(err, f'Connect call failed {address}')
| ConnectionRefusedError: [Errno 111] Connect call failed ('127.0.0.1', 11434)
+------------------------------------
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/ben/.local/lib/python3.11/site-packages/httpcore/_exceptions.py", line 10, in map_exceptions
yield
File "/home/ben/.local/lib/python3.11/site-packages/httpcore/_backends/anyio.py", line 114, in connect_tcp
stream: anyio.abc.ByteStream = await anyio.connect_tcp(
^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ben/.local/lib/python3.11/site-packages/anyio/_core/_sockets.py", line 232, in connect_tcp
raise OSError("All connection attempts failed") from cause
OSError: All connection attempts failed
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/ben/.local/lib/python3.11/site-packages/httpx/_transports/default.py", line 67, in map_httpcore_exceptions
yield
File "/home/ben/.local/lib/python3.11/site-packages/httpx/_transports/default.py", line 371, in handle_async_request
resp = await self._pool.handle_async_request(req)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ben/.local/lib/python3.11/site-packages/httpcore/_async/connection_pool.py", line 268, in handle_async_request
raise exc
File "/home/ben/.local/lib/python3.11/site-packages/httpcore/_async/connection_pool.py", line 251, in handle_async_request
response = await connection.handle_async_request(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ben/.local/lib/python3.11/site-packages/httpcore/_async/connection.py", line 99, in handle_async_request
raise exc
File "/home/ben/.local/lib/python3.11/site-packages/httpcore/_async/connection.py", line 76, in handle_async_request
stream = await self._connect(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ben/.local/lib/python3.11/site-packages/httpcore/_async/connection.py", line 124, in _connect
stream = await self._network_backend.connect_tcp(**kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ben/.local/lib/python3.11/site-packages/httpcore/_backends/auto.py", line 30, in connect_tcp
return await self._backend.connect_tcp(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ben/.local/lib/python3.11/site-packages/httpcore/_backends/anyio.py", line 112, in connect_tcp
with map_exceptions(exc_map):
File "/usr/lib/python3.11/contextlib.py", line 155, in __exit__
self.gen.throw(typ, value, traceback)
File "/home/ben/.local/lib/python3.11/site-packages/httpcore/_exceptions.py", line 14, in map_exceptions
raise to_exc(exc) from exc
httpcore.ConnectError: All connection attempts failed
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/ben/.local/lib/python3.11/site-packages/shelloracle/providers/ollama.py", line 79, in generate
async with client.stream("POST", self.endpoint, json=data, timeout=20.0) as stream:
File "/usr/lib/python3.11/contextlib.py", line 204, in __aenter__
return await anext(self.gen)
^^^^^^^^^^^^^^^^^^^^^
File "/home/ben/.local/lib/python3.11/site-packages/httpx/_client.py", line 1602, in stream
response = await self.send(
^^^^^^^^^^^^^^^^
File "/home/ben/.local/lib/python3.11/site-packages/httpx/_client.py", line 1646, in send
response = await self._send_handling_auth(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ben/.local/lib/python3.11/site-packages/httpx/_client.py", line 1674, in _send_handling_auth
response = await self._send_handling_redirects(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ben/.local/lib/python3.11/site-packages/httpx/_client.py", line 1711, in _send_handling_redirects
response = await self._send_single_request(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ben/.local/lib/python3.11/site-packages/httpx/_client.py", line 1748, in _send_single_request
response = await transport.handle_async_request(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ben/.local/lib/python3.11/site-packages/httpx/_transports/default.py", line 370, in handle_async_request
with map_httpcore_exceptions():
File "/usr/lib/python3.11/contextlib.py", line 155, in __exit__
self.gen.throw(typ, value, traceback)
File "/home/ben/.local/lib/python3.11/site-packages/httpx/_transports/default.py", line 84, in map_httpcore_exceptions
raise mapped_exc(message) from exc
httpx.ConnectError: All connection attempts failed
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "/home/ben/.local/lib/python3.11/site-packages/shelloracle/__main__.py", line 24, in <module>
main()
File "/home/ben/.local/lib/python3.11/site-packages/shelloracle/__main__.py", line 20, in main
shelloracle.cli()
File "/home/ben/.local/lib/python3.11/site-packages/shelloracle/shelloracle.py", line 66, in cli
asyncio.run(shell_oracle())
File "/usr/lib/python3.11/asyncio/runners.py", line 190, in run
return runner.run(main)
^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/asyncio/runners.py", line 118, in run
return self._loop.run_until_complete(task)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/asyncio/base_events.py", line 653, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "/home/ben/.local/lib/python3.11/site-packages/shelloracle/shelloracle.py", line 55, in shell_oracle
async for token in provider.generate(prompt):
File "/home/ben/.local/lib/python3.11/site-packages/shelloracle/providers/ollama.py", line 83, in generate
raise ProviderError(f"Something went wrong while querying Ollama: {e}") from e
~ ✔ at 13:41:24
@ben2talk Did you read the instructions in the readme? In the default configuration, Ollama needs to be installed and running. Alternatively, you can configure ShellOracle to use OpenAI
@odarcan something is wrong with your environment. The traceback doesn't really tell me anything useful other than the OpenAI library on your system is missing the async client. I'm downloading linux mint to test.
@odarcan I've just installed linux mint and tested. It works for me. Something seems to be wrong with your environment. I'd be happy to help you troubleshoot if you send me an email at djcopley@proton.me.