Skip to content
Snippets Groups Projects
Unverified Commit f9065650 authored by BeatrixCohere's avatar BeatrixCohere Committed by GitHub
Browse files

[Cohere] Add client name to Cohere calls (#10384)

Add client name to cohere calls
parent 7d9b24cc
No related branches found
No related tags found
No related merge requests found
...@@ -111,7 +111,7 @@ class CohereEmbedding(BaseEmbedding): ...@@ -111,7 +111,7 @@ class CohereEmbedding(BaseEmbedding):
raise ValueError(f"truncate must be one of {VALID_TRUNCATE_OPTIONS}") raise ValueError(f"truncate must be one of {VALID_TRUNCATE_OPTIONS}")
super().__init__( super().__init__(
cohere_client=cohere.Client(cohere_api_key), cohere_client=cohere.Client(cohere_api_key, client_name="llama_index"),
cohere_api_key=cohere_api_key, cohere_api_key=cohere_api_key,
model_name=model_name, model_name=model_name,
truncate=truncate, truncate=truncate,
......
...@@ -38,7 +38,7 @@ class CohereRerankerFinetuneEngine(BaseCohereRerankerFinetuningEngine): ...@@ -38,7 +38,7 @@ class CohereRerankerFinetuneEngine(BaseCohereRerankerFinetuningEngine):
"Must pass in cohere api key or " "Must pass in cohere api key or "
"specify via COHERE_API_KEY environment variable " "specify via COHERE_API_KEY environment variable "
) )
self._model = cohere.Client(self.api_key) self._model = cohere.Client(self.api_key, client_name="llama_index")
self._train_file_name = train_file_name self._train_file_name = train_file_name
self._val_file_name = val_file_name self._val_file_name = val_file_name
self._model_name = model_name self._model_name = model_name
......
...@@ -69,8 +69,8 @@ class Cohere(LLM): ...@@ -69,8 +69,8 @@ class Cohere(LLM):
additional_kwargs = additional_kwargs or {} additional_kwargs = additional_kwargs or {}
callback_manager = callback_manager or CallbackManager([]) callback_manager = callback_manager or CallbackManager([])
self._client = cohere.Client(api_key) self._client = cohere.Client(api_key, client_name="llama_index")
self._aclient = cohere.AsyncClient(api_key) self._aclient = cohere.AsyncClient(api_key, client_name="llama_index")
super().__init__( super().__init__(
temperature=temperature, temperature=temperature,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment