refactor(s3_vectors): keep the ingest target derivation under llms/s3_vectors

The ingest-side bucket and index precedence now sits next to the shared
store id split instead of under litellm/rag/, where provider-specific
parsing does not belong.
This commit is contained in:
mateo-berri 2026-09-19 04:04:59 -07:00
parent e4d01d1d78
commit ccb48eb528
2 changed files with 17 additions and 20 deletions

View file

@ -41,6 +41,22 @@ def split_s3_vectors_store_id(vector_store_id: str, fallback_bucket_name: object
return bucket_name, index_name
def _non_empty_str(value: object) -> str | None:
return value if isinstance(value, str) and value else None
def s3_vectors_ingest_target(vector_store_config: Mapping[str, object]) -> tuple[str, str | None]:
explicit_bucket_name: Final = _non_empty_str(vector_store_config.get("vector_bucket_name"))
explicit_index_name: Final = _non_empty_str(vector_store_config.get("index_name"))
vector_store_id: Final = _non_empty_str(vector_store_config.get("vector_store_id"))
if vector_store_id is None:
if explicit_bucket_name is None:
raise ValueError(S3_VECTORS_STORE_ID_ERROR)
return explicit_bucket_name, explicit_index_name
derived_bucket_name, derived_index_name = split_s3_vectors_store_id(vector_store_id, explicit_bucket_name)
return explicit_bucket_name or derived_bucket_name, explicit_index_name or derived_index_name
class S3VectorsVectorStoreConfig(BaseQueryEmbeddingVectorStoreConfig, BaseAWSLLM):
"""Vector store configuration for AWS S3 Vectors."""

View file

@ -33,10 +33,7 @@ from litellm.llms.custom_httpx.http_handler import (
get_async_httpx_client,
httpxSpecialProvider,
)
from litellm.llms.s3_vectors.vector_stores.transformation import (
S3_VECTORS_STORE_ID_ERROR,
split_s3_vectors_store_id,
)
from litellm.llms.s3_vectors.vector_stores.transformation import s3_vectors_ingest_target
from litellm.rag.ingestion.base_ingestion import BaseRAGIngestion
if TYPE_CHECKING:
@ -66,22 +63,6 @@ class S3VectorsQueryResponse(TypedDict, total=False):
vectors: Sequence[S3VectorsQueryMatch]
def _non_empty_str(value: object) -> str | None:
return value if isinstance(value, str) and value else None
def s3_vectors_ingest_target(vector_store_config: Mapping[str, object]) -> tuple[str, str | None]:
explicit_bucket_name: Final = _non_empty_str(vector_store_config.get("vector_bucket_name"))
explicit_index_name: Final = _non_empty_str(vector_store_config.get("index_name"))
vector_store_id: Final = _non_empty_str(vector_store_config.get("vector_store_id"))
if vector_store_id is None:
if explicit_bucket_name is None:
raise ValueError(S3_VECTORS_STORE_ID_ERROR)
return explicit_bucket_name, explicit_index_name
derived_bucket_name, derived_index_name = split_s3_vectors_store_id(vector_store_id, explicit_bucket_name)
return explicit_bucket_name or derived_bucket_name, explicit_index_name or derived_index_name
class S3VectorsRAGIngestion(BaseRAGIngestion, BaseAWSLLM):
"""
S3 Vectors RAG ingestion using httpx + AWS SigV4 signing.