Cyclium. Test. SynthesizerCase
(Cyclium v0.1.5)
Copy Markdown
Test helpers for verifying synthesizer contract compliance and
a FakeSynthesizer for use in strategy tests.
Usage
defmodule MyApp.Synthesizers.ProcurementTest do
use ExUnit.Case, async: true
use Cyclium.Test.SynthesizerCase
test "synthesizer returns valid response" do
prompt_ctx = %{system: "You are a helpful assistant", messages: []}
episode_ctx = Cyclium.Test.StrategyCase.build_episode_ctx()
assert_valid_synthesize(MySynthesizer, prompt_ctx, episode_ctx)
end
endFakeSynthesizer
For strategy tests that need a controllable synthesizer:
# In test setup
Cyclium.Test.FakeSynthesizer.start_link()
Cyclium.Test.FakeSynthesizer.set_response(%{"answer" => "42"})
# Strategy calls synthesize/2 and gets the canned response
Summary
Functions
Assert that synthesizer.estimate_tokens/1 returns a non-negative integer.
Assert that synthesizer.synthesize/2 returns a valid response shape.