From 611de4f43af54a2380569eaec9fdb42045a08029 Mon Sep 17 00:00:00 2001 From: Todd Kummer Date: Thu, 23 Apr 2026 10:59:10 -0700 Subject: [PATCH] Add code example to top of README --- README.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/README.md b/README.md index a86eb3c..2cfbecc 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,15 @@ This gem provides testing utilities for RubyLLM, a Ruby library for working with large language models (LLMs). It enables calls to LLM's to be stubbed so that the surrounding application logic can be tested without making actual calls to the LLM. This is particularly useful for testing code that interacts with LLMs, as it allows developers to simulate responses from the LLM without incurring the cost, latency, or randomness of real API calls. +```ruby +RubyLLM::Test.stub_response("Outlook good") + +chat = RubyLLM.chat +response = chat.ask "What are the odds this works?" + +assert_equal "Outlook good", response.content +``` + ## Installation Add this line to your application's Gemfile: