Skip to content

Commit

Permalink
Client Arguments for DatabricksVectorSearch (#27)
Browse files Browse the repository at this point in the history
* Allow argument to be passed to VectorSearchClient to enable users to use Service Principals instead of PATs

* Update integrations/langchain/src/databricks_langchain/vectorstores.py

Co-authored-by: Prithvi Kannan <[email protected]>

* Update vectorstores.py

Resolve weird line duplication from accepting the proposed change

---------

Co-authored-by: Prithvi Kannan <[email protected]>
  • Loading branch information
chutch1122 and prithvikannan authored Dec 19, 2024
1 parent b25b56b commit d60e701
Showing 1 changed file with 6 additions and 1 deletion.
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 @@ -212,6 +216,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) and _INDEX_NAME_PATTERN.match(index_name)):
raise ValueError(
Expand All @@ -230,7 +235,7 @@ def __init__(
) from e

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

0 comments on commit d60e701

Please sign in to comment.