ResolveModelConfig resolves a model reference into a ModelConfig. Supports "provider/model" inline references or named references into the models map.
(ref string, models map[string]latest.ModelConfig)
| 212 | // ResolveModelConfig resolves a model reference into a ModelConfig. |
| 213 | // Supports "provider/model" inline references or named references into the models map. |
| 214 | func ResolveModelConfig(ref string, models map[string]latest.ModelConfig) (latest.ModelConfig, error) { |
| 215 | // Try inline "provider/model" format first |
| 216 | if parts := strings.SplitN(ref, "/", 2); len(parts) == 2 { |
| 217 | return latest.ModelConfig{ |
| 218 | Provider: parts[0], |
| 219 | Model: parts[1], |
| 220 | }, nil |
| 221 | } |
| 222 | |
| 223 | // Try named reference |
| 224 | if cfg, ok := models[ref]; ok { |
| 225 | return cfg, nil |
| 226 | } |
| 227 | |
| 228 | return latest.ModelConfig{}, fmt.Errorf("model %q not found", ref) |
| 229 | } |
| 230 | |
| 231 | // ParseChunkingConfig extracts chunking configuration from RAGStrategyConfig. |
| 232 | func ParseChunkingConfig(cfg latest.RAGStrategyConfig) ChunkingConfig { |
no outgoing calls
no test coverage detected