Ollama: Error: could not connect to ollama app, is it running?
When installing preview version of Ollama on Windows, you may encounter the following error after the installation is completed:
Error: could not connect to ollama app, is it running?
This article shows you how to fix this error and also provides an example of converting text to SQL code using a large language model sqlcoder
. The example is revised from the example provided by the model page on Ollama website.
Fix the error
I fixed the error by simply restarting the system:
This issue is then fixed.
Change Ollama model location
By default, the pulled models will be saved into user home folder on your Windows system. To save space in your user folder, you can setup an environment variable to change it to a different location:
OLLAMA_MODELS=/path/to/models
Please restart Ollama service (by quitting from the system tray icon).
Try run a model
Run the following command to run the sqlcoder model:
ollama run sqlcoder
The information about sqlcoder is available here: sqlcoder (ollama.com).
In the shell, input he following prompt:
"""
### Instructions:
Your task is to convert a question into a SQL query, given a Postgres database schema.
Adhere to these rules:
- **Deliberately go through the question and database schema word by word** to appropriately answer the question
### Input:
Generate SQL queries that answers the question `Find out product information for product id 123.`.
This query will run on a database whose schema is represented in this string:
CREATE TABLE products (
product_id INTEGER PRIMARY KEY, -- Unique ID for each product
name VARCHAR(50), -- Name of the product
price DECIMAL(10,2), -- Price of each unit of the product
quantity INTEGER -- Current quantity in stock
);
### Response:
Based on your instructions, here is the SQL query I have generated to answer the question `Find out product information for product id 123.`:
```sql
"""
The output looks like the following: