From 4b0bb99b5ff07ab37eb058c1d91255d76b80a42c Mon Sep 17 00:00:00 2001 From: adavyas Date: Wed, 5 Aug 2026 15:32:02 -0400 Subject: [PATCH] refactor: always resolve encoding from current config Drops the cached-instance fast path so the encoding tracks runtime config changes like every other accessor (review feedback), and trims the docstring back to one line. Co-Authored-By: Claude Fable 5 --- src/embedding_client.py | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/embedding_client.py b/src/embedding_client.py index d66af318..047e07d4 100644 --- a/src/embedding_client.py +++ b/src/embedding_client.py @@ -674,15 +674,7 @@ class EmbeddingClient: @property def encoding(self) -> tiktoken.Encoding: - """Get the tiktoken encoding. - - Resolved without constructing the underlying client: tiktoken needs no - API key, and token-counting callers (e.g. the document dedup tie-break) - must work in environments with no embedding credentials, such as CI for - pull requests from forks. - """ - if self._instance is not None: - return self._instance.encoding + """Get the tiktoken encoding.""" try: return tiktoken.encoding_for_model(self._resolve_runtime_config().model) except KeyError: