Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Invalid URL" - Can't add external Ollama API #25

Open
4 tasks done
gabrielbelli opened this issue Feb 9, 2024 · 2 comments
Open
4 tasks done

"Invalid URL" - Can't add external Ollama API #25

gabrielbelli opened this issue Feb 9, 2024 · 2 comments

Comments

@gabrielbelli
Copy link

gabrielbelli commented Feb 9, 2024

System Health details

System Information

version core-2024.2.0
installation_type Home Assistant OS
dev false
hassio true
docker true
user root
virtualenv false
python_version 3.12.1
os_name Linux
os_version 6.1.74-haos
arch x86_64
timezone America/Sao_Paulo
config_dir /config
Home Assistant Community Store
GitHub API ok
GitHub Content ok
GitHub Web ok
GitHub API Calls Remaining 4960
Installed Version 1.34.0
Stage running
Available Repositories 1460
Downloaded Repositories 2
HACS Data ok
Home Assistant Cloud
logged_in false
can_reach_cert_server ok
can_reach_cloud_auth ok
can_reach_cloud ok
Home Assistant Supervisor
host_os Home Assistant OS 11.5
update_channel stable
supervisor_version supervisor-2024.01.1
agent_version 1.6.0
docker_version 24.0.7
disk_total 30.8 GB
disk_used 5.7 GB
healthy true
supported true
board ova
supervisor_api ok
version_api ok
installed_addons Advanced SSH & Web Terminal (17.1.0), Let's Encrypt (5.0.15), Piper (1.4.0), Whisper (1.0.2), openWakeWord (1.8.2)
Dashboards
dashboards 1
resources 0
mode auto-gen
Recorder
oldest_recorder_run 7 February 2024 at 22:05
current_recorder_run 8 February 2024 at 20:38
estimated_db_size 0.75 MiB
database_engine sqlite
database_version 3.44.2

Checklist

  • I have enabled debug logging for my installation.
  • I have filled out the issue template to the best of my ability.
  • This issue only contains 1 issue (if you have multiple issues, open one issue for each issue).
  • This issue is not a duplicate issue of any previous issues..

Describe the issue

I'm trying to use my existing Ollama API, but when I try to set the URL I get the error "Invalid URL".

Reproduction steps

Browse to your Home Assistant instance.
Go to Settings > Devices & Services.
In the bottom right corner, select the Add Integration button.
From the list, select Ollama Conversation.
Insert "http(s)://anything.com" on the URL

Debug logs

2024-02-08 20:38:51.456 WARNING (SyncWorker_2) [homeassistant.loader] We found a custom integration ollama_conversation which has not been tested by Home Assistant. This component might cause stability problems, be sure to disable it if you experience issues with Home Assistant
2024-02-08 20:38:51.457 WARNING (SyncWorker_2) [homeassistant.loader] We found a custom integration hacs which has not been tested by Home Assistant. This component might cause stability problenothing herems, be sure to disable it if you experience issues with Home Assistant
2024-02-08 20:38:55.277 WARNING (MainThread) [homeassistant.components.ssdp] Could not set up UPnP/SSDP server, as a presentation URL could not be determined; Please configure your internal URL in the Home Assistant general configuration

Diagnostics dump

nothing here

@Darknetzz
Copy link

Darknetzz commented Feb 29, 2024

Just dropping in here because I experienced the same problem.

Are you running with environment variable OLLAMA_HOST set to 0.0.0.0?

I'm running my Ollama instance on an Ubuntu VM, and I had to set the following in /etc/systemd/system/ollama.service under the [Service] section:

Environment="OLLAMA_HOST=0.0.0.0"

The reason I couldn't connect from anywhere else is because Ollama listens only to localhost (127.0.0.1) by default, and does not accept incoming connections from the local network etc.

@Roger4R
Copy link

Roger4R commented Jun 25, 2024

I installed Ollama via HACS on Home Assistant.
I restarted the system and when trying to add the Ollama integration it asks to enter the URL.
So after entering it gives the following error in the Log:
V1.0.2

Unexpected exception
Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/ollama/config_flow.py", line 89, in async_step_user
response = await self.client.list()
^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/ollama/_client.py", line 617, in list
response = await self._request('GET', '/api/tags')
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/ollama/_client.py", line 343, in _request
response = await self._client.request(method, url, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/httpx/_client.py", line 1574, in request
return await self.send(request, auth=auth, follow_redirects=follow_redirects)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/httpx/_client.py", line 1661, in send
response = await self._send_handling_auth(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/httpx/_client.py", line 1689, in _send_handling_auth
response = await self._send_handling_redirects(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/httpx/_client.py", line 1726, in _send_handling_redirects
response = await self._send_single_request(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/httpx/_client.py", line 1763, in _send_single_request
response = await transport.handle_async_request(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/httpx/_transports/default.py", line 373, in handle_async_request
resp = await self._pool.handle_async_request(req)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/httpcore/_async/connection_pool.py", line 216, in handle_async_request
raise exc from None
File "/usr/local/lib/python3.12/site-packages/httpcore/_async/connection_pool.py", line 196, in handle_async_request
response = await connection.handle_async_request(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/httpcore/_async/connection.py", line 99, in handle_async_request
raise exc
File "/usr/local/lib/python3.12/site-packages/httpcore/_async/connection.py", line 76, in handle_async_request
stream = await self._connect(request)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/httpcore/_async/connection.py", line 154, in _connect
stream = await stream.start_tls(**kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/httpcore/_backends/anyio.py", line 80, in start_tls
raise exc
File "/usr/local/lib/python3.12/site-packages/httpcore/_backends/anyio.py", line 71, in start_tls
ssl_stream = await anyio.streams.tls.TLSStream.wrap(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/anyio/streams/tls.py", line 132, in wrap
await wrapper._call_sslobject_method(ssl_object.do_handshake)
File "/usr/local/lib/python3.12/site-packages/anyio/streams/tls.py", line 140, in _call_sslobject_method
result = func(*args)
^^^^^^^^^^^
File "/usr/local/lib/python3.12/ssl.py", line 917, in do_handshake
self._sslobj.do_handshake()
ssl.SSLError: [SSL: TLSV1_UNRECOGNIZED_NAME] tlsv1 unrecognized name (_ssl.c:1000)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants