diff --git a/Sentiment_Analysis_Research.py b/Sentiment_Analysis_Research.py index 2f06166..116635e 100644 --- a/Sentiment_Analysis_Research.py +++ b/Sentiment_Analysis_Research.py @@ -11,7 +11,10 @@ def _(): import ollama from ollama import Client - QUMO_OLLAMA_URL = 'http://hiperf-gpu.tail44fa00.ts.net:11434' + VM_NAME = 'hiperf-gpu' + #VM_NAME = 'ollama-vb' + + QUMO_OLLAMA_URL = f'http://{VM_NAME}.tail44fa00.ts.net:11434' return Client, QUMO_OLLAMA_URL, mo, requests diff --git a/VB_interviews_sandbox.py b/VB_interviews_sandbox.py index 30c9735..11b6e66 100644 --- a/VB_interviews_sandbox.py +++ b/VB_interviews_sandbox.py @@ -7,16 +7,26 @@ app = marimo.App(width="medium") @app.cell def _(): import marimo as mo - return (mo,) + import requests + import ollama + from ollama import Client + + VM_NAME = 'hiperf-gpu' + #VM_NAME = 'ollama-vb' + + QUMO_OLLAMA_URL = f'http://{VM_NAME}.tail44fa00.ts.net:11434' + return Client, QUMO_OLLAMA_URL, VM_NAME, mo, requests @app.cell -def _(): - import ollama - from ollama import Client - client = Client( - host='http://ollama-vb.tail44fa00.ts.net:11434' - ) +def _(Client, QUMO_OLLAMA_URL, requests): + try: + requests.get(QUMO_OLLAMA_URL, timeout=5) + client = Client( + host=QUMO_OLLAMA_URL + ) + except requests.ConnectionError: + print(f"Failed to reach {QUMO_OLLAMA_URL}. Check that the VM is running and Tailscale is up") return (client,) @@ -27,11 +37,11 @@ def _(): @app.cell(hide_code=True) -def _(mo): - mo.md(r""" +def _(VM_NAME, mo): + mo.md(rf""" # Ollama Reference - ## Ollama Web-UI: http://ollama-vb.tail44fa00.ts.net:3000 + ## Ollama Web-UI: http://{VM_NAME}.tail44fa00.ts.net:3000 Use the UI to modify system prompts, custom models, etc... **if the connection fails, make sure Tailscale is up** @@ -72,7 +82,7 @@ def _(mo): @app.cell def _(client): - response_chat = client.chat(model='deepseek-r1:7b', messages=[ + response_chat = client.chat(model='deepseek-r1:32b', messages=[ { 'role': 'user', 'content': 'Why is the sky blue?',