feat: Support for Autodetect in AstraDBVectorStore settings (#4869)
* feat: first pass at autodetect updates * [autofix.ci] apply automated fixes * Fully support autodetect --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
This commit is contained in:
parent
269bc8fa63
commit
19d2974904
7 changed files with 280 additions and 93 deletions
|
|
@ -4,7 +4,7 @@ import pytest
|
|||
from astrapy.db import AstraDB
|
||||
from langchain_core.documents import Document
|
||||
from langflow.components.embeddings import OpenAIEmbeddingsComponent
|
||||
from langflow.components.vectorstores import AstraVectorStoreComponent
|
||||
from langflow.components.vectorstores import AstraDBVectorStoreComponent
|
||||
from langflow.schema.data import Data
|
||||
|
||||
from tests.api_keys import get_astradb_api_endpoint, get_astradb_application_token, get_openai_api_key
|
||||
|
|
@ -43,7 +43,7 @@ async def test_base(astradb_client: AstraDB):
|
|||
api_endpoint = get_astradb_api_endpoint()
|
||||
|
||||
results = await run_single_component(
|
||||
AstraVectorStoreComponent,
|
||||
AstraDBVectorStoreComponent,
|
||||
inputs={
|
||||
"token": application_token,
|
||||
"api_endpoint": api_endpoint,
|
||||
|
|
@ -69,7 +69,7 @@ async def test_astra_embeds_and_search():
|
|||
api_endpoint = get_astradb_api_endpoint()
|
||||
|
||||
results = await run_single_component(
|
||||
AstraVectorStoreComponent,
|
||||
AstraDBVectorStoreComponent,
|
||||
inputs={
|
||||
"token": application_token,
|
||||
"api_endpoint": api_endpoint,
|
||||
|
|
@ -111,7 +111,7 @@ def test_astra_vectorize():
|
|||
documents = [Document(page_content="test1"), Document(page_content="test2")]
|
||||
records = [Data.from_document(d) for d in documents]
|
||||
|
||||
component = AstraVectorStoreComponent()
|
||||
component = AstraDBVectorStoreComponent()
|
||||
vectorize_options = component.build_vectorize_options(**options_comp)
|
||||
|
||||
component.build(
|
||||
|
|
@ -167,7 +167,7 @@ def test_astra_vectorize_with_provider_api_key():
|
|||
documents = [Document(page_content="test1"), Document(page_content="test2")]
|
||||
records = [Data.from_document(d) for d in documents]
|
||||
|
||||
component = AstraVectorStoreComponent()
|
||||
component = AstraDBVectorStoreComponent()
|
||||
vectorize_options = component.build_vectorize_options(**options_comp)
|
||||
|
||||
component.build(
|
||||
|
|
@ -222,7 +222,7 @@ def test_astra_vectorize_passes_authentication():
|
|||
documents = [Document(page_content="test1"), Document(page_content="test2")]
|
||||
records = [Data.from_document(d) for d in documents]
|
||||
|
||||
component = AstraVectorStoreComponent()
|
||||
component = AstraDBVectorStoreComponent()
|
||||
vectorize_options = component.build_vectorize_options(**options_comp)
|
||||
|
||||
component.build(
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ from langflow.components.outputs import ChatOutput
|
|||
from langflow.components.processing import ParseDataComponent
|
||||
from langflow.components.processing.split_text import SplitTextComponent
|
||||
from langflow.components.prompts import PromptComponent
|
||||
from langflow.components.vectorstores import AstraVectorStoreComponent
|
||||
from langflow.components.vectorstores import AstraDBVectorStoreComponent
|
||||
from langflow.graph import Graph
|
||||
from langflow.graph.graph.constants import Finish
|
||||
from langflow.schema import Data
|
||||
|
|
@ -29,7 +29,7 @@ def ingestion_graph():
|
|||
openai_embeddings.set(
|
||||
openai_api_key="sk-123", openai_api_base="https://api.openai.com/v1", openai_api_type="openai"
|
||||
)
|
||||
vector_store = AstraVectorStoreComponent(_id="vector-store-123")
|
||||
vector_store = AstraDBVectorStoreComponent(_id="vector-store-123")
|
||||
vector_store.set(
|
||||
embedding_model=openai_embeddings.build_embeddings,
|
||||
ingest_data=text_splitter.split_text,
|
||||
|
|
@ -48,7 +48,7 @@ def rag_graph():
|
|||
openai_embeddings = OpenAIEmbeddingsComponent(_id="openai-embeddings-124")
|
||||
chat_input = ChatInput(_id="chatinput-123")
|
||||
chat_input.get_output("message").value = "What is the meaning of life?"
|
||||
rag_vector_store = AstraVectorStoreComponent(_id="rag-vector-store-123")
|
||||
rag_vector_store = AstraDBVectorStoreComponent(_id="rag-vector-store-123")
|
||||
rag_vector_store.set(
|
||||
search_input=chat_input.message_response,
|
||||
api_endpoint="https://astra.example.com",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue