Skip to content

Commit 70fa872

Browse files
committed
chore: make base_url kwarg instead of potential
1 parent 24774cc commit 70fa872

3 files changed

Lines changed: 9 additions & 6 deletions

File tree

integrations/jina/src/haystack_integrations/components/embedders/jina/document_embedder.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ def __init__(
4141
self,
4242
api_key: Secret = Secret.from_env_var("JINA_API_KEY"), # noqa: B008
4343
model: str = "jina-embeddings-v3",
44-
base_url: str = JINA_API_URL,
4544
prefix: str = "",
4645
suffix: str = "",
4746
batch_size: int = 32,
@@ -51,14 +50,15 @@ def __init__(
5150
task: str | None = None,
5251
dimensions: int | None = None,
5352
late_chunking: bool | None = None,
53+
*,
54+
base_url: str = JINA_API_URL,
5455
) -> None:
5556
"""
5657
Create a JinaDocumentEmbedder component.
5758
5859
:param api_key: The Jina API key.
5960
:param model: The name of the Jina model to use.
6061
Check the list of available models on [Jina documentation](https://jina.ai/embeddings/).
61-
:param base_url: The base URL of the Jina API.
6262
:param prefix: A string to add to the beginning of each text.
6363
:param suffix: A string to add to the end of each text.
6464
:param batch_size: Number of Documents to encode at once.
@@ -74,6 +74,7 @@ def __init__(
7474
:param late_chunking: A boolean to enable or disable late chunking.
7575
Apply the late chunking technique to leverage the model's long-context capabilities for
7676
generating contextual chunk embeddings.
77+
:param base_url: The base URL of the Jina API.
7778
7879
The support of `task` and `late_chunking` parameters is only available for jina-embeddings-v3.
7980
"""

integrations/jina/src/haystack_integrations/components/embedders/jina/text_embedder.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,13 @@ def __init__(
3737
self,
3838
api_key: Secret = Secret.from_env_var("JINA_API_KEY"), # noqa: B008
3939
model: str = "jina-embeddings-v3",
40-
base_url: str = JINA_API_URL,
4140
prefix: str = "",
4241
suffix: str = "",
4342
task: str | None = None,
4443
dimensions: int | None = None,
4544
late_chunking: bool | None = None,
45+
*,
46+
base_url: str = JINA_API_URL,
4647
) -> None:
4748
"""
4849
Create a JinaTextEmbedder component.
@@ -51,7 +52,6 @@ def __init__(
5152
environment variable `JINA_API_KEY` (recommended).
5253
:param model: The name of the Jina model to use.
5354
Check the list of available models on [Jina documentation](https://jina.ai/embeddings/).
54-
:param base_url: The base URL of the Jina API.
5555
:param prefix: A string to add to the beginning of each text.
5656
:param suffix: A string to add to the end of each text.
5757
:param task: The downstream task for which the embeddings will be used.
@@ -62,6 +62,7 @@ def __init__(
6262
:param late_chunking: A boolean to enable or disable late chunking.
6363
Apply the late chunking technique to leverage the model's long-context capabilities for
6464
generating contextual chunk embeddings.
65+
:param base_url: The base URL of the Jina API.
6566
6667
The support of `task` and `late_chunking` parameters is only available for jina-embeddings-v3.
6768
"""

integrations/jina/src/haystack_integrations/components/rankers/jina/ranker.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,21 +34,22 @@ def __init__(
3434
self,
3535
model: str = "jina-reranker-v1-base-en",
3636
api_key: Secret = Secret.from_env_var("JINA_API_KEY"), # noqa: B008,
37-
base_url: str = JINA_API_URL,
3837
top_k: int | None = None,
3938
score_threshold: float | None = None,
39+
*,
40+
base_url: str = JINA_API_URL,
4041
) -> None:
4142
"""
4243
Creates an instance of JinaRanker.
4344
4445
:param api_key: The Jina API key. It can be explicitly provided or automatically read from the
4546
environment variable JINA_API_KEY (recommended).
4647
:param model: The name of the Jina model to use. Check the list of available models on `https://jina.ai/reranker/`
47-
:param base_url: The base URL of the Jina API.
4848
:param top_k:
4949
The maximum number of Documents to return per query. If `None`, all documents are returned
5050
:param score_threshold:
5151
If provided only returns documents with a score above this threshold.
52+
:param base_url: The base URL of the Jina API.
5253
5354
:raises ValueError:
5455
If `top_k` is not > 0.

0 commit comments

Comments
 (0)