LLM SDK Output Strategies
Problem statement
Build a small output SDK with a base output strategy and two implementations. The LLM is already running elsewhere; no network calls, URL sessions, or error-handling wrapper are needed.
- The
hellostrategy returnshelloand ignores its input. - The
worldstrategy returns its input followed immediately byworld, with no extra space.
For each matching pair in modes and inputs, invoke that strategy and return its output in batch order. Use subclasses where the language supports them, or implementations of a common interface in Go. Keep output behavior separate from any session object.
Function
sdkOutputs(modes: String[], inputs: String[]) → String[]Examples
Example 1
modes = ["hello","world","world"]inputs = ["ignored","hi",""]return = ["hello","hiworld","world"]The hello strategy ignores its input. The world strategy appends world directly, including for an empty input.
Example 2
modes = []inputs = []return = []An empty batch has no outputs.
Constraints
- 0 <= modes.length, inputs.length <= 1000
- modes.length == inputs.length
- Every mode is either hello or world.
- Each input contains at most 1000 ASCII characters.