class
LLM::Ollama
- LLM::Ollama
- Reference
- Object
Overview
Ollama LLM client with context-aware request support
Defined in:
llm/ollama/ollama.crConstant Summary
-
JSON_MODE =
JSON::Any.new("json") -
format: "json"— Ollama's plain JSON mode. -
TEMPERATURE =
0.3 -
Endpoint extraction wants the model to read code, not to write prose about it, so both request paths pin a low temperature.
Constructors
Class Method Summary
-
.format_value(format : String) : JSON::Any
Ollama's
formatfield takes either the literal string "json" or a raw JSON Schema, and uses a schema to constrain decoding.
Instance Method Summary
-
#request(prompt : String, format : String = "json")
Make a simple request without context management
-
#request_with_context(system : String | Nil, user : String, format : String = "json", cache_key : String | Nil = nil)
Make a request with optional context management for improved efficiency
Constructor Detail
Class Method Detail
Ollama's format field takes either the literal string "json" or a
raw JSON Schema, and uses a schema to constrain decoding. The formats
in LLM::* are OpenAI-shaped envelopes
({"type":"json_schema","json_schema":{"schema":{...}}}); handing
that envelope straight to Ollama constrained generation to the
envelope rather than to the endpoint object we asked for, so the
response never matched what the analyzer parses — every endpoint in
the request was lost. Unwrap to the inner schema, and fall back to
plain JSON mode for anything we don't recognise.
Instance Method Detail
Make a simple request without context management