Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Astra DB: Add integration usage tracking #568

Merged
merged 7 commits into from
Mar 18, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion integrations/astra/examples/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
haystack-ai==2.0.0b4
sentence_transformers==2.2.2
openai==1.6.1
astrapy>=0.7.0
astrapy>=0.7.7
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@

from astrapy.api import APIRequestError
from astrapy.db import AstraDB

# For version tracking
from haystack import __name__ as integration_name
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would just hardcode the string haystack at the module level and save an import call, something like

CALLER_NAME = 'haystack'

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@masci does this look okay? i updated the code.

from haystack.version import __version__ as integration_version
from pydantic.dataclasses import dataclass

logger = logging.getLogger(__name__)
Expand Down Expand Up @@ -64,7 +68,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=integration_name,
caller_version=integration_version,
)

try:
# Create and connect to the newly created collection
Expand Down