From 475cfb2af3e4f51d3d49f0e29ffad258b0585652 Mon Sep 17 00:00:00 2001 From: Eric Hare Date: Mon, 18 Mar 2024 00:45:53 -0700 Subject: [PATCH] Astra DB: Add integration usage tracking (#568) * Astra DB: Add integration usage tracking * Update astra_client.py * Update requirements.txt * Fix sorting of imports for ruff linting * Hardcode the caller name * Update astra_client.py --- integrations/astra/examples/requirements.txt | 2 +- .../document_stores/astra/astra_client.py | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/integrations/astra/examples/requirements.txt b/integrations/astra/examples/requirements.txt index 284fd46fe..21aec1397 100644 --- a/integrations/astra/examples/requirements.txt +++ b/integrations/astra/examples/requirements.txt @@ -1,4 +1,4 @@ haystack-ai==2.0.0b4 sentence_transformers==2.2.2 openai==1.6.1 -astrapy>=0.7.0 \ No newline at end of file +astrapy>=0.7.7 \ No newline at end of file diff --git a/integrations/astra/src/haystack_integrations/document_stores/astra/astra_client.py b/integrations/astra/src/haystack_integrations/document_stores/astra/astra_client.py index c1eb1f6a7..fc5f4b6c9 100644 --- a/integrations/astra/src/haystack_integrations/document_stores/astra/astra_client.py +++ b/integrations/astra/src/haystack_integrations/document_stores/astra/astra_client.py @@ -5,11 +5,13 @@ from astrapy.api import APIRequestError from astrapy.db import AstraDB +from haystack.version import __version__ as integration_version from pydantic.dataclasses import dataclass logger = logging.getLogger(__name__) NON_INDEXED_FIELDS = ["metadata._node_content", "content"] +CALLER_NAME = "haystack" @dataclass @@ -64,7 +66,13 @@ def __init__( self.namespace = namespace # Build the Astra DB object - self._astra_db = AstraDB(api_endpoint=api_endpoint, token=token, namespace=namespace) + self._astra_db = AstraDB( + api_endpoint=api_endpoint, + token=token, + namespace=namespace, + caller_name=CALLER_NAME, + caller_version=integration_version, + ) try: # Create and connect to the newly created collection