RerankerConfigLoader

org.llm4s.config.RerankerConfigLoader

Loads the reranker selected under llm4s.rerank into a org.llm4s.reranker.RerankProviderConfig.

llm4s-rag's reference.conf binds RERANK_PROVIDER, COHERE_RERANK_BASE_URL and COHERE_RERANK_MODEL there. The Cohere key is llm4s.rerank.cohere.apiKey when that is set, and otherwise Cohere's shared llm4s.credentials.cohere.apiKey, bound to COHERE_API_KEY - the key the Cohere chat provider uses too, so one variable serves both.

for
 reranker <- RerankerConfigLoader.default()
 rag      <- RAG.build(config, resolveRerankerConfig = () => Right(reranker))
yield rag

Only Cohere is configured here. llm reranking needs an LLMClient, which config cannot supply: select it in code with RAGConfig.withLLMReranking or RerankerFactory.llm.

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any
Self type

Members list

Value members

Concrete methods

load against the current environment: system properties, application.conf and every reference.conf.

load against the current environment: system properties, application.conf and every reference.conf.

Attributes

def load(source: ConfigSource): Result[Option[RerankProviderConfig]]

Reads llm4s.rerank from source.

Reads llm4s.rerank from source.

Attributes

Returns

None when no reranker is selected (provider unset, empty or none), the Cohere config when provider = cohere, or a org.llm4s.error.ConfigurationError for a provider config cannot build or a Cohere key set in neither place.

Concrete fields

val COHERE_API_KEY: String

The variable this module's reference.conf binds to llm4s.credentials.cohere.apiKey, named in the missing-key error. llm4s-openai-compatible binds the same one for Cohere chat.

The variable this module's reference.conf binds to llm4s.credentials.cohere.apiKey, named in the missing-key error. llm4s-openai-compatible binds the same one for Cohere chat.

Attributes