Skip to content
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions langchain/langchain_vectorize/retrievers.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,9 @@ def format_docs(docs):
"""The Vectorize API token."""
environment: Literal["prod", "dev", "local", "staging"] = "prod"
"""The Vectorize API environment."""
organization: Optional[str] = None # noqa: UP007
organization: Optional[str] = None
"""The Vectorize organization ID."""
pipeline_id: Optional[str] = None # noqa: UP007
pipeline_id: Optional[str] = None
"""The Vectorize pipeline ID."""
num_results: int = 5
"""The number of documents to return."""
Expand Down
4 changes: 2 additions & 2 deletions langchain/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,12 @@ Issues = "https://github.com/vectorize-io/integrations-python/issues"
dev = [
"mypy>=1.13.0",
"pytest>=8.3.3",
"ruff>=0.9.0,<0.10",
"ruff>=0.12.7,<0.13",
]

[tool.ruff.lint]
select = ["ALL"]
ignore = [
"CPY", # Missing copyright
"COM812", # Messes with the formatter
"ISC001", # Messes with the formatter
"PERF203", # Rarely useful
Expand All @@ -49,6 +48,7 @@ ignore = [
pydocstyle.convention = "google"
flake8-annotations.allow-star-arg-any = true
flake8-annotations.mypy-init-return = true
pyupgrade.keep-runtime-typing = true

[tool.ruff.lint.per-file-ignores]
"tests/*" = [
Expand Down
16 changes: 9 additions & 7 deletions langchain/tests/test_retrievers.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@

from langchain_vectorize.retrievers import VectorizeRetriever

logger = logging.getLogger(__name__)


@pytest.fixture(scope="session")
def api_token() -> str:
Expand All @@ -35,7 +37,7 @@ def org_id() -> str:
@pytest.fixture(scope="session")
def environment() -> Literal["prod", "dev", "local", "staging"]:
env = os.getenv("VECTORIZE_ENV", "prod")
if env not in ["prod", "dev", "local", "staging"]:
if env not in {"prod", "dev", "local", "staging"}:
msg = "Invalid VECTORIZE_ENV environment variable."
raise ValueError(msg)
return env
Expand Down Expand Up @@ -76,7 +78,7 @@ def pipeline_id(api_client: v.ApiClient, org_id: str) -> Iterator[str]:
),
)
source_connector_id = response.connector.id
logging.info("Created source connector %s", source_connector_id)
logger.info("Created source connector %s", source_connector_id)

uploads_api = v.UploadsApi(api_client)
upload_response = uploads_api.start_file_upload_to_connector(
Expand Down Expand Up @@ -107,23 +109,23 @@ def pipeline_id(api_client: v.ApiClient, org_id: str) -> Iterator[str]:
msg = "Upload failed:"
raise ValueError(msg)
else:
logging.info("Upload successful")
logger.info("Upload successful")

ai_platforms = v.AIPlatformConnectorsApi(api_client).get_ai_platform_connectors(
org_id
)
builtin_ai_platform = next(
c.id for c in ai_platforms.ai_platform_connectors if c.type == "VECTORIZE"
)
logging.info("Using AI platform %s", builtin_ai_platform)
logger.info("Using AI platform %s", builtin_ai_platform)

vector_databases = v.DestinationConnectorsApi(
api_client
).get_destination_connectors(org_id)
builtin_vector_db = next(
c.id for c in vector_databases.destination_connectors if c.type == "VECTORIZE"
)
logging.info("Using destination connector %s", builtin_vector_db)
logger.info("Using destination connector %s", builtin_vector_db)

pipeline_response = pipelines.create_pipeline(
org_id,
Expand All @@ -150,14 +152,14 @@ def pipeline_id(api_client: v.ApiClient, org_id: str) -> Iterator[str]:
),
)
pipeline_id = pipeline_response.data.id
logging.info("Created pipeline %s", pipeline_id)
logger.info("Created pipeline %s", pipeline_id)

yield pipeline_id

try:
pipelines.delete_pipeline(org_id, pipeline_id)
except Exception:
logging.exception("Failed to delete pipeline %s", pipeline_id)
logger.exception("Failed to delete pipeline %s", pipeline_id)


def test_retrieve_init_args(
Expand Down
44 changes: 22 additions & 22 deletions langchain/uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading