> ## Documentation Index
> Fetch the complete documentation index at: https://dspy-rb.ralak.co/llms.txt
> Use this file to discover all available pages before exploring further.

# An agent suggests a reply

> Let DSPy's ReAct agent search the help center and suggest a reply when a support agent asks

After reading this guide, you will know:

* why one predictor can't answer from the help center;
* what DSPy's ReAct agent is, and how to give it a `DSPyRb::Tool`;
* how to read what an agent did, in its history;
* how to test an agent on scripted turns.

A support agent answers most tickets from the same few help center articles. In this chapter, the model drafts that answer when a support agent asks, for them to check and send.

## 1. A reply from the ticket alone

Start [simple](https://github.com/stanfordnlp/dspy/blob/3.5.0/docs/docs/learn/programming/overview.md): one predictor, with a string signature like chapter 1's.

```irb theme={"theme":"one-dark-pro"}
$ bin/rails console
helpdesk(dev)> subject = "Charged twice"
=> "Charged twice"
helpdesk(dev)> body = "I was charged twice for order 4417."
=> "I was charged twice for order 4417."
helpdesk(dev)> DSPyRb::Predict["subject, body -> reply"].call(subject:, body:).reply
=> "Dear Customer,\n\nThank you for reaching out. I’m sorry to hear you were charged twice for order 4417. We will investigate this issue promptly and ensure any duplicate charges are refunded.\n\nPlease allow us 1-2 business days to review your account and resolve the matter. We will update you as soon as possible.\n\nIf you have any further questions or details to provide, feel free to reply to this message.\n\nBest regards,  \nCustomer Support Team"
```

The model doesn't know the shop's policies, so it guesses: "1-2 business days to review", where the help center says 5 business days. The reply needs the help center's articles.

## 2. Articles for the help center

Generate a model for the articles:

```bash theme={"theme":"one-dark-pro"}
bin/rails generate model Article title:string body:text
bin/rails db:migrate
```

Add a few articles to the end of `db/seeds.rb`, so the file reads:

```ruby db/seeds.rb theme={"theme":"one-dark-pro"}
# This file should ensure the existence of records required to run the application in every environment (production,
# development, test). The code here should be idempotent so that it can be executed at any point in every environment.
# The data can then be loaded with the bin/rails db:seed command (or created alongside the database with db:setup).
#
# Example:
#
#   ["Action", "Comedy", "Drama", "Horror"].each do |genre_name|
#     MovieGenre.find_or_create_by!(name: genre_name)
#   end

articles = {
  "Refunds for double charges" =>
    "If you were charged twice for one order, we refund the extra charge to your card within 5 business days.",
  "How long refunds take" =>
    "Once we approve a refund, your bank shows it within 5 to 10 business days.",
  "Delivery times" =>
    "Orders arrive in 3 to 5 business days. Track your parcel from the link in your shipping email.",
  "Returns and exchanges" =>
    "You can return or exchange an item within 30 days of delivery. Start a return from your order page.",
  "Wrong or damaged items" =>
    "If an item arrives damaged, or isn't what you ordered, send us a photo and we send a replacement.",
  "Missing items" =>
    "If something is missing from your order, tell us which item and we send it within 2 business days.",
  "Resetting your password" =>
    "Use the Forgot password link on the sign-in page. The reset email arrives within a few minutes."
}

articles.each do |title, body|
  Article.find_or_create_by!(title:) do |article|
    article.body = body
  end
end
```

Then load them:

```bash theme={"theme":"one-dark-pro"}
bin/rails db:seed
```

The app could search first and hand the model what it finds. Replace `app/models/article.rb` with:

```ruby app/models/article.rb theme={"theme":"one-dark-pro"}
class Article < ApplicationRecord
  def self.mentioning(word)
    pattern = "%#{sanitize_sql_like(word)}%"

    where("title LIKE :pattern OR body LIKE :pattern", pattern:)
  end
end
```

A `LIKE` is enough for a few articles. A large help center needs full-text search.

Try it with two words:

```irb theme={"theme":"one-dark-pro"}
$ bin/rails console
helpdesk(dev)> Article.mentioning("order").pluck(:title)
=> ["Refunds for double charges", "Delivery times", "Returns and exchanges", "Wrong or damaged items", "Missing items"]
helpdesk(dev)> Article.mentioning("charged").pluck(:title)
=> ["Refunds for double charges"]
```

"order" finds most of the help center, and "charged" finds the one article that answers. The right word depends on the ticket, and a search that finds nothing needs another try.

Sending every article instead pays for all of them on every suggestion. So let the model choose what to search.

## 3. A tool for the search

A [tool](https://github.com/stanfordnlp/dspy/blob/3.5.0/docs/docs/getting-started/react-and-tools.md) is a function the model can ask DSPy to run. In dspy-rb, it's a `DSPyRb::Tool` subclass: `desc` tells the model what it does, each `arg` declares a typed argument, and `call` does the work.

Create `app/tools/search_articles.rb`:

```ruby app/tools/search_articles.rb theme={"theme":"one-dark-pro"}
class SearchArticles < DSPyRb::Tool
  desc "Search the help center for articles that mention a word. Gives each one's id, title and body."
  arg :word, String, desc: "One word the customer's question is about, such as refund"

  def call(word:)
    Article.mentioning(word).limit(3).as_json(only: %i[ id title body ])
  end
end
```

The model knows it as `search_articles`, from the class's name. Each article comes back with its id, so the model can cite it.

`app/tools` is a new folder, so restart any running server or console. Then try the tool:

```irb theme={"theme":"one-dark-pro"}
$ bin/rails console
helpdesk(dev)> SearchArticles.new.call(word: "charged")
=> [{"id" => 1, "title" => "Refunds for double charges", "body" => "If you were charged twice for one order, we refund the extra charge to your card within 5 business days."}]
```

A predictor makes one call. It can't search, read the results, then answer.

## 4. DSPy's ReAct agent

Deciding what to search, searching again, and knowing when to answer is the open-ended tool use DSPy gives to an [agent](https://github.com/stanfordnlp/dspy/blob/3.5.0/docs/docs/learn/programming/overview.md): a module in which the model asks for tools, turn by turn, until it can answer.

"Agent" means DSPy's agent; "support agent" means the person.

DSPy's [ReAct](https://github.com/stanfordnlp/dspy/blob/3.5.0/docs/docs/getting-started/react-and-tools.md) is an agent, and one of DSPy's built-in modules, like `Predict` and `ChainOfThought`. It works in turns:

* Each turn, the model asks for tool calls, and DSPy runs them.
* DSPy adds a `submit` tool, which the model calls with the signature's outputs when it's done.
* `max_iters` caps the turns, not the tool calls. If the turns run out, or the model stops calling tools, DSPy asks for `submit` once more.

`DSPyRb::ReAct[signature, tools: [...], max_iters: ...]` makes one in Ruby.

The agent's outputs are the reply and the articles it rests on. Create `app/signatures/suggest_reply.rb`:

```ruby app/signatures/suggest_reply.rb theme={"theme":"one-dark-pro"}
class SuggestReply < DSPyRb::Signature
  instructions "Write a reply to a customer's support ticket, for a support agent to check and send. " \
               "Use only what the help center's articles say."

  input :subject, String
  input :body, String

  output :reply, String
  output :article_ids, DSPyRb::Types::List[Integer], desc: "The ids of the articles the reply is based on"
end
```

`article_ids` keeps the articles apart from the text the customer reads, so the app can show them.

## 5. Try the agent in the console

Ask the agent about step 1's ticket, with five turns at most: room for a few searches and a reply, and a cap on what one suggestion can cost.

```irb theme={"theme":"one-dark-pro"}
$ bin/rails console
helpdesk(dev)> subject = "Charged twice"
=> "Charged twice"
helpdesk(dev)> body = "I was charged twice for order 4417."
=> "I was charged twice for order 4417."
helpdesk(dev)> agent = DSPyRb::ReAct[SuggestReply, tools: [ SearchArticles.new ], max_iters: 5];
helpdesk(dev)> result = agent.call(subject:, body:);
helpdesk(dev)> result.reply
=> "We have identified that you were charged twice for your order #4417. According to our refund policy, we will refund the extra charge to your card within 5 business days. If you do not see the refund after this period, please contact us again for further assistance."
helpdesk(dev)> result.article_ids
=> [1]
helpdesk(dev)> result.termination_reason
=> "submit"
helpdesk(dev)> result.history["messages"].size
=> 2
helpdesk(dev)> result.history["messages"].first.dig("tool_calls", "tool_calls")
=> [{"id" => "call_gBOrsabs5VWfKJ1LoK2Oup08", "name" => "search_articles", "args" => {"word" => "charged"}}]
```

Unlike step 1's, this reply says what the refunds article says, and cites it. The model chose "charged" itself, the word step 2 showed matters.

* `termination_reason` is `"submit"` when the model submitted, and `"forced_submit"` when DSPy had to ask for it.
* `history["messages"]` holds a message for each turn: the model's thought, the tool calls it asked for, and their results.

A turn's `"tool_calls"` is DSPy's `ToolCalls`, which keeps its list under `"tool_calls"` too, so the key appears twice.

The app never reads the [history](https://github.com/stanfordnlp/dspy/blob/3.5.0/docs/docs/diving-deeper/react.md); it's for you, when a reply looks wrong.

## 6. A program that holds the agent

The app and its tests need the same agent, so its signature, tool and turn cap live in one place: a program, like chapter 5's desk. Create `app/programs/reply_writer.rb`:

```ruby app/programs/reply_writer.rb theme={"theme":"one-dark-pro"}
class ReplyWriter < DSPyRb::Module
  def initialize
    super

    @agent = DSPyRb::ReAct[SuggestReply, tools: [ SearchArticles.new ], max_iters: 5]
  end

  def forward(subject:, body:)
    @agent.call(subject:, body:)
  end
end
```

Run it on the same ticket:

```irb theme={"theme":"one-dark-pro"}
$ bin/rails console
helpdesk(dev)> subject = "Charged twice"
=> "Charged twice"
helpdesk(dev)> body = "I was charged twice for order 4417."
=> "I was charged twice for order 4417."
helpdesk(dev)> result = ReplyWriter.new.call(subject:, body:);
helpdesk(dev)> result.reply
=> "We have identified that you were charged twice for your order #4417. According to our refund policy, we will refund the extra charge to your card within 5 business days. If you do not see the refund after this period, please contact us again for further assistance."
helpdesk(dev)> result.spend.calls.map(&:cache_hit)
=> [true, true]
```

DSPy's cache answered both calls, as in chapter 6, so the program gave step 5's reply at once, for nothing.

## 7. Keep each suggestion with its ticket

A suggestion belongs to a ticket, with the articles it cites. Generate a model for them:

```bash theme={"theme":"one-dark-pro"}
bin/rails generate model SuggestedReply ticket:references reply:text article_ids:json
bin/rails db:migrate
```

Replace `app/models/suggested_reply.rb` with:

```ruby app/models/suggested_reply.rb theme={"theme":"one-dark-pro"}
class SuggestedReply < ApplicationRecord
  belongs_to :ticket

  def articles
    Article.where(id: article_ids)
  end
end
```

Replace `app/models/ticket.rb` with:

```ruby app/models/ticket.rb theme={"theme":"one-dark-pro"}
class Ticket < ApplicationRecord
  has_many :suggested_replies, dependent: :destroy

  # After the commit, so slow model calls never hold a database transaction open.
  after_create_commit :process

  def suggest_reply
    result = ReplyWriter.new.call(subject:, body:)

    suggested_replies.create!(reply: result.reply, article_ids: result.article_ids)
  end

  private
    def process
      result = TicketDesk.new.call(subject:, body:)
      billed = result.spend.calls.reject(&:cache_hit)

      update!(
        reasoning: result.reasoning,
        category: result.category,
        urgent: result.urgent,
        order_numbers: result.order_numbers,
        products: result.products,
        model_calls: billed.size,
        tokens: total_tokens(billed),
        cost: total_cost(billed)
      )
    end

    def total_tokens(calls)
      calls.sum do |call|
        call.usage.prompt_tokens + call.usage.completion_tokens
      end
    end

    def total_cost(calls)
      calls.sum(&:cost) if calls.all?(&:cost)
    end
end
```

A ticket's model calls, tokens and cost still cover only its triage and details.

## 8. The button

A support agent asks for a suggestion from the ticket's page. Nest a route for it in the tickets' resources, so `config/routes.rb` reads:

```ruby config/routes.rb theme={"theme":"one-dark-pro"}
Rails.application.routes.draw do
  resources :tickets do
    resources :suggested_replies, only: :create
  end
  # Define your application routes per the DSL in https://guides.rubyonrails.org/routing.html

  # Reveal health status on /up that returns 200 if the app boots with no exceptions, otherwise 500.
  # Can be used by load balancers and uptime monitors to verify that the app is live.
  get "up" => "rails/health#show", as: :rails_health_check

  # Render dynamic PWA files from app/views/pwa/* (remember to link manifest in application.html.erb)
  # get "manifest" => "rails/pwa#manifest", as: :pwa_manifest
  # get "service-worker" => "rails/pwa#service_worker", as: :pwa_service_worker

  # Defines the root path route ("/")
  # root "posts#index"
end
```

Create `app/controllers/suggested_replies_controller.rb`:

```ruby app/controllers/suggested_replies_controller.rb theme={"theme":"one-dark-pro"}
class SuggestedRepliesController < ApplicationController
  def create
    ticket = Ticket.find(params.expect(:ticket_id))
    ticket.suggest_reply

    redirect_to ticket, notice: "Reply suggested."
  end
end
```

The button and the suggestions go on the ticket's page, not in `_ticket`, which the list of tickets shows too. Replace `app/views/tickets/show.html.erb` with:

```erb app/views/tickets/show.html.erb theme={"theme":"one-dark-pro"}
<p style="color: green"><%= notice %></p>

<%= render @ticket %>

<%= button_to "Suggest a reply", ticket_suggested_replies_path(@ticket) %>

<%= render @ticket.suggested_replies.order(created_at: :desc) %>

<div>
  <%= link_to "Edit this ticket", edit_ticket_path(@ticket) %> |
  <%= link_to "Back to tickets", tickets_path %>

  <%= button_to "Destroy this ticket", @ticket, method: :delete %>
</div>
```

Create `app/views/suggested_replies/_suggested_reply.html.erb`:

```erb app/views/suggested_replies/_suggested_reply.html.erb theme={"theme":"one-dark-pro"}
<div id="<%= dom_id suggested_reply %>">
  <h2>Suggested reply, <%= l suggested_reply.created_at, format: :short %></h2>

  <%= simple_format suggested_reply.reply %>

  <% if suggested_reply.articles.any? %>
    <p>
      <strong>Based on:</strong>
      <%= suggested_reply.articles.pluck(:title).to_sentence %>
    </p>
  <% end %>
</div>
```

## 9. See it in the browser

Start the server, open one of chapter 6's "Missing item" tickets, and click "Suggest a reply". The page shows a suggestion such as:

> We are sorry to hear that your order 6012 arrived without the charging cable. Please let us know the missing item (in this case, the charging cable), and we will send it to you within 2 business days.
>
> **Based on:** Missing items

Click "Suggest a reply" again, and the same reply appears a second time, at once: DSPy answered it from its cache. A support agent who wanted a different suggestion gets the first one again.

## 10. Scripted turns for the tests

In the tests, the agent runs on `DummyLM`, which takes one scripted answer for each turn: the model's `next_thought`, and the `tool_calls` it asks for, with the doubled key from step 5. Create `test/fixtures/files/reply_answers.yml`:

```yaml test/fixtures/files/reply_answers.yml theme={"theme":"one-dark-pro"}
# The model's scripted turns for a suggested reply: a search, then the reply.
- next_thought: Search for the word that matters.
  tool_calls:
    tool_calls:
      - name: search_articles
        args:
          word: refund
- next_thought: The refunds article answers the ticket.
  tool_calls:
    tool_calls:
      - name: submit
        args:
          reply: Sorry about the double charge. We refund the extra charge within 5 business days.
          article_ids: [ 1 ]
```

The tests also need articles, tickets and a suggestion to start from. Replace the generated `test/fixtures/articles.yml` with:

```yaml test/fixtures/articles.yml theme={"theme":"one-dark-pro"}
double_charge:
  id: 1
  title: Refunds for double charges
  body: If you were charged twice for one order, we refund the extra charge within 5 business days.

delivery:
  id: 2
  title: Delivery times
  body: Orders arrive in 3 to 5 business days. Track your parcel from the link in your shipping email.

password:
  id: 3
  title: Resetting your password
  body: Use the Forgot password link on the sign-in page. The reset email arrives within a few minutes.
```

Each article has a fixed id, so the scripted answers can cite it. Replace `test/fixtures/tickets.yml` with:

```yaml test/fixtures/tickets.yml theme={"theme":"one-dark-pro"}
double_charge:
  subject: "Refund for order #1234"
  body: I was charged twice for my coffee grinder.

late_parcel:
  subject: Where is my parcel?
  body: My order 3310 was due on Monday and has not arrived.
```

Replace the generated `test/fixtures/suggested_replies.yml` with:

```yaml test/fixtures/suggested_replies.yml theme={"theme":"one-dark-pro"}
late_parcel:
  ticket: late_parcel
  reply: Your parcel should arrive within 5 business days. The tracking link is in your shipping email.
  article_ids: [ 2 ]
```

The tests now use two answer files, so `scripted_model` takes the file's name. In `test/test_helper.rb`, change it so the file reads:

```ruby test/test_helper.rb theme={"theme":"one-dark-pro"}
ENV["RAILS_ENV"] ||= "test"
require_relative "../config/environment"
require "rails/test_help"

# No real model in tests: each model call runs on a DSPyRb::DummyLM given by DSPyRb.context.
DSPyRb.configure do |config|
  config.lm = nil
end

module ActiveSupport
  class TestCase
    # Run tests in parallel with specified workers
    parallelize(workers: :number_of_processors)

    # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
    fixtures :all

    # Add more helper methods to be used by all tests here...
    def scripted_model(answers = "ticket_answers.yml")
      DSPyRb::DummyLM[YAML.load_file(file_fixture(answers))]
    end
  end
end
```

## 11. Test the new pieces

Test the search, the tool and the program each on its own, so a failing test points at the piece that broke. Replace the generated `test/models/article_test.rb` with:

```ruby test/models/article_test.rb theme={"theme":"one-dark-pro"}
require "test_helper"

class ArticleTest < ActiveSupport::TestCase
  test "a help center search finds a word in an article's title or body" do
    assert_equal [ articles(:delivery) ], Article.mentioning("Delivery")
    assert_equal [ articles(:delivery) ], Article.mentioning("parcel")
  end

  test "a help center search ignores case" do
    assert_equal [ articles(:double_charge) ], Article.mentioning("REFUND")
  end

  test "a help center search finds nothing when no article mentions the word" do
    assert_empty Article.mentioning("invoice")
  end
end
```

Create `test/tools/search_articles_test.rb`:

```ruby test/tools/search_articles_test.rb theme={"theme":"one-dark-pro"}
require "test_helper"

class SearchArticlesTest < ActiveSupport::TestCase
  test "the search tool gives each matching article's id, title and body" do
    article = articles(:delivery)

    assert_equal [ { "id" => article.id, "title" => article.title, "body" => article.body } ],
                 SearchArticles.new.call(word: "parcel")
  end
end
```

Create `test/programs/reply_writer_test.rb`:

```ruby test/programs/reply_writer_test.rb theme={"theme":"one-dark-pro"}
require "test_helper"

class ReplyWriterTest < ActiveSupport::TestCase
  test "the reply writer suggests a reply with the articles it cites" do
    result = DSPyRb.context(lm: scripted_model("reply_answers.yml")) do
      ReplyWriter.new.call(
        subject: "Refund for order #1234",
        body: "I was charged twice for my coffee grinder."
      )
    end

    assert_match "refund the extra charge", result.reply
    assert_equal [ articles(:double_charge).id ], result.article_ids
  end
end
```

Replace the generated `test/models/suggested_reply_test.rb` with:

```ruby test/models/suggested_reply_test.rb theme={"theme":"one-dark-pro"}
require "test_helper"

class SuggestedReplyTest < ActiveSupport::TestCase
  test "a suggested reply lists the articles it is based on" do
    assert_equal [ articles(:delivery) ], suggested_replies(:late_parcel).articles
  end
end
```

Replace `test/models/ticket_test.rb` with:

```ruby test/models/ticket_test.rb theme={"theme":"one-dark-pro"}
require "test_helper"

class TicketTest < ActiveSupport::TestCase
  test "a new ticket arrives with a category and an urgent flag" do
    ticket = create_ticket

    assert_equal "billing", ticket.category
    assert ticket.urgent?
  end

  test "a new ticket arrives with the order numbers and products it mentions" do
    ticket = create_ticket

    assert_equal [ "1234" ], ticket.order_numbers
    assert_equal [ "coffee grinder" ], ticket.products
  end

  test "a new ticket arrives with the reasoning behind its urgency" do
    ticket = create_ticket

    assert_match "needs a reply today", ticket.reasoning
  end

  test "a new ticket records how many model calls it took" do
    ticket = create_ticket

    assert_equal 2, ticket.model_calls
  end

  test "asking for a reply saves the suggestion with its articles" do
    suggested_reply = DSPyRb.context(lm: scripted_model("reply_answers.yml")) do
      tickets(:double_charge).suggest_reply
    end

    assert_equal [ articles(:double_charge).id ], suggested_reply.reload.article_ids
  end

  private
    def create_ticket
      ticket = DSPyRb.context(lm: scripted_model) do
        Ticket.create!(
          subject: "Refund for order #1234",
          body: "I was charged twice for my coffee grinder."
        )
      end

      ticket.reload
    end
end
```

Then test the button as a support agent uses it. Replace `test/integration/ticket_submission_test.rb` with:

```ruby test/integration/ticket_submission_test.rb theme={"theme":"one-dark-pro"}
require "test_helper"

class TicketSubmissionTest < ActionDispatch::IntegrationTest
  test "a support agent logs a ticket and sees its category and urgency" do
    log_ticket

    assert_select "div", /Category:\s+billing/
    assert_select "mark", "Urgent"
  end

  test "a support agent sees the order numbers and products a ticket mentions" do
    log_ticket

    assert_select "div", /Order numbers:\s+1234/
    assert_select "div", /Products:\s+coffee grinder/
  end

  test "a support agent sees why a ticket was marked urgent" do
    log_ticket

    assert_select "div", /Why:\s+A double charge takes the customer's money/
  end

  test "a support agent sees a ticket's model calls, tokens and cost" do
    log_ticket

    assert_select "div", /Model calls:\s+2/
    assert_select "div", /Tokens:\s+0/
    assert_select "div", /Cost:\s+unknown/
  end

  test "a support agent asks for a suggested reply and sees it with its articles" do
    ticket = tickets(:double_charge)

    get ticket_path(ticket)
    assert_select "form[action=?] button", ticket_suggested_replies_path(ticket), text: "Suggest a reply"

    DSPyRb.context(lm: scripted_model("reply_answers.yml")) do
      post ticket_suggested_replies_path(ticket)
    end

    follow_redirect!

    assert_select "p", /refund the extra charge within 5 business days/
    assert_select "p", /Based on:\s+Refunds for double charges/
  end

  test "a support agent deletes a ticket with its suggested replies" do
    assert_difference("SuggestedReply.count", -1) do
      delete ticket_path(tickets(:late_parcel))
    end

    follow_redirect!

    assert_select "p", "Ticket was successfully destroyed."
  end

  private
    def log_ticket
      form = { subject: "Refund for order #1234", body: "I was charged twice for my coffee grinder." }

      DSPyRb.context(lm: scripted_model) do
        post tickets_path, params: { ticket: form }
      end

      follow_redirect!
    end
end
```

## 12. Check your work

```bash theme={"theme":"one-dark-pro"}
bin/rubocop
bin/rails test
```

Both should pass, with no offenses and 18 tests.

## If something goes wrong

> [!WARNING]
>
> If you see a `NameError` naming `SearchArticles`, the server or console started before `app/tools` existed. Restart it.
>
> If no suggestion ever has a "Based on:" line, check that `bin/rails db:seed` ran.
>
> If a suggestion fails, Rails shows its error page and saves no suggestion. The page names the error: `DSPyRb::LMNotConfiguredError` means no key reached DSPy, as in [chapter 1, step 4](https://dspy-rb.ralak.co/helpdesk/new-rails-app.md#4-the-model-and-your-key).

## Comparing with the tag

The [`chapter-7` tag](https://github.com/samuelralak/dspy-tutorial/tree/chapter-7) holds the app at the end of this chapter. To compare yours with it:

```bash theme={"theme":"one-dark-pro"}
git fetch tutorial --tags --force
git add --all
git diff --cached chapter-7 --stat
```

Expect the same files to differ as in chapter 1.

## Next

> [card] [Another reply](https://dspy-rb.ralak.co/helpdesk/another-reply.md)
>
> Get a fresh suggestion past DSPy's cache, with a rollout ID on a copy of the model.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.