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

test(astra): Refactor AstraDB imports in test_astra_component #3413

Merged
merged 2 commits into from
Aug 20, 2024
Merged
Changes from all 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
14 changes: 12 additions & 2 deletions src/backend/tests/integration/astra/test_astra_component.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import os

from langchain_astradb import AstraDBVectorStore, CollectionVectorServiceOptions
from langflow.components.embeddings.AstraVectorize import AstraVectorizeComponent
import pytest
from integration.utils import MockEmbeddings, check_env_vars
from langchain_core.documents import Document
Expand Down Expand Up @@ -97,6 +95,10 @@ def test_astra_embeds_and_search(astra_fixture):
reason="missing astra env vars",
)
def test_astra_vectorize():
from langchain_astradb import AstraDBVectorStore, CollectionVectorServiceOptions

from langflow.components.embeddings.AstraVectorize import AstraVectorizeComponent

store = None
try:
options = {"provider": "nvidia", "modelName": "NV-Embed-QA", "parameters": {}, "authentication": {}}
Expand Down Expand Up @@ -142,6 +144,10 @@ def test_astra_vectorize():
)
def test_astra_vectorize_with_provider_api_key():
"""tests vectorize using an openai api key"""
from langchain_astradb import AstraDBVectorStore, CollectionVectorServiceOptions

from langflow.components.embeddings.AstraVectorize import AstraVectorizeComponent

store = None
try:
application_token = os.getenv("ASTRA_DB_APPLICATION_TOKEN")
Expand Down Expand Up @@ -186,6 +192,10 @@ def test_astra_vectorize_with_provider_api_key():
)
def test_astra_vectorize_passes_authentication():
"""tests vectorize using the authentication parameter"""
from langchain_astradb import AstraDBVectorStore, CollectionVectorServiceOptions
Copy link
Collaborator

Choose a reason for hiding this comment

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

ruff got it - need to add from langflow.components.embeddings.AstraVectorize import AstraVectorizeComponent


from langflow.components.embeddings.AstraVectorize import AstraVectorizeComponent

store = None
try:
application_token = os.getenv("ASTRA_DB_APPLICATION_TOKEN")
Expand Down
Loading