ModelRef.parse constructor
Parses the string shorthand provider/modelId.
Throws ConfigException when value is not <provider>/<modelId>
with both sides non-empty.
Implementation
factory ModelRef.parse(String value, {String? role}) {
final slash = value.indexOf('/');
if (slash <= 0 || slash == value.length - 1) {
throw ConfigException(
'invalid model reference "$value"${role == null ? '' : ' in role "$role"'}'
' — expected "provider/modelId"',
);
}
return ModelRef(
provider: value.substring(0, slash).trim(),
modelId: value.substring(slash + 1).trim(),
);
}