Configuration registry for provider/model switching
Configuration registry for provider/model switching
(clear-registry!)Clear all registered configurations (useful for testing)
Clear all registered configurations (useful for testing)
(get-config config-name)Get a registered configuration by name
Get a registered configuration by name
(list-configs)List all registered configuration names
List all registered configuration names
(register! config-name config-map)Register a provider configuration with a keyword name.
Configuration can be:
Examples: (register! :fast {:provider :openai :model "gpt-4o-mini" :config {:api-key "..."}})
(register! :smart {:router (fn [req] (if (> (count (:messages req)) 10) {:provider :anthropic :model "claude-3-opus"} {:provider :openai :model "gpt-4o-mini"})) :configs {:openai {:api-key "..."} :anthropic {:api-key "..."}}})
Register a provider configuration with a keyword name.
Configuration can be:
- Simple: {:provider :openai :model "gpt-4" :config {...}}
- With router: {:router (fn [request] {...}) :config {...}}
- Multi-provider: {:router (fn [request] {...}) :configs {:openai {...} :anthropic {...}}}
Examples:
  (register! :fast {:provider :openai :model "gpt-4o-mini" :config {:api-key "..."}})
  
  (register! :smart {:router (fn [req] 
                               (if (> (count (:messages req)) 10)
                                 {:provider :anthropic :model "claude-3-opus"}
                                 {:provider :openai :model "gpt-4o-mini"}))
                     :configs {:openai {:api-key "..."} 
                              :anthropic {:api-key "..."}}})(register-with-validation! config-name config-map)Register a configuration with validation
Register a configuration with validation
(resolve-config config-name request)Resolve a configuration, applying router function if present.
Returns a map with :provider, :model, and :config keys.
If config has a :router function, it will be called with the request to determine provider/model dynamically.
Resolve a configuration, applying router function if present. Returns a map with :provider, :model, and :config keys. If config has a :router function, it will be called with the request to determine provider/model dynamically.
(unregister! config-name)Remove a configuration from the registry
Remove a configuration from the registry
(validate-config config-map)Validate a configuration map
Validate a configuration map
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs | 
| ← | Move to previous article | 
| → | Move to next article | 
| Ctrl+/ | Jump to the search field |