Analyzes text using Ollama's structured output feature.
Reads text from stdin, sends it to a local Ollama instance with a JSON schema, and outputs the structured JSON result.
-
Install Homebrew (if you don't have it):
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"(See brew.sh for details)
-
Install Go:
brew install go
-
Install & Run Ollama: Follow instructions at ollama.com. Ensure Ollama is running.
-
Pull the Ollama Model: The required model is specified in
config.json. Pull it:# Example using the default model in config.json ollama pull eramax/gemma-3-27b-it-qat:q4_0
Edit config.json:
{
"ollama_url": "http://127.0.0.1:11434/api/chat",
"model_name": "eramax/gemma-3-27b-it-qat:q4_0"
}ollama_url: Your Ollama API endpoint.model_name: The Ollama model to use (must be pulled).
Pipe text via stdin:
cat your_input_file.txt | go run main.goOr:
echo "Your text here" | go run main.goOutputs raw JSON corresponding to the TicketAnalysis struct in main.go.
Example:
{"support_area":"Login Issue","summary":"User cannot log in despite using correct password and password reset email is not arriving.","urgency":"High"}