Skip to content

Commit

Permalink
test(astra): Refactor AstraDB imports in test_astra_component
Browse files Browse the repository at this point in the history
  • Loading branch information
ogabrielluiz committed Aug 18, 2024
1 parent a5cdab6 commit 01562c5
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 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,8 @@ 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

store = None
try:
application_token = os.getenv("ASTRA_DB_APPLICATION_TOKEN")
Expand Down Expand Up @@ -186,6 +190,8 @@ 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

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

0 comments on commit 01562c5

Please sign in to comment.