Skip to content

Commit

Permalink
Allow argument to be passed to VectorSearchClient to enable users to …
Browse files Browse the repository at this point in the history
…use Service Principals instead of PATs
  • Loading branch information
chutch1122 committed Dec 11, 2024
1 parent 0aa4d60 commit 9087b4c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion libs/databricks/langchain_databricks/vectorstores.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ class DatabricksVectorSearch(VectorStore):
Make sure the text column specified is in the index.
columns: The list of column names to get when doing the search.
Defaults to ``[primary_key, text_column]``.
client_args: Additional arguments to pass to the VectorSearchClient.
Allows you to pass in values like `service_principal_client_id`
and `service_principal_client_secret` for to allow for
service principal authentication instead of personal access token authentication.
Instantiate:
Expand Down Expand Up @@ -214,6 +218,7 @@ def __init__(
embedding: Optional[Embeddings] = None,
text_column: Optional[str] = None,
columns: Optional[List[str]] = None,
client_args: Optional[Dict[str, Any]] = None,
):
if not isinstance(index_name, str):
raise ValueError(
Expand All @@ -232,7 +237,7 @@ def __init__(
) from e

try:
self.index = VectorSearchClient().get_index(
self.index = VectorSearchClient(**client_args).get_index(
endpoint_name=endpoint, index_name=index_name
)
except Exception as e:
Expand Down

0 comments on commit 9087b4c

Please sign in to comment.