parseModelShorthand parses "provider/model" into a ModelConfig
(s string)
| 149 | |
| 150 | // parseModelShorthand parses "provider/model" into a ModelConfig |
| 151 | func parseModelShorthand(s string) *latest.ModelConfig { |
| 152 | if idx := strings.Index(s, "/"); idx > 0 && idx < len(s)-1 { |
| 153 | return &latest.ModelConfig{ |
| 154 | Provider: s[:idx], |
| 155 | Model: s[idx+1:], |
| 156 | } |
| 157 | } |
| 158 | return nil |
| 159 | } |
| 160 | |
| 161 | // newListener creates a TCP listener and returns a cleanup function that |
| 162 | // must be deferred by the caller. The cleanup function closes the listener. |