MCPcopy Create free account
hub / github.com/astercloud/aster / buildModelConfig

Function buildModelConfig

cmd/aster/session.go:180–207  ·  view source on GitHub ↗

buildModelConfig builds the model configuration

(providerName, modelName string, recipeConfig *recipe.Recipe)

Source from the content-addressed store, hash-verified

178
179// buildModelConfig builds the model configuration
180func buildModelConfig(providerName, modelName string, recipeConfig *recipe.Recipe) *types.ModelConfig {
181 // Default values
182 if providerName == "" {
183 providerName = "anthropic"
184 }
185 if modelName == "" {
186 modelName = "claude-sonnet-4-20250514"
187 }
188
189 // Override from recipe
190 if recipeConfig != nil && recipeConfig.Settings != nil {
191 if recipeConfig.Settings.Provider != "" {
192 providerName = recipeConfig.Settings.Provider
193 }
194 if recipeConfig.Settings.Model != "" {
195 modelName = recipeConfig.Settings.Model
196 }
197 }
198
199 // Get API key from environment
200 apiKey := getAPIKey(providerName)
201
202 return &types.ModelConfig{
203 Provider: providerName,
204 Model: modelName,
205 APIKey: apiKey,
206 }
207}
208
209// getAPIKey returns the API key for a provider
210func getAPIKey(providerName string) string {

Callers 1

runSessionFunction · 0.85

Calls 1

getAPIKeyFunction · 0.85

Tested by

no test coverage detected