๐Ÿ”ฃ
Symbols
Stage 5 โ€” The Reality ยท Core source code and implementation reference
Stage 5 PrismJS Code Reference ๐Ÿ“ Readme
๐Ÿ”Œ
Ollama API Examples
Core implementation patterns

๐Ÿ’ฌ Chat Completions

# Streaming chat with llama3.2
curl http://localhost:11434/api/chat \
  -d '{
    "model": "llama3.2",
    "messages": [
      {"role": "user", "content": "Why is the sky blue?"}
    ]
  }'

๐Ÿ“„ Text Generation

# Generate with a prompt
curl http://localhost:11434/api/generate \
  -d '{
    "model": "llama3.2",
    "prompt": "Write a haiku about local AI",
    "stream": false
  }'

๐Ÿง  Embeddings for Qdrant

import ollama
import qdrant_client
from qdrant_client.models import PointStruct, VectorParams, Distance

# Connect to Qdrant
client = qdrant_client.QdrantClient("http://localhost:6333")

# Create collection (4096 dims for nomic-embed-text)
client.create_collection(
    collection_name="ollama_notes",
    vectors_config=VectorParams(size=4096, distance=Distance.COSINE),
)

# Generate embedding with Ollama
response = ollama.embeddings(
    model="nomic-embed-text",
    prompt="Ollama makes local LLM deployment easy"
)

# Store in Qdrant
client.upsert(
    collection_name="ollama_notes",
    points=[
        PointStruct(
            id=1,
            vector=response["embedding"],
            payload={"text": "Ollama makes local LLM deployment easy"}
        )
    ]
)

๐Ÿ” Semantic Search

import ollama
import qdrant_client

client = qdrant_client.QdrantClient("http://localhost:6333")

query = "How to deploy local LLMs?"
embedding = ollama.embeddings(model="nomic-embed-text", prompt=query)

results = client.search(
    collection_name="ollama_notes",
    query_vector=embedding["embedding"],
    limit=5
)

for r in results:
    print(f"Score: {r.score:.3f} | {r.payload['text']}")
๐Ÿ“–
Symbol Reference
Key symbols used throughout the codebase

๐Ÿ–ฅ๏ธ CLI Symbols

SymbolMeaningExample
$Command prompt$ ollama serve
|Pipe operatorcurl ... | sh
-dData flag (curl)curl -d '{"model":"..."}'
--Long-form optionollama --version

๐ŸŒ API Symbols

MethodEndpointUse
POST/api/generateText generation
POST/api/chatChat completions
POST/api/embeddingsVector embeddings
GET/api/tagsList local models
DELETE/api/deleteRemove a model
๐Ÿงช
Testing Checklist
Verify code examples run correctly.
View โ†’