@@ -26,7 +26,7 @@ class VoyageAIEmbeddingConfig(EmbeddingConfig):
2626 le = 128 ,
2727 description = "Batch size for embedding requests. VoyageAI has a limit of 128." ,
2828 )
29- api_key : Optional [ SecretStr ] = Field (description = "API key for VoyageAI" , default = None )
29+ api_key : SecretStr = Field (description = "API key for VoyageAI" )
3030 embedder_model_name : str = Field (
3131 default = "voyage-3" , alias = "model_name" , description = "VoyageAI model name"
3232 )
@@ -65,9 +65,8 @@ def get_client(self) -> "VoyageAIClient":
6565 """Creates a VoyageAI python client to embed elements."""
6666 from voyageai import Client as VoyageAIClient
6767
68- api_key = self .api_key .get_secret_value () if self .api_key else None
6968 client = VoyageAIClient (
70- api_key = api_key ,
69+ api_key = self . api_key . get_secret_value () ,
7170 max_retries = self .max_retries ,
7271 timeout = self .timeout_in_seconds ,
7372 )
@@ -81,9 +80,8 @@ def get_async_client(self) -> "AsyncVoyageAIClient":
8180 """Creates a VoyageAI python client to embed elements."""
8281 from voyageai import AsyncClient as AsyncVoyageAIClient
8382
84- api_key = self .api_key .get_secret_value () if self .api_key else None
8583 client = AsyncVoyageAIClient (
86- api_key = api_key ,
84+ api_key = self . api_key . get_secret_value () ,
8785 max_retries = self .max_retries ,
8886 timeout = self .timeout_in_seconds ,
8987 )
0 commit comments