mirror of
https://github.com/tiennm99/DocsGPT.git
synced 2026-10-19 20:14:32 +00:00
refactor(settings): deprecate SAGEMAKER_* and drop two unused settings
SAGEMAKER_REGION, SAGEMAKER_ACCESS_KEY and SAGEMAKER_SECRET_KEY survive only as a fallback for the S3_* credentials. They carry Field(deprecated=...) now, so any read emits a DeprecationWarning naming the replacement and the generated reference shows the notice. The S3 store is the one sanctioned reader; it silences that warning locally because it already logs its own operator-facing one when the fallback is actually used. DEFAULT_MAX_HISTORY was referenced nowhere. RETRIEVERS_ENABLED was read by no code at all, while two docs pages described it as an enforced allow-list; both the setting and those claims are removed.
This commit is contained in:
1 parent
a8dab8864d
commit
d70644743b
8 files changed
+28
-30
No files matched your search
@@ -13,7 +13,6 @@ class AgentSettings(SettingsGroup):
|
||||
"""What an agent may do per turn and how its context is kept within budget."""
|
||||
|
||||
AGENT_NAME: str = Field(default="classic", description="Default agent type for agentless chats.")
|
||||
DEFAULT_MAX_HISTORY: int = Field(default=150, description="Default number of history messages kept.")
|
||||
DEFAULT_AGENT_LIMITS: dict[str, int] = Field(
|
||||
default={"token_limit": 50000, "request_limit": 500},
|
||||
description="Per-agent default quotas: tokens and requests.",
|
||||
|
||||
@@ -15,13 +15,6 @@ class RetrievalSettings(SettingsGroup):
|
||||
VECTOR_STORE: Literal["faiss", "elasticsearch", "mongodb", "qdrant", "milvus", "pgvector"] = Field(
|
||||
default="faiss", description="Vector store backend."
|
||||
)
|
||||
RETRIEVERS_ENABLED: list[str] = Field(
|
||||
default=["classic", "default"],
|
||||
description=(
|
||||
"Retriever keys an agent may use; must match RetrieverCreator.retrievers registry keys, NOT the "
|
||||
"legacy classic_rag label which never matched the registry."
|
||||
),
|
||||
)
|
||||
RETRIEVAL_MAX_PARALLEL_SOURCES: int = Field(
|
||||
default=4,
|
||||
ge=1,
|
||||
|
||||
@@ -34,14 +34,17 @@ class StorageSettings(SettingsGroup):
|
||||
# Legacy AWS credentials from the retired SageMaker provider.
|
||||
SAGEMAKER_REGION: Optional[str] = Field(
|
||||
default=None,
|
||||
deprecated="Set S3_REGION instead; the SAGEMAKER_* fallback will be removed.",
|
||||
description="Legacy AWS region from the retired SageMaker provider; deprecated fallback for S3_REGION.",
|
||||
)
|
||||
SAGEMAKER_ACCESS_KEY: Optional[str] = Field(
|
||||
default=None,
|
||||
deprecated="Set S3_ACCESS_KEY_ID instead; the SAGEMAKER_* fallback will be removed.",
|
||||
description="Legacy AWS access key from the retired SageMaker provider; deprecated fallback for S3_ACCESS_KEY_ID.",
|
||||
)
|
||||
SAGEMAKER_SECRET_KEY: Optional[str] = Field(
|
||||
default=None,
|
||||
deprecated="Set S3_SECRET_ACCESS_KEY instead; the SAGEMAKER_* fallback will be removed.",
|
||||
description=(
|
||||
"Legacy AWS secret key from the retired SageMaker provider; deprecated fallback for "
|
||||
"S3_SECRET_ACCESS_KEY."
|
||||
|
||||
@@ -4,6 +4,7 @@ import io
|
||||
import logging
|
||||
import os
|
||||
import posixpath
|
||||
import warnings
|
||||
from typing import BinaryIO, Callable, List, Optional, Tuple
|
||||
|
||||
import boto3
|
||||
@@ -30,9 +31,13 @@ class S3Storage(BaseStorage):
|
||||
secret_key = settings.S3_SECRET_ACCESS_KEY
|
||||
region = settings.S3_REGION
|
||||
|
||||
legacy_access = getattr(settings, "SAGEMAKER_ACCESS_KEY", None)
|
||||
legacy_secret = getattr(settings, "SAGEMAKER_SECRET_KEY", None)
|
||||
legacy_region = getattr(settings, "SAGEMAKER_REGION", None)
|
||||
# The SAGEMAKER_* fields are marked deprecated on the model and warn on every read;
|
||||
# this is the one sanctioned reader, and it raises its own operator-facing warning.
|
||||
with warnings.catch_warnings():
|
||||
warnings.simplefilter("ignore", DeprecationWarning)
|
||||
legacy_access = settings.SAGEMAKER_ACCESS_KEY
|
||||
legacy_secret = settings.SAGEMAKER_SECRET_KEY
|
||||
legacy_region = settings.SAGEMAKER_REGION
|
||||
|
||||
used_legacy = (
|
||||
(not access_key and legacy_access)
|
||||
|
||||
Reference in new issue
Block a user