Proves a provider module's reference.conf binds what its descriptor declares.
A descriptor's configSpec.apiKeyEnv names the variables its module binds to llm4s.credentials.<id>.apiKey, and the binding itself is a reference.conf line: nothing but a test keeps the two in step. These functions load a section or embeddings block that sets no apiKey of its own - so the shared credential is the only place a key can come from - against every reference.conf on the test classpath and an injected environment (the real one switched off).
ProviderModuleChecks.assertCredentialBindings wraps chatBindings as an assertion; use these directly for the cases it does not cover - an alias, two variables in precedence order, a provider that must ''not'' pick up a neighbour's variable.
For each variable descriptor declares, the key a section without one resolves to when only that variable is set, to key-from-<VARIABLE>. Every entry should be Right(Some("key-from-<VARIABLE>")).
For each variable descriptor declares, the key a section without one resolves to when only that variable is set, to key-from-<VARIABLE>. Every entry should be Right(Some("key-from-<VARIABLE>")).
Value parameters
descriptor
the chat descriptor whose configSpec.apiKeyEnv is checked
extraFields
further HOCON fields the section needs to validate (required extras)
The key a chat section with no apiKey of its own resolves to under env.
The key a chat section with no apiKey of its own resolves to under env.
Value parameters
env
the environment ${?VAR} substitutions see
extraFields
further HOCON fields for the section - a required extra such as endpoint = "...", or an apiKey = ${?OTHER_VAR} to test precedence
provider
the provider id or alias the section names
Attributes
Returns
Right(Some(key)), Right(None) for a provider that takes no key and was given none, or the validation error - for a required key, the one naming the variables