providersQueueYamlBody function
Serializes entries to the yaml body of a providersQueue: block
(2-space indented list items, no trailing newline) — the surgical
write's payload (UT-yaml-roundtrip). Secrets cannot leak: the shape
only carries apiKeyEnv names.
Implementation
String providersQueueYamlBody(List<ProviderQueueEntry> entries) {
final buffer = StringBuffer();
for (final entry in entries) {
buffer.writeln('- provider_type: ${entry.providerType}');
buffer.writeln(' provider_config:');
buffer.writeln(' model: ${entry.model}');
if (entry.baseUrl != null) buffer.writeln(' baseUrl: ${entry.baseUrl}');
if (entry.apiKeyEnv != null) {
buffer.writeln(' apiKeyEnv: ${entry.apiKeyEnv}');
}
if (entry.contextWindow != null) {
buffer.writeln(' contextWindow: ${entry.contextWindow}');
}
if (entry.maxTokens != null) {
buffer.writeln(' maxTokens: ${entry.maxTokens}');
}
}
return buffer.toString().trimRight();
}