|
INSERT INTO support_ticket (subject, requester_name, requester_email, status, priority, assignee) |
|
VALUES ('How to install and set up Ollama on macOS', 'Jane Doe', 'jane.doe@example.com', 'open', 'normal', 'support_agent'); |
|
|
|
SET @tid = LAST_INSERT_ID(); |
|
|
|
INSERT INTO support_ticket_message (ticket_id, sender_type, sender_name, body) VALUES |
|
(@tid, 'requester', 'Jane Doe', |
|
'Hi, I just got a new Mac and I want to run local LLMs. Can you tell me how to install and set up Ollama on macOS?'), |
|
|
|
(@tid, 'agent', 'support_agent', |
|
'Sure! Here is how to install and set up Ollama on a Mac: |
|
|
|
1. Download the installer |
|
Go to https://ollama.com/download and download the macOS version, or use Homebrew: |
|
brew install ollama |
|
|
|
2. Install |
|
If you downloaded the .dmg, open it and drag Ollama into your Applications folder. Launch it once so the background service starts. With Homebrew the binary is installed automatically. |
|
|
|
3. Verify the install |
|
Open Terminal and run: |
|
ollama --version |
|
|
|
4. Pull and run a model |
|
ollama run llama3.2 |
|
The first run downloads the model; subsequent runs start instantly. |
|
|
|
5. Confirm the service is running |
|
Ollama serves an API at http://localhost:11434 by default. Test it with: |
|
curl http://localhost:11434/api/tags |
|
|
|
That is it - you now have a local LLM running on your Mac. Let me know if you hit any issues!'), |
|
|
|
(@tid, 'requester', 'Jane Doe', |
|
'That worked great, thanks! Quick follow-up - I also have a Linux server. How do I install Ollama there?'), |
|
|
|
(@tid, 'agent', 'support_agent', |
|
'Happy to help with Linux: |
|
|
|
1. Install via the official script |
|
The simplest method is the one-line installer: |
|
curl -fsSL https://ollama.com/install.sh | sh |
|
This installs the ollama binary and sets up a systemd service automatically on most distributions. |
|
|
|
2. Verify the install |
|
ollama --version |
|
|
|
3. Manage the service |
|
On systems with systemd: |
|
sudo systemctl status ollama |
|
sudo systemctl enable --now ollama |
|
This ensures Ollama starts on boot and is running now. |
|
|
|
4. Pull and run a model |
|
ollama run llama3.2 |
|
|
|
5. (Optional) GPU support |
|
If you have an NVIDIA GPU, install the appropriate CUDA drivers - Ollama will detect and use the GPU automatically. For AMD GPUs, ROCm-supported cards work as well. |
|
|
|
6. Confirm the API |
|
curl http://localhost:11434/api/tags |
|
|
|
Let me know if you need help with a specific distribution.'), |
|
|
|
(@tid, 'requester', 'Jane Doe', |
|
'Perfect. One more thing - port 11434 conflicts with another service on my machine. How do I run Ollama on a different port?'), |
|
|
|
(@tid, 'agent', 'support_agent', |
|
'You can change the port using the OLLAMA_HOST environment variable. |
|
|
|
Temporary (current shell only): |
|
export OLLAMA_HOST=127.0.0.1:11500 |
|
ollama serve |
|
All client commands in that same shell will then talk to the new port. To bind on all interfaces use 0.0.0.0:11500 instead. |
|
|
|
macOS (persistent): |
|
launchctl setenv OLLAMA_HOST "127.0.0.1:11500" |
|
Then quit and relaunch the Ollama app. |
|
|
|
Linux with systemd (persistent): |
|
sudo systemctl edit ollama |
|
Add the following: |
|
[Service] |
|
Environment="OLLAMA_HOST=0.0.0.0:11500" |
|
Then reload and restart: |
|
sudo systemctl daemon-reload |
|
sudo systemctl restart ollama |
|
|
|
Pointing the client at the new port: |
|
export OLLAMA_HOST=127.0.0.1:11500 |
|
ollama run llama3.2 |
|
Or per-command without exporting: |
|
OLLAMA_HOST=127.0.0.1:11500 ollama list |
|
|
|
Verify: |
|
curl http://127.0.0.1:11500/api/tags |
|
|
|
That will get Ollama off the default 11434 and onto your chosen port.'); |
|
|
|
INSERT INTO support_ticket (subject, requester_name, requester_email, status, priority, assignee) |
|
VALUES ('Help testing the Ollama API on macOS', 'Tom Reyes', 'tom.reyes@example.com', 'open', 'normal', 'support_agent'); |
|
|
|
SET @tid = LAST_INSERT_ID(); |
|
|
|
INSERT INTO support_ticket_message (ticket_id, sender_type, sender_name, body) VALUES |
|
(@tid, 'requester', 'Tom Reyes', |
|
'Hey, I have Ollama installed and running on my Mac. How can I test the API directly? I want to send a prompt and get a response back without using the ollama run command.'), |
|
|
|
(@tid, 'agent', 'support_agent', |
|
'Good question! Ollama exposes a REST API at http://localhost:11434 by default. Here are a few ways to test it from Terminal. |
|
|
|
1. Check that the server is up and see installed models: |
|
curl http://localhost:11434/api/tags |
|
|
|
2. Send a generate request (single prompt): |
|
curl http://localhost:11434/api/generate -d ''{ |
|
"model": "llama3.2", |
|
"prompt": "Why is the sky blue?", |
|
"stream": false |
|
}'' |
|
|
|
Setting "stream": false returns one complete JSON object instead of a token-by-token stream. Make sure you have pulled the model first with: ollama pull llama3.2 |
|
|
|
Give that a try and let me know what you get back.'), |
|
|
|
(@tid, 'requester', 'Tom Reyes', |
|
'That worked! The response came back as JSON. But the output had a bunch of extra fields like total_duration and eval_count. I just want the text of the answer. How do I pull out only that?'), |
|
|
|
(@tid, 'agent', 'support_agent', |
|
'You can pipe the response into jq to extract just the text. The generate endpoint returns the answer in the "response" field: |
|
|
|
curl -s http://localhost:11434/api/generate -d ''{ |
|
"model": "llama3.2", |
|
"prompt": "Why is the sky blue?", |
|
"stream": false |
|
}'' | jq -r ''.response'' |
|
|
|
The -s flag silences the progress meter, and jq -r prints the raw string without quotes. If you do not have jq, install it with: brew install jq'), |
|
|
|
(@tid, 'requester', 'Tom Reyes', |
|
'Nice, that is exactly what I needed. Last thing - is there a chat endpoint too? I want to send a conversation with multiple messages, not just a single prompt.'), |
|
|
|
(@tid, 'agent', 'support_agent', |
|
'Yes, use the /api/chat endpoint. It takes a messages array with roles, so you can pass a full conversation: |
|
|
|
curl -s http://localhost:11434/api/chat -d ''{ |
|
"model": "llama3.2", |
|
"messages": [ |
|
{ "role": "user", "content": "Hello, who won the World Cup in 2018?" }, |
|
{ "role": "assistant", "content": "France won the 2018 FIFA World Cup." }, |
|
{ "role": "user", "content": "Who did they beat in the final?" } |
|
], |
|
"stream": false |
|
}'' | jq -r ''.message.content'' |
|
|
|
Note the response text lives in .message.content for the chat endpoint (versus .response for generate). To continue the conversation, append the assistant''s reply to the messages array and send it again. Let me know if you want a small shell script that keeps the history for you.'), |
|
|
|
(@tid, 'requester', 'Tom Reyes', |
|
'This is great, thanks for all the help! I think I have everything I need for now.'); |
|
|
|
UPDATE support_ticket SET status = 'resolved' WHERE ticket_id = @tid; |
|
|
|
INSERT INTO support_ticket (subject, requester_name, requester_email, status, priority, assignee) |
|
VALUES ('Getting and validating a Claude (Anthropic) API key', 'Maria Chen', 'maria.chen@example.com', 'open', 'normal', 'support_agent'); |
|
|
|
SET @tid = LAST_INSERT_ID(); |
|
|
|
INSERT INTO support_ticket_message (ticket_id, sender_type, sender_name, body) VALUES |
|
(@tid, 'requester', 'Maria Chen', |
|
'Hi, I want to start building with the Claude API. Where do I get an API key, and how do I check that it actually works before I wire it into my app?'), |
|
|
|
(@tid, 'agent', 'support_agent', |
|
'Welcome! Here is how to get a key and validate it. |
|
|
|
1. Create an account |
|
Go to https://console.anthropic.com and sign up (or log in). |
|
|
|
2. Generate an API key |
|
In the Console, open Settings -> API Keys, click "Create Key", give it a name, and copy the value immediately. Anthropic keys look like sk-ant-api03-... and are only shown once, so store it somewhere safe. If you lose it, just create a new one and revoke the old. |
|
|
|
3. Store it as an environment variable |
|
Avoid hardcoding the key in source. On macOS/Linux: |
|
export ANTHROPIC_API_KEY="sk-ant-api03-your-key-here" |
|
Add that line to your ~/.bashrc (or ~/.zshrc) to make it persistent. |
|
|
|
4. Validate it with a quick request |
|
The simplest check is a minimal call to the Messages endpoint: |
|
|
|
curl https://api.anthropic.com/v1/messages \ |
|
-H "x-api-key: $ANTHROPIC_API_KEY" \ |
|
-H "anthropic-version: 2023-06-01" \ |
|
-H "content-type: application/json" \ |
|
-d ''{ |
|
"model": "claude-sonnet-4-6", |
|
"max_tokens": 64, |
|
"messages": [ |
|
{ "role": "user", "content": "Reply with just the word: pong" } |
|
] |
|
}'' |
|
|
|
If the key is valid you get back a JSON object containing a content array with the model''s reply. If the key is bad you will get an HTTP 401 with an authentication_error. |
|
|
|
Note the three required headers: x-api-key (your key), anthropic-version (use 2023-06-01), and content-type. Let me know how it goes!'), |
|
|
|
(@tid, 'requester', 'Maria Chen', |
|
'Got a response back, so the key works. I would rather not parse raw JSON by hand though - is there a cleaner way to just confirm success and see the text?'), |
|
|
|
(@tid, 'agent', 'support_agent', |
|
'Two good options. |
|
|
|
Option A - pipe curl through jq to extract just the text. For the Messages API the reply lives in .content[0].text: |
|
|
|
curl -s https://api.anthropic.com/v1/messages \ |
|
-H "x-api-key: $ANTHROPIC_API_KEY" \ |
|
-H "anthropic-version: 2023-06-01" \ |
|
-H "content-type: application/json" \ |
|
-d ''{ |
|
"model": "claude-sonnet-4-6", |
|
"max_tokens": 64, |
|
"messages": [ { "role": "user", "content": "Reply with just the word: pong" } ] |
|
}'' | jq -r ''.content[0].text'' |
|
|
|
Install jq with: brew install jq (macOS) or sudo apt install jq (Linux). |
|
|
|
Option B - use the official Python SDK, which reads ANTHROPIC_API_KEY automatically: |
|
|
|
pip install anthropic |
|
|
|
#!/usr/bin/env python |
|
import anthropic |
|
|
|
client = anthropic.Anthropic() # picks up ANTHROPIC_API_KEY from the environment |
|
|
|
message = client.messages.create( |
|
model="claude-sonnet-4-6", |
|
max_tokens=64, |
|
messages=[{"role": "user", "content": "Reply with just the word: pong"}], |
|
) |
|
print(message.content[0].text) |
|
|
|
If that prints the reply with no auth error, your key and environment are set up correctly.'), |
|
|
|
(@tid, 'requester', 'Maria Chen', |
|
'The Python version worked perfectly. Last question - if I want to confirm the key is valid without spending tokens on a full generation, is there a lighter-weight way to check?'), |
|
|
|
(@tid, 'agent', 'support_agent', |
|
'Yes - use the token-counting endpoint. It validates your key and request without actually generating a response (and so does not consume output tokens): |
|
|
|
curl -s https://api.anthropic.com/v1/messages/count_tokens \ |
|
-H "x-api-key: $ANTHROPIC_API_KEY" \ |
|
-H "anthropic-version: 2023-06-01" \ |
|
-H "content-type: application/json" \ |
|
-d ''{ |
|
"model": "claude-sonnet-4-6", |
|
"messages": [ { "role": "user", "content": "ping" } ] |
|
}'' |
|
|
|
A 200 response with an input_tokens count means your key authenticates correctly. A 401 means the key is wrong or not set. This is a nice cheap health check to run in CI or at app startup. Happy building!'); |
|
|
|
UPDATE support_ticket SET status = 'resolved' WHERE ticket_id = @tid; |