Skip to content

Move to RubyLLM 2.1 and GPT-6 Luna, with cost on every call - #188

Merged
misabegovic merged 2 commits into
mainfrom
feat/rubyllm-2-and-gpt-6-luna
Oct 14, 2026
Merged

misabegovic merged 2 commits into
mainfrom
feat/rubyllm-2-and-gpt-6-luna

Conversation

@misabegovic

Copy link
Copy Markdown
Owner

Summary

  • RubyLLM 1.9.1 to 2.1.1, pinned ~> 2.1. The acts_as deprecation warning on every boot is gone.
  • The default model is gpt-6-luna, OpenAI's low-cost tier: $0.10 input, $0.01 cached and $0.50 output per million tokens, against gpt-4o-mini's $0.15 and $0.60 (OpenAI pricing, read 2026-10-14). Batch and Flex halve it. Above 272K input tokens the long-context price applies.
  • Structured output is read through 2.x's parsed; the regex extraction stays only as a fallback. The curly-quote repair now works; its character classes held plain ASCII quotes, so it never repaired anything.
  • Cost on every call: one log line per reply with model, tokens and dollars, priced by RubyLLM's model registry. Langfuse (next PR) will carry the same in traces.
  • The brain: build notes and the model decision on wiki/initiatives/rubyllm-2-upgrade.md; the AI pipeline, overview and state pages updated.

Note for review

LLM_DEFAULT_MODEL still wins over the new default. The local .env sets it to claude-opus-4-6, so development keeps generating with Claude Opus until that line is changed or removed. Whatever production sets will likewise stay in force. To run on Luna, remove the variable or set it to gpt-6-luna.

Test plan

  • test/services/ai/openai_queue_test.rb: 28 runs. Replies are real RubyLLM::Message objects, errors use the 2.x response: keyword, Luna's registry price is checked (100k in and out = $0.06), and the usage line is asserted.
  • bin/rails test: 2462 runs, 5885 assertions, 0 failures, 0 errors; no deprecation warning.
  • bin/rails test:system: 69 runs, 0 failures.
  • RuboCop clean; tabula validate 52 pages valid.
  • One real call against OpenAI with a key, once merged.

🤖 Generated with Claude Code

https://claude.ai/code/session_01JEmikXtNoH7wAg6veTjbyT

misabegovic and others added 2 commits October 14, 2026 11:12
- ruby_llm 1.9.1 to 2.1.1, pinned ~> 2.1. The legacy acts_as deprecation
  warning is gone with the API it warned about.
- The default model is gpt-6-luna: $0.10 input and $0.50 output per million
  tokens against gpt-4o-mini's $0.15 and $0.60 (OpenAI, 2026-10-14).
  LLM_DEFAULT_MODEL still overrides it.
- Structured output is read through RubyLLM 2's `parsed`; the regex
  extraction stays as a fallback for JSON wrapped in prose. The curly-quote
  repair now matches real curly quotes (it held ASCII quotes and repaired
  nothing).
- Each call logs its model, tokens and dollar cost, priced by RubyLLM's model
  registry, until Langfuse traces carry them.
- Tests use real RubyLLM::Message replies and 2.x error constructors, and
  cover Luna's registry price and the usage line.
- The brain: build notes on the RubyLLM 2 initiative, the model decision
  recorded there, and the pipeline, overview and state pages updated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JEmikXtNoH7wAg6veTjbyT
@misabegovic
misabegovic merged commit cd8efff into main Oct 14, 2026
@misabegovic
misabegovic deleted the feat/rubyllm-2-and-gpt-6-luna branch October 14, 2026 10:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant