<turbo-stream action="append" target="posts_list"><template>    <div class="postbit" id="395132" data-post-id="395132">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="plcholder" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/plcholder/120/41212_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  plcholder
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Thanks for the insight, I can imagine how huge healthcare is, not sure how one would navigate around the hipaa land mines. Insurance feels elusive to me so I will need to do more research on that.</p>
<p>Tech support sounds like a solved avenue. but anyway you got me interested to look into RAGs again &amp; your project</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="395132" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/agent-contract-for-my-rag-project/76939/12">Post #11</a>
	                </div>
	            </div>
              <div id="likers-container-395132" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="395132"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #11"></div>
  </section>
</div>
    <div class="postbit" id="395134" data-post-id="395134">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="caleb-bb" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/caleb-bb/120/26803_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  caleb-bb
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="plcholder" data-post="12" data-topic="76939">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/plcholder/48/41212_2.png" class="avatar"> plcholder:</div>
<blockquote>
<p>Tech support sounds like a solved avenue.</p>
</blockquote>
</aside>
<p>Don’t overestimate how much has been solved.</p>
<p>If you think tech support is anything like a solved avenue, you’re welcome to call your ISP to troubleshoot your modem. If it were solved, I don’t think it would be that much of a headache! <img src="https://forum.elixirforum.com/images/emoji/apple/joy_cat.png?v=15" title=":joy_cat:" class="emoji" alt=":joy_cat:" loading="lazy" width="20" height="20"></p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="395134" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/agent-contract-for-my-rag-project/76939/13">Post #12</a>
	                </div>
	            </div>
              <div id="likers-container-395134" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="395134"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #12"></div>
  </section>
</div>
    <div class="postbit" id="395135" data-post-id="395135">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="plcholder" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/plcholder/120/41212_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  plcholder
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p><img src="https://forum.elixirforum.com/images/emoji/apple/rofl.png?v=15" title=":rofl:" class="emoji" alt=":rofl:" loading="lazy" width="20" height="20">I did have a recent calling with my bank and it was a headache, I just meant its probably harder for a startup to disrupt that space and sell a package, since theyve been trying to automate stuff before llms were a thing vs like a eye doctor or something</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="395135" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/agent-contract-for-my-rag-project/76939/14">Post #13</a>
	                </div>
	            </div>
              <div id="likers-container-395135" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="395135"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #13"></div>
  </section>
</div>
    <div class="postbit" id="395256" data-post-id="395256">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="caleb-bb" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/caleb-bb/120/26803_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  caleb-bb
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Continuing!</p>
<h1><a name="p-395256-ai-disclosure-1" class="anchor" href="#p-395256-ai-disclosure-1" aria-label="Heading link" rel="nofollow"></a>AI Disclosure</h1>
<p>First: I want to be forthcoming about my use of AI. <strong>I wrote the prose in this post by hand</strong>. However, I did use AI to find the code snippets and property tests for citation provenance in this code base. I used prompts like</p>
<blockquote>
<p>Find the property tests in this project relating to citation provenance and explain them with code snippets drawn from the actual files. I want filenames and line numbers both for the relevant tests and the code under test.</p>
</blockquote>
<p>and</p>
<blockquote>
<p>…please show where [TDD commit discipline is] stipulated in the agent contract and some examples in the commit history with code snippets and commit hashes. Put it in markdown format, please.</p>
</blockquote>
<p>The code snippets below were copied and pasted from Claude Code’s output. So was the snippet from the agent contract, which, itself, is AI-authored.</p>
<p>Now for the fun part!</p>
<p>I want to talk about <strong>testing</strong>. This is a good opportunity to examine the impact of agentic coding on multiple levels. In particular: agent contract, testing philosophy, and the intersection of those two in the development workflow.</p>
<h2><a name="p-395256-agent-contract-2" class="anchor" href="#p-395256-agent-contract-2" aria-label="Heading link" rel="nofollow"></a>Agent Contract</h2>
<p>In the agent contract, I enforce TDD discipline. That means my commits, where possible, come in pairs. The first commit is generally a <strong>red test commit</strong>. I require the agent to write a failing test and commit that before writing any app code. This stone kills several birds. First, it circumvents the tendency of agents to write slop and then write tests that the slop passes, because you’re enforcing TDD. The tests <em>must</em> fail first, and this increases the probability that they’ll be nontrivial. Incidentally, on of the Credo checks I stole from Mike Zornek checks for weak tests, and it has already caught a few of those at the red commit stage.</p>
<pre data-code-wrap="markdown"><code class="lang-markdown">## Testing: Ordering and Failure Handling

**Ordering — for any behavior change:**
1. **Spec.** User describes the change.
2. **Tests first.** Encode the new contract in tests before touching implementation. If the change is non-trivial, push the test diff for review and STOP for approval.
3. **Human reviews tests** — the tests are the spec.
4. **Implement** against the reviewed tests.
5. **Run gates** (Quality Gates above). Iterate on the *implementation*, not the tests, until green.
6. **Stop and ask** if step 5 keeps failing in ways that suggest the test itself is wrong.`

Tests written after implementation encode what the code did, not what it should do. Write them first.
</code></pre>
<p>You’ll notice that this agent contract does not, specifically, stipulate red commits. It does, however, require the agent to “push the test diff”, which, in practice, requires a commit. So the red commits are, strictly speaking, an implementation of the agent contract.</p>
<h2><a name="p-395256-going-deep-property-testing-philosophy-3" class="anchor" href="#p-395256-going-deep-property-testing-philosophy-3" aria-label="Heading link" rel="nofollow"></a>Going Deep: Property Testing Philosophy</h2>
<p>In terms of testing philosophy, I lean heavily on property-based tests. If you’re not familiar with property testing, I’ll give you a quick refresher: a property-based test is a test that enforces an invariant. It does this by generating  hundreds of randomized inputs, and then checking that the outputs always follow a defined rule. For any logic with a nontrivial range of possible inputs – defining “nontrivial” here as <em>inputs that could surprise you</em> – property tests are plausibly better at finding corner cases than ordinary test cases.</p>
<p>For example, in my RAG project…</p>
<h4><a name="p-395256-quick-rag-refresher-4" class="anchor" href="#p-395256-quick-rag-refresher-4" aria-label="Heading link" rel="nofollow"></a>Quick RAG Refresher</h4>
<p>RAG works by looking for documents in a database and using them as context to prompt an LLM. We want to be able to cite the things we look up. For example, if a customer asks an insurance company bot about a policy, our RAG program should be able to look up the policy document, generate an answer based thereon, and cite the actual document with title and page number or some other set of identifying info. It cites these as numbers inside of brackets, Wikipedia-style: <code>This policy stipulates that such-and-such [3]</code>, where <code>[3]</code> links to the cited resource. The system prompt for this runs,</p>
<blockquote>
<p>Use inline citations like [1], [2] when drawing from a specific chunk. … If multiple chunks support a claim, cite all of them like [1][3].</p>
</blockquote>
<p>Because citations are in the text generated by the LLM, there is a chance they can be hallucinated. We want to catch any hallucinations that occur. We do that with <code>Citations.extract/2</code>. That function looks every citation and checks to see if it was hallucinated. For each <code>[N]</code> that is deemed hallucinated, it logs a warning and also returns the hallucinations separately. Note that a hallucinated citation here is one that was made up by the model; we do not, at this juncture, check to ensure that the cited material really supports the LLM’s output. Right now, it’s up to humans to verify that.</p>
<h3><a name="p-395256-how-property-testing-helps-5" class="anchor" href="#p-395256-how-property-testing-helps-5" aria-label="Heading link" rel="nofollow"></a>How Property Testing Helps</h3>
<p>But how do we know that <code>Citations.extract/2</code> actually does what it’s supposed to do? What if it accidentally labels a real citation as a hallucination? Well, we can test it using property testing! We property-test to ensure that <code>extract/2</code> never mislabels a real citation as hallucinated. The property, “hallucinated indices are disjoint from chunk_map keys”, stipulates that no citation deemed invalid is ever inside the <code>chunk_map</code> that contains the actual chunks being cited (which come from our document corpus not an LLM).</p>
<p>The Elixir code implementing this property is:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir"># test/cake/citations_property_test.exs:69-77
property "hallucinated indices are disjoint from chunk_map keys" do
  check all(
          map &lt;- chunk_map(),
          text &lt;- text_with_markers(Enum.to_list(1..32))
        ) do
    {_valid, hallucinated} = Citations.extract(text, map)
    assert Enum.all?(hallucinated, fn idx -&gt; not Map.has_key?(map, idx) end)
  end
end
</code></pre>
<p><code>chunk_map/0</code> generates a map taking random positive integers between 1 and 32 into metadata maps. There are (at most) eight keys in that map, each of which is one of those integers. Meanwhile, text_with_markers/1 builds a text string made up of segments. Each segment can be a random alphanumeric of length &lt;= 8 or random integers from the index_pool formatted as strings thus: <code>"[3]"</code>.</p>
<p>Because the two random things (the chunk map and the text with markers) are generated separately, they have no relationship to one another and can match or mismatch. They both come from a range of <code>1..32</code>, but they’re both random and independently generated. So some will match and some will not.</p>
<p>The actual property is defined on line 75:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">assert Enum.all?(hallucinated, fn idx -&gt; not Map.has_key?(map, idx) end)
</code></pre>
<p>We are asserting that, for any value in <code>hallucinated</code>, there is no key in the map of citable chunks corresponding to that value. If you ever studied philosophy and remember your first-order predicate logic:</p>
<pre data-code-wrap="logic"><code class="lang-logic">∀x: Hx → ¬(x ∈ C)
</code></pre>
<p>Where <code>Hx</code> means “x is hallucinated” and C is the set of citable chunks. We can also express the disjoint nature of the set of hallucinations and cited chunks thus:</p>
<pre data-code-wrap="logic"><code class="lang-logic">(H ∩ C) = ∅
</code></pre>
<p>Strictly speaking, this is not formally proven. It is, rather, tested for a set of 100 random inputs. The power of property testing is that those 100 random inputs are likely to cover corner cases that I wouldn’t have thought of while writing the test because I wasn’t thinking of them when I wrote the code.<br>
One more thing. There’s a trivial solution to this property:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">def extract(_text, _map), do: {[], []}
</code></pre>
<p>But there are other properties in <a href="https://github.com/Thoth-Software/cake/blob/master/test/cake/citations_property_test.exs" rel="noopener nofollow ugc">the test file</a> that close this gap.</p>
<h2><a name="p-395256-development-workflow-6" class="anchor" href="#p-395256-development-workflow-6" aria-label="Heading link" rel="nofollow"></a>Development Workflow</h2>
<p>Back to the macro: how does this change our development workflow? Well, in <a href="https://github.com/Thoth-Software/cake/blob/master/priv/reference/creating-things.md" rel="noopener nofollow ugc">priv/reference/creating-things.md</a>, we have:</p>
<blockquote>
<p>Always favor property tests where possible: while reasoning about testability, consider what properties each function ought to have and whether a property test can cover them; if so, prefer property tests over ordinary tests.</p>
</blockquote>
<p>It’s very simple. We have three things that combine in the dev workflow:</p>
<ol>
<li>We always write a failing red test before writing code; the agent contract specifies that we prefer property testing when possible</li>
<li>We always <em>run</em> the tests prior to committing, so we <em>know</em> they fail</li>
<li>The property tests we write cannot be overfitted to during the green phase of the red/green refactor pattern</li>
</ol>
<p>The upshot of all this: the agent begins by writing a red failing test commit. It runs the test and ensures that those tests fail. The tests in question are very often property tests due to the specification above. Therefore, when the agent writes its green commit, it <em>cannot overfit to the property tests just made in the red commit</em>. The enforced TDD discipline that the agents use here thus has cash value because it forces failing tests and rigorous adherence to invariants that we cannot cheat by overfitting.</p>
<p>(Fun fact: while working on this post, I realized that <code>creating-things.md</code> is loaded for a much narrower class of problems than I would like, so property testing has perhaps not been as strong as it could be. This prompted me to make a change to the agent contract, which Claude Code is working on as I write this post. <img src="https://forum.elixirforum.com/images/emoji/apple/grinning_cat_with_smiling_eyes.png?v=15" title=":grinning_cat_with_smiling_eyes:" class="emoji" alt=":grinning_cat_with_smiling_eyes:" loading="lazy" width="20" height="20">)</p>
<p>One last thing: I should give you an example of overfitting. A case of overfitting would be if I had the agent write a traditional test, hardcode a list including hallucinated citations, and then show that <code>Citations.extract/2</code> returns another hardcoded list. That’s the sort of test an agent might write if you both fail to prefer property tests <em>and</em> allow the agent to write the tests after the code. This whole edifice of property testing and TDD discipline in the commit workflow is meant to forfend that class of issue.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="395256" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/agent-contract-for-my-rag-project/76939/15">Post #14</a>
	                </div>
	            </div>
              <div id="likers-container-395256" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="395256"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #14"></div>
  </section>
</div>
    <div class="postbit" id="395296" data-post-id="395296">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="caleb-bb" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/caleb-bb/120/26803_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  caleb-bb
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Oh, definitely. The problem is that big orgs do these things internally (frequently with sub-par solutions) so your proving ground for this kind of thing will be small-to-mid-sized local firm. There are places like that that do things like keeping all their knowledge on a network drive. Their knowledge management system is literally a person who knows where all the directories in the network drive are. <img src="https://forum.elixirforum.com/images/emoji/apple/joy_cat.png?v=15" title=":joy_cat:" class="emoji" alt=":joy_cat:" loading="lazy" width="20" height="20"></p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="395296" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/agent-contract-for-my-rag-project/76939/16">Post #15</a>
	                </div>
	            </div>
              <div id="likers-container-395296" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="395296"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #15"></div>
  </section>
</div>
    <div class="postbit" id="395298" data-post-id="395298">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="plcholder" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/plcholder/120/41212_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  plcholder
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>How would you go about engineering something like this? I looked into local stt → llm → tts about a month ago, for a small project and the economics didnt look to great and I ended up on the path of gemini live, pricing was okay and the promises were great, ofc google has unlimited compute, but realistically you still want to own the whole stack especially for working on projects that demand privacy &amp; plugging in your own models + data. But now the more I think about it, if i had a dedicated gpu and a couple of small models running , all I would need to do is have a really good batching architecture &amp; most users would get responses quickly and the cost wouldnt be astronomical and I wouldnt have to use gemini live and elixir is great for things like this</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="395298" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/agent-contract-for-my-rag-project/76939/17">Post #16</a>
	                </div>
	            </div>
              <div id="likers-container-395298" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="395298"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #16"></div>
  </section>
</div>
    <div class="postbit" id="395340" data-post-id="395340">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="caleb-bb" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/caleb-bb/120/26803_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  caleb-bb
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>I haven’t built anything like that yet, but I can tell you how I’d reason about it…</p>
<p>In the first place, STT/TTS is a whole lot less hungry than an LLM. So if you’re running a local LLM, I’d give the GPU entirely to the LLM and have the other stuff on the CPU. That changes how we do batching. You can run Whisper at fairly acceptable speeds on a consumer dev laptop without doing any fancy GPU stuff (I learned this while futzing around with Bumblebee).</p>
<p>Since, by hypothesis, Whisper is CPU-bound, our batching architecture is gonna look like parallelization of multiple Whisper instances across CPU cores. We have a layer that collates user utterances into batches and feeds those batches into Whisper instances. The resulting text goes into a queue of some sort to be served to the LLM, and the LLM’s output needs to be sorted and batched again for TTS, which is gonna be parallelized over cores similarly to STT. Again, by hypothesis, it’s CPU-bound.</p>
<p>TTS wants to stream rather than batch, of course. So the strategy for taking the LLM’s output into TTS instances needs to accumulate in such a way that we don’t get any hiccups in the middle. That’s a natural tension in this whole thing, because STT/LLMs like batches and TTS likes streams.</p>
<p>So in other words: you don’t have “a” batching architecture. You have 3: it goes <code>users → STT → LLM → TTS</code> and finally fanned back out to users, and <em>each of those arrows</em> is its own batching architecture.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="395340" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/agent-contract-for-my-rag-project/76939/18">Post #17</a>
	                </div>
	            </div>
              <div id="likers-container-395340" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="395340"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-last-post cat-last-post" title="Last post!"></div>
  </section>
</div>
</template></turbo-stream><turbo-stream action="replace" target="load-more-container"><template><div id="load-more-container" class="load-more-container">
    <span class="all-loaded">— All posts loaded —</span>
</div></template></turbo-stream>