| class DeploymentConfig(BaseSettings): | class DeploymentConfig(BaseSettings): | ||||
| """ | """ | ||||
| Deployment configs | |||||
| Configuration settings for application deployment | |||||
| """ | """ | ||||
| APPLICATION_NAME: str = Field( | APPLICATION_NAME: str = Field( | ||||
| description="application name", | |||||
| description="Name of the application, used for identification and logging purposes", | |||||
| default="langgenius/dify", | default="langgenius/dify", | ||||
| ) | ) | ||||
| DEBUG: bool = Field( | DEBUG: bool = Field( | ||||
| description="whether to enable debug mode.", | |||||
| description="Enable debug mode for additional logging and development features", | |||||
| default=False, | default=False, | ||||
| ) | ) | ||||
| TESTING: bool = Field( | TESTING: bool = Field( | ||||
| description="", | |||||
| description="Enable testing mode for running automated tests", | |||||
| default=False, | default=False, | ||||
| ) | ) | ||||
| EDITION: str = Field( | EDITION: str = Field( | ||||
| description="deployment edition", | |||||
| description="Deployment edition of the application (e.g., 'SELF_HOSTED', 'CLOUD')", | |||||
| default="SELF_HOSTED", | default="SELF_HOSTED", | ||||
| ) | ) | ||||
| DEPLOY_ENV: str = Field( | DEPLOY_ENV: str = Field( | ||||
| description="deployment environment, default to PRODUCTION.", | |||||
| description="Deployment environment (e.g., 'PRODUCTION', 'DEVELOPMENT'), default to PRODUCTION", | |||||
| default="PRODUCTION", | default="PRODUCTION", | ||||
| ) | ) |
| class EnterpriseFeatureConfig(BaseSettings): | class EnterpriseFeatureConfig(BaseSettings): | ||||
| """ | """ | ||||
| Enterprise feature configs. | |||||
| Configuration for enterprise-level features. | |||||
| **Before using, please contact business@dify.ai by email to inquire about licensing matters.** | **Before using, please contact business@dify.ai by email to inquire about licensing matters.** | ||||
| """ | """ | ||||
| ENTERPRISE_ENABLED: bool = Field( | ENTERPRISE_ENABLED: bool = Field( | ||||
| description="whether to enable enterprise features." | |||||
| description="Enable or disable enterprise-level features." | |||||
| "Before using, please contact business@dify.ai by email to inquire about licensing matters.", | "Before using, please contact business@dify.ai by email to inquire about licensing matters.", | ||||
| default=False, | default=False, | ||||
| ) | ) | ||||
| CAN_REPLACE_LOGO: bool = Field( | CAN_REPLACE_LOGO: bool = Field( | ||||
| description="whether to allow replacing enterprise logo.", | |||||
| description="Allow customization of the enterprise logo.", | |||||
| default=False, | default=False, | ||||
| ) | ) |
| class NotionConfig(BaseSettings): | class NotionConfig(BaseSettings): | ||||
| """ | """ | ||||
| Notion integration configs | |||||
| Configuration settings for Notion integration | |||||
| """ | """ | ||||
| NOTION_CLIENT_ID: Optional[str] = Field( | NOTION_CLIENT_ID: Optional[str] = Field( | ||||
| description="Notion client ID", | |||||
| description="Client ID for Notion API authentication. Required for OAuth 2.0 flow.", | |||||
| default=None, | default=None, | ||||
| ) | ) | ||||
| NOTION_CLIENT_SECRET: Optional[str] = Field( | NOTION_CLIENT_SECRET: Optional[str] = Field( | ||||
| description="Notion client secret key", | |||||
| description="Client secret for Notion API authentication. Required for OAuth 2.0 flow.", | |||||
| default=None, | default=None, | ||||
| ) | ) | ||||
| NOTION_INTEGRATION_TYPE: Optional[str] = Field( | NOTION_INTEGRATION_TYPE: Optional[str] = Field( | ||||
| description="Notion integration type, default to None, available values: internal.", | |||||
| description="Type of Notion integration." | |||||
| " Set to 'internal' for internal integrations, or None for public integrations.", | |||||
| default=None, | default=None, | ||||
| ) | ) | ||||
| NOTION_INTERNAL_SECRET: Optional[str] = Field( | NOTION_INTERNAL_SECRET: Optional[str] = Field( | ||||
| description="Notion internal secret key", | |||||
| description="Secret key for internal Notion integrations. Required when NOTION_INTEGRATION_TYPE is 'internal'.", | |||||
| default=None, | default=None, | ||||
| ) | ) | ||||
| NOTION_INTEGRATION_TOKEN: Optional[str] = Field( | NOTION_INTEGRATION_TOKEN: Optional[str] = Field( | ||||
| description="Notion integration token", | |||||
| description="Integration token for Notion API access. Used for direct API calls without OAuth flow.", | |||||
| default=None, | default=None, | ||||
| ) | ) |
| class SentryConfig(BaseSettings): | class SentryConfig(BaseSettings): | ||||
| """ | """ | ||||
| Sentry configs | |||||
| Configuration settings for Sentry error tracking and performance monitoring | |||||
| """ | """ | ||||
| SENTRY_DSN: Optional[str] = Field( | SENTRY_DSN: Optional[str] = Field( | ||||
| description="Sentry DSN", | |||||
| description="Sentry Data Source Name (DSN)." | |||||
| " This is the unique identifier of your Sentry project, used to send events to the correct project.", | |||||
| default=None, | default=None, | ||||
| ) | ) | ||||
| SENTRY_TRACES_SAMPLE_RATE: NonNegativeFloat = Field( | SENTRY_TRACES_SAMPLE_RATE: NonNegativeFloat = Field( | ||||
| description="Sentry trace sample rate", | |||||
| description="Sample rate for Sentry performance monitoring traces." | |||||
| " Value between 0.0 and 1.0, where 1.0 means 100% of traces are sent to Sentry.", | |||||
| default=1.0, | default=1.0, | ||||
| ) | ) | ||||
| SENTRY_PROFILES_SAMPLE_RATE: NonNegativeFloat = Field( | SENTRY_PROFILES_SAMPLE_RATE: NonNegativeFloat = Field( | ||||
| description="Sentry profiles sample rate", | |||||
| description="Sample rate for Sentry profiling." | |||||
| " Value between 0.0 and 1.0, where 1.0 means 100% of profiles are sent to Sentry.", | |||||
| default=1.0, | default=1.0, | ||||
| ) | ) |
| class SecurityConfig(BaseSettings): | class SecurityConfig(BaseSettings): | ||||
| """ | """ | ||||
| Secret Key configs | |||||
| Security-related configurations for the application | |||||
| """ | """ | ||||
| SECRET_KEY: Optional[str] = Field( | SECRET_KEY: Optional[str] = Field( | ||||
| description="Your App secret key will be used for securely signing the session cookie" | |||||
| description="Secret key for secure session cookie signing." | |||||
| "Make sure you are changing this key for your deployment with a strong key." | "Make sure you are changing this key for your deployment with a strong key." | ||||
| "You can generate a strong key using `openssl rand -base64 42`." | |||||
| "Alternatively you can set it with `SECRET_KEY` environment variable.", | |||||
| "Generate a strong key using `openssl rand -base64 42` or set via the `SECRET_KEY` environment variable.", | |||||
| default=None, | default=None, | ||||
| ) | ) | ||||
| RESET_PASSWORD_TOKEN_EXPIRY_HOURS: PositiveInt = Field( | RESET_PASSWORD_TOKEN_EXPIRY_HOURS: PositiveInt = Field( | ||||
| description="Expiry time in hours for reset token", | |||||
| description="Duration in hours for which a password reset token remains valid", | |||||
| default=24, | default=24, | ||||
| ) | ) | ||||
| class AppExecutionConfig(BaseSettings): | class AppExecutionConfig(BaseSettings): | ||||
| """ | """ | ||||
| App Execution configs | |||||
| Configuration parameters for application execution | |||||
| """ | """ | ||||
| APP_MAX_EXECUTION_TIME: PositiveInt = Field( | APP_MAX_EXECUTION_TIME: PositiveInt = Field( | ||||
| description="execution timeout in seconds for app execution", | |||||
| description="Maximum allowed execution time for the application in seconds", | |||||
| default=1200, | default=1200, | ||||
| ) | ) | ||||
| APP_MAX_ACTIVE_REQUESTS: NonNegativeInt = Field( | APP_MAX_ACTIVE_REQUESTS: NonNegativeInt = Field( | ||||
| description="max active request per app, 0 means unlimited", | |||||
| description="Maximum number of concurrent active requests per app (0 for unlimited)", | |||||
| default=0, | default=0, | ||||
| ) | ) | ||||
| class CodeExecutionSandboxConfig(BaseSettings): | class CodeExecutionSandboxConfig(BaseSettings): | ||||
| """ | """ | ||||
| Code Execution Sandbox configs | |||||
| Configuration for the code execution sandbox environment | |||||
| """ | """ | ||||
| CODE_EXECUTION_ENDPOINT: HttpUrl = Field( | CODE_EXECUTION_ENDPOINT: HttpUrl = Field( | ||||
| description="endpoint URL of code execution service", | |||||
| description="URL endpoint for the code execution service", | |||||
| default="http://sandbox:8194", | default="http://sandbox:8194", | ||||
| ) | ) | ||||
| CODE_EXECUTION_API_KEY: str = Field( | CODE_EXECUTION_API_KEY: str = Field( | ||||
| description="API key for code execution service", | |||||
| description="API key for accessing the code execution service", | |||||
| default="dify-sandbox", | default="dify-sandbox", | ||||
| ) | ) | ||||
| CODE_EXECUTION_CONNECT_TIMEOUT: Optional[float] = Field( | CODE_EXECUTION_CONNECT_TIMEOUT: Optional[float] = Field( | ||||
| description="connect timeout in seconds for code execution request", | |||||
| description="Connection timeout in seconds for code execution requests", | |||||
| default=10.0, | default=10.0, | ||||
| ) | ) | ||||
| CODE_EXECUTION_READ_TIMEOUT: Optional[float] = Field( | CODE_EXECUTION_READ_TIMEOUT: Optional[float] = Field( | ||||
| description="read timeout in seconds for code execution request", | |||||
| description="Read timeout in seconds for code execution requests", | |||||
| default=60.0, | default=60.0, | ||||
| ) | ) | ||||
| CODE_EXECUTION_WRITE_TIMEOUT: Optional[float] = Field( | CODE_EXECUTION_WRITE_TIMEOUT: Optional[float] = Field( | ||||
| description="write timeout in seconds for code execution request", | |||||
| description="Write timeout in seconds for code execution request", | |||||
| default=10.0, | default=10.0, | ||||
| ) | ) | ||||
| CODE_MAX_NUMBER: PositiveInt = Field( | CODE_MAX_NUMBER: PositiveInt = Field( | ||||
| description="max depth for code execution", | |||||
| description="Maximum allowed numeric value in code execution", | |||||
| default=9223372036854775807, | default=9223372036854775807, | ||||
| ) | ) | ||||
| CODE_MIN_NUMBER: NegativeInt = Field( | CODE_MIN_NUMBER: NegativeInt = Field( | ||||
| description="", | |||||
| description="Minimum allowed numeric value in code execution", | |||||
| default=-9223372036854775807, | default=-9223372036854775807, | ||||
| ) | ) | ||||
| CODE_MAX_DEPTH: PositiveInt = Field( | CODE_MAX_DEPTH: PositiveInt = Field( | ||||
| description="max depth for code execution", | |||||
| description="Maximum allowed depth for nested structures in code execution", | |||||
| default=5, | default=5, | ||||
| ) | ) | ||||
| CODE_MAX_PRECISION: PositiveInt = Field( | CODE_MAX_PRECISION: PositiveInt = Field( | ||||
| description="max precision digits for float type in code execution", | |||||
| description="mMaximum number of decimal places for floating-point numbers in code execution", | |||||
| default=20, | default=20, | ||||
| ) | ) | ||||
| CODE_MAX_STRING_LENGTH: PositiveInt = Field( | CODE_MAX_STRING_LENGTH: PositiveInt = Field( | ||||
| description="max string length for code execution", | |||||
| description="Maximum allowed length for strings in code execution", | |||||
| default=80000, | default=80000, | ||||
| ) | ) | ||||
| CODE_MAX_STRING_ARRAY_LENGTH: PositiveInt = Field( | CODE_MAX_STRING_ARRAY_LENGTH: PositiveInt = Field( | ||||
| description="", | |||||
| description="Maximum allowed length for string arrays in code execution", | |||||
| default=30, | default=30, | ||||
| ) | ) | ||||
| CODE_MAX_OBJECT_ARRAY_LENGTH: PositiveInt = Field( | CODE_MAX_OBJECT_ARRAY_LENGTH: PositiveInt = Field( | ||||
| description="", | |||||
| description="Maximum allowed length for object arrays in code execution", | |||||
| default=30, | default=30, | ||||
| ) | ) | ||||
| CODE_MAX_NUMBER_ARRAY_LENGTH: PositiveInt = Field( | CODE_MAX_NUMBER_ARRAY_LENGTH: PositiveInt = Field( | ||||
| description="", | |||||
| description="Maximum allowed length for numeric arrays in code execution", | |||||
| default=1000, | default=1000, | ||||
| ) | ) | ||||
| class EndpointConfig(BaseSettings): | class EndpointConfig(BaseSettings): | ||||
| """ | """ | ||||
| Module URL configs | |||||
| Configuration for various application endpoints and URLs | |||||
| """ | """ | ||||
| CONSOLE_API_URL: str = Field( | CONSOLE_API_URL: str = Field( | ||||
| description="The backend URL prefix of the console API." | |||||
| "used to concatenate the login authorization callback or notion integration callback.", | |||||
| description="Base URL for the console API," | |||||
| "used for login authentication callback or notion integration callbacks", | |||||
| default="", | default="", | ||||
| ) | ) | ||||
| CONSOLE_WEB_URL: str = Field( | CONSOLE_WEB_URL: str = Field( | ||||
| description="The front-end URL prefix of the console web." | |||||
| "used to concatenate some front-end addresses and for CORS configuration use.", | |||||
| description="Base URL for the console web interface," "used for frontend references and CORS configuration", | |||||
| default="", | default="", | ||||
| ) | ) | ||||
| SERVICE_API_URL: str = Field( | SERVICE_API_URL: str = Field( | ||||
| description="Service API Url prefix. used to display Service API Base Url to the front-end.", | |||||
| description="Base URL for the service API, displayed to users for API access", | |||||
| default="", | default="", | ||||
| ) | ) | ||||
| APP_WEB_URL: str = Field( | APP_WEB_URL: str = Field( | ||||
| description="WebApp Url prefix. used to display WebAPP API Base Url to the front-end.", | |||||
| description="Base URL for the web application, used for frontend references", | |||||
| default="", | default="", | ||||
| ) | ) | ||||
| class FileAccessConfig(BaseSettings): | class FileAccessConfig(BaseSettings): | ||||
| """ | """ | ||||
| File Access configs | |||||
| Configuration for file access and handling | |||||
| """ | """ | ||||
| FILES_URL: str = Field( | FILES_URL: str = Field( | ||||
| description="File preview or download Url prefix." | |||||
| " used to display File preview or download Url to the front-end or as Multi-model inputs;" | |||||
| description="Base URL for file preview or download," | |||||
| " used for frontend display and multi-model inputs" | |||||
| "Url is signed and has expiration time.", | "Url is signed and has expiration time.", | ||||
| validation_alias=AliasChoices("FILES_URL", "CONSOLE_API_URL"), | validation_alias=AliasChoices("FILES_URL", "CONSOLE_API_URL"), | ||||
| alias_priority=1, | alias_priority=1, | ||||
| ) | ) | ||||
| FILES_ACCESS_TIMEOUT: int = Field( | FILES_ACCESS_TIMEOUT: int = Field( | ||||
| description="timeout in seconds for file accessing", | |||||
| description="Expiration time in seconds for file access URLs", | |||||
| default=300, | default=300, | ||||
| ) | ) | ||||
| class FileUploadConfig(BaseSettings): | class FileUploadConfig(BaseSettings): | ||||
| """ | """ | ||||
| File Uploading configs | |||||
| Configuration for file upload limitations | |||||
| """ | """ | ||||
| UPLOAD_FILE_SIZE_LIMIT: NonNegativeInt = Field( | UPLOAD_FILE_SIZE_LIMIT: NonNegativeInt = Field( | ||||
| description="size limit in Megabytes for uploading files", | |||||
| description="Maximum allowed file size for uploads in megabytes", | |||||
| default=15, | default=15, | ||||
| ) | ) | ||||
| UPLOAD_FILE_BATCH_LIMIT: NonNegativeInt = Field( | UPLOAD_FILE_BATCH_LIMIT: NonNegativeInt = Field( | ||||
| description="batch size limit for uploading files", | |||||
| description="Maximum number of files allowed in a single upload batch", | |||||
| default=5, | default=5, | ||||
| ) | ) | ||||
| UPLOAD_IMAGE_FILE_SIZE_LIMIT: NonNegativeInt = Field( | UPLOAD_IMAGE_FILE_SIZE_LIMIT: NonNegativeInt = Field( | ||||
| description="image file size limit in Megabytes for uploading files", | |||||
| description="Maximum allowed image file size for uploads in megabytes", | |||||
| default=10, | default=10, | ||||
| ) | ) | ||||
| BATCH_UPLOAD_LIMIT: NonNegativeInt = Field( | BATCH_UPLOAD_LIMIT: NonNegativeInt = Field( | ||||
| description="", # todo: to be clarified | |||||
| description="Maximum number of files allowed in a batch upload operation", | |||||
| default=20, | default=20, | ||||
| ) | ) | ||||
| class HttpConfig(BaseSettings): | class HttpConfig(BaseSettings): | ||||
| """ | """ | ||||
| HTTP configs | |||||
| HTTP-related configurations for the application | |||||
| """ | """ | ||||
| API_COMPRESSION_ENABLED: bool = Field( | API_COMPRESSION_ENABLED: bool = Field( | ||||
| description="whether to enable HTTP response compression of gzip", | |||||
| description="Enable or disable gzip compression for HTTP responses", | |||||
| default=False, | default=False, | ||||
| ) | ) | ||||
| inner_CONSOLE_CORS_ALLOW_ORIGINS: str = Field( | inner_CONSOLE_CORS_ALLOW_ORIGINS: str = Field( | ||||
| description="", | |||||
| description="Comma-separated list of allowed origins for CORS in the console", | |||||
| validation_alias=AliasChoices("CONSOLE_CORS_ALLOW_ORIGINS", "CONSOLE_WEB_URL"), | validation_alias=AliasChoices("CONSOLE_CORS_ALLOW_ORIGINS", "CONSOLE_WEB_URL"), | ||||
| default="", | default="", | ||||
| ) | ) | ||||
| return self.inner_WEB_API_CORS_ALLOW_ORIGINS.split(",") | return self.inner_WEB_API_CORS_ALLOW_ORIGINS.split(",") | ||||
| HTTP_REQUEST_MAX_CONNECT_TIMEOUT: Annotated[ | HTTP_REQUEST_MAX_CONNECT_TIMEOUT: Annotated[ | ||||
| PositiveInt, Field(ge=10, description="connect timeout in seconds for HTTP request") | |||||
| PositiveInt, Field(ge=10, description="Maximum connection timeout in seconds for HTTP requests") | |||||
| ] = 10 | ] = 10 | ||||
| HTTP_REQUEST_MAX_READ_TIMEOUT: Annotated[ | HTTP_REQUEST_MAX_READ_TIMEOUT: Annotated[ | ||||
| PositiveInt, Field(ge=60, description="read timeout in seconds for HTTP request") | |||||
| PositiveInt, Field(ge=60, description="Maximum read timeout in seconds for HTTP requests") | |||||
| ] = 60 | ] = 60 | ||||
| HTTP_REQUEST_MAX_WRITE_TIMEOUT: Annotated[ | HTTP_REQUEST_MAX_WRITE_TIMEOUT: Annotated[ | ||||
| PositiveInt, Field(ge=10, description="read timeout in seconds for HTTP request") | |||||
| PositiveInt, Field(ge=10, description="Maximum write timeout in seconds for HTTP requests") | |||||
| ] = 20 | ] = 20 | ||||
| HTTP_REQUEST_NODE_MAX_BINARY_SIZE: PositiveInt = Field( | HTTP_REQUEST_NODE_MAX_BINARY_SIZE: PositiveInt = Field( | ||||
| description="", | |||||
| description="Maximum allowed size in bytes for binary data in HTTP requests", | |||||
| default=10 * 1024 * 1024, | default=10 * 1024 * 1024, | ||||
| ) | ) | ||||
| HTTP_REQUEST_NODE_MAX_TEXT_SIZE: PositiveInt = Field( | HTTP_REQUEST_NODE_MAX_TEXT_SIZE: PositiveInt = Field( | ||||
| description="", | |||||
| description="Maximum allowed size in bytes for text data in HTTP requests", | |||||
| default=1 * 1024 * 1024, | default=1 * 1024 * 1024, | ||||
| ) | ) | ||||
| SSRF_PROXY_HTTP_URL: Optional[str] = Field( | SSRF_PROXY_HTTP_URL: Optional[str] = Field( | ||||
| description="HTTP URL for SSRF proxy", | |||||
| description="Proxy URL for HTTP requests to prevent Server-Side Request Forgery (SSRF)", | |||||
| default=None, | default=None, | ||||
| ) | ) | ||||
| SSRF_PROXY_HTTPS_URL: Optional[str] = Field( | SSRF_PROXY_HTTPS_URL: Optional[str] = Field( | ||||
| description="HTTPS URL for SSRF proxy", | |||||
| description="Proxy URL for HTTPS requests to prevent Server-Side Request Forgery (SSRF)", | |||||
| default=None, | default=None, | ||||
| ) | ) | ||||
| class InnerAPIConfig(BaseSettings): | class InnerAPIConfig(BaseSettings): | ||||
| """ | """ | ||||
| Inner API configs | |||||
| Configuration for internal API functionality | |||||
| """ | """ | ||||
| INNER_API: bool = Field( | INNER_API: bool = Field( | ||||
| description="whether to enable the inner API", | |||||
| description="Enable or disable the internal API", | |||||
| default=False, | default=False, | ||||
| ) | ) | ||||
| INNER_API_KEY: Optional[str] = Field( | INNER_API_KEY: Optional[str] = Field( | ||||
| description="The inner API key is used to authenticate the inner API", | |||||
| description="API key for accessing the internal API", | |||||
| default=None, | default=None, | ||||
| ) | ) | ||||
| class LoggingConfig(BaseSettings): | class LoggingConfig(BaseSettings): | ||||
| """ | """ | ||||
| Logging configs | |||||
| Configuration for application logging | |||||
| """ | """ | ||||
| LOG_LEVEL: str = Field( | LOG_LEVEL: str = Field( | ||||
| description="Log output level, default to INFO. It is recommended to set it to ERROR for production.", | |||||
| description="Logging level, default to INFO. Set to ERROR for production environments.", | |||||
| default="INFO", | default="INFO", | ||||
| ) | ) | ||||
| LOG_FILE: Optional[str] = Field( | LOG_FILE: Optional[str] = Field( | ||||
| description="logging output file path", | |||||
| description="File path for log output.", | |||||
| default=None, | default=None, | ||||
| ) | ) | ||||
| LOG_FORMAT: str = Field( | LOG_FORMAT: str = Field( | ||||
| description="log format", | |||||
| description="Format string for log messages", | |||||
| default="%(asctime)s.%(msecs)03d %(levelname)s [%(threadName)s] [%(filename)s:%(lineno)d] - %(message)s", | default="%(asctime)s.%(msecs)03d %(levelname)s [%(threadName)s] [%(filename)s:%(lineno)d] - %(message)s", | ||||
| ) | ) | ||||
| LOG_DATEFORMAT: Optional[str] = Field( | LOG_DATEFORMAT: Optional[str] = Field( | ||||
| description="log date format", | |||||
| description="Date format string for log timestamps", | |||||
| default=None, | default=None, | ||||
| ) | ) | ||||
| LOG_TZ: Optional[str] = Field( | LOG_TZ: Optional[str] = Field( | ||||
| description="specify log timezone, eg: America/New_York", | |||||
| description="Timezone for log timestamps (e.g., 'America/New_York')", | |||||
| default=None, | default=None, | ||||
| ) | ) | ||||
| class ModelLoadBalanceConfig(BaseSettings): | class ModelLoadBalanceConfig(BaseSettings): | ||||
| """ | """ | ||||
| Model load balance configs | |||||
| Configuration for model load balancing | |||||
| """ | """ | ||||
| MODEL_LB_ENABLED: bool = Field( | MODEL_LB_ENABLED: bool = Field( | ||||
| description="whether to enable model load balancing", | |||||
| description="Enable or disable load balancing for models", | |||||
| default=False, | default=False, | ||||
| ) | ) | ||||
| class BillingConfig(BaseSettings): | class BillingConfig(BaseSettings): | ||||
| """ | """ | ||||
| Platform Billing Configurations | |||||
| Configuration for platform billing features | |||||
| """ | """ | ||||
| BILLING_ENABLED: bool = Field( | BILLING_ENABLED: bool = Field( | ||||
| description="whether to enable billing", | |||||
| description="Enable or disable billing functionality", | |||||
| default=False, | default=False, | ||||
| ) | ) | ||||
| class UpdateConfig(BaseSettings): | class UpdateConfig(BaseSettings): | ||||
| """ | """ | ||||
| Update configs | |||||
| Configuration for application update checks | |||||
| """ | """ | ||||
| CHECK_UPDATE_URL: str = Field( | CHECK_UPDATE_URL: str = Field( | ||||
| description="url for checking updates", | |||||
| description="URL to check for application updates", | |||||
| default="https://updates.dify.ai", | default="https://updates.dify.ai", | ||||
| ) | ) | ||||
| class WorkflowConfig(BaseSettings): | class WorkflowConfig(BaseSettings): | ||||
| """ | """ | ||||
| Workflow feature configs | |||||
| Configuration for workflow execution | |||||
| """ | """ | ||||
| WORKFLOW_MAX_EXECUTION_STEPS: PositiveInt = Field( | WORKFLOW_MAX_EXECUTION_STEPS: PositiveInt = Field( | ||||
| description="max execution steps in single workflow execution", | |||||
| description="Maximum number of steps allowed in a single workflow execution", | |||||
| default=500, | default=500, | ||||
| ) | ) | ||||
| WORKFLOW_MAX_EXECUTION_TIME: PositiveInt = Field( | WORKFLOW_MAX_EXECUTION_TIME: PositiveInt = Field( | ||||
| description="max execution time in seconds in single workflow execution", | |||||
| description="Maximum execution time in seconds for a single workflow", | |||||
| default=1200, | default=1200, | ||||
| ) | ) | ||||
| WORKFLOW_CALL_MAX_DEPTH: PositiveInt = Field( | WORKFLOW_CALL_MAX_DEPTH: PositiveInt = Field( | ||||
| description="max depth of calling in single workflow execution", | |||||
| description="Maximum allowed depth for nested workflow calls", | |||||
| default=5, | default=5, | ||||
| ) | ) | ||||
| MAX_VARIABLE_SIZE: PositiveInt = Field( | MAX_VARIABLE_SIZE: PositiveInt = Field( | ||||
| description="The maximum size in bytes of a variable. default to 5KB.", | |||||
| description="Maximum size in bytes for a single variable in workflows. Default to 5KB.", | |||||
| default=5 * 1024, | default=5 * 1024, | ||||
| ) | ) | ||||
| class OAuthConfig(BaseSettings): | class OAuthConfig(BaseSettings): | ||||
| """ | """ | ||||
| oauth configs | |||||
| Configuration for OAuth authentication | |||||
| """ | """ | ||||
| OAUTH_REDIRECT_PATH: str = Field( | OAUTH_REDIRECT_PATH: str = Field( | ||||
| description="redirect path for OAuth", | |||||
| description="Redirect path for OAuth authentication callbacks", | |||||
| default="/console/api/oauth/authorize", | default="/console/api/oauth/authorize", | ||||
| ) | ) | ||||
| GITHUB_CLIENT_ID: Optional[str] = Field( | GITHUB_CLIENT_ID: Optional[str] = Field( | ||||
| description="GitHub client id for OAuth", | |||||
| description="GitHub OAuth client secret", | |||||
| default=None, | default=None, | ||||
| ) | ) | ||||
| GITHUB_CLIENT_SECRET: Optional[str] = Field( | GITHUB_CLIENT_SECRET: Optional[str] = Field( | ||||
| description="GitHub client secret key for OAuth", | |||||
| description="GitHub OAuth client secret", | |||||
| default=None, | default=None, | ||||
| ) | ) | ||||
| GOOGLE_CLIENT_ID: Optional[str] = Field( | GOOGLE_CLIENT_ID: Optional[str] = Field( | ||||
| description="Google client id for OAuth", | |||||
| description="Google OAuth client ID", | |||||
| default=None, | default=None, | ||||
| ) | ) | ||||
| GOOGLE_CLIENT_SECRET: Optional[str] = Field( | GOOGLE_CLIENT_SECRET: Optional[str] = Field( | ||||
| description="Google client secret key for OAuth", | |||||
| description="Google OAuth client secret", | |||||
| default=None, | default=None, | ||||
| ) | ) | ||||
| class ModerationConfig(BaseSettings): | class ModerationConfig(BaseSettings): | ||||
| """ | """ | ||||
| Moderation in app configs. | |||||
| Configuration for content moderation | |||||
| """ | """ | ||||
| MODERATION_BUFFER_SIZE: PositiveInt = Field( | MODERATION_BUFFER_SIZE: PositiveInt = Field( | ||||
| description="buffer size for moderation", | |||||
| description="Size of the buffer for content moderation processing", | |||||
| default=300, | default=300, | ||||
| ) | ) | ||||
| class ToolConfig(BaseSettings): | class ToolConfig(BaseSettings): | ||||
| """ | """ | ||||
| Tool configs | |||||
| Configuration for tool management | |||||
| """ | """ | ||||
| TOOL_ICON_CACHE_MAX_AGE: PositiveInt = Field( | TOOL_ICON_CACHE_MAX_AGE: PositiveInt = Field( | ||||
| description="max age in seconds for tool icon caching", | |||||
| description="Maximum age in seconds for caching tool icons", | |||||
| default=3600, | default=3600, | ||||
| ) | ) | ||||
| class MailConfig(BaseSettings): | class MailConfig(BaseSettings): | ||||
| """ | """ | ||||
| Mail Configurations | |||||
| Configuration for email services | |||||
| """ | """ | ||||
| MAIL_TYPE: Optional[str] = Field( | MAIL_TYPE: Optional[str] = Field( | ||||
| description="Mail provider type name, default to None, available values are `smtp` and `resend`.", | |||||
| description="Email service provider type ('smtp' or 'resend'), default to None.", | |||||
| default=None, | default=None, | ||||
| ) | ) | ||||
| MAIL_DEFAULT_SEND_FROM: Optional[str] = Field( | MAIL_DEFAULT_SEND_FROM: Optional[str] = Field( | ||||
| description="default email address for sending from ", | |||||
| description="Default email address to use as the sender", | |||||
| default=None, | default=None, | ||||
| ) | ) | ||||
| RESEND_API_KEY: Optional[str] = Field( | RESEND_API_KEY: Optional[str] = Field( | ||||
| description="API key for Resend", | |||||
| description="API key for Resend email service", | |||||
| default=None, | default=None, | ||||
| ) | ) | ||||
| RESEND_API_URL: Optional[str] = Field( | RESEND_API_URL: Optional[str] = Field( | ||||
| description="API URL for Resend", | |||||
| description="API URL for Resend email service", | |||||
| default=None, | default=None, | ||||
| ) | ) | ||||
| SMTP_SERVER: Optional[str] = Field( | SMTP_SERVER: Optional[str] = Field( | ||||
| description="smtp server host", | |||||
| description="SMTP server hostname", | |||||
| default=None, | default=None, | ||||
| ) | ) | ||||
| SMTP_PORT: Optional[int] = Field( | SMTP_PORT: Optional[int] = Field( | ||||
| description="smtp server port", | |||||
| description="SMTP server port number", | |||||
| default=465, | default=465, | ||||
| ) | ) | ||||
| SMTP_USERNAME: Optional[str] = Field( | SMTP_USERNAME: Optional[str] = Field( | ||||
| description="smtp server username", | |||||
| description="Username for SMTP authentication", | |||||
| default=None, | default=None, | ||||
| ) | ) | ||||
| SMTP_PASSWORD: Optional[str] = Field( | SMTP_PASSWORD: Optional[str] = Field( | ||||
| description="smtp server password", | |||||
| description="Password for SMTP authentication", | |||||
| default=None, | default=None, | ||||
| ) | ) | ||||
| SMTP_USE_TLS: bool = Field( | SMTP_USE_TLS: bool = Field( | ||||
| description="whether to use TLS connection to smtp server", | |||||
| description="Enable TLS encryption for SMTP connections", | |||||
| default=False, | default=False, | ||||
| ) | ) | ||||
| SMTP_OPPORTUNISTIC_TLS: bool = Field( | SMTP_OPPORTUNISTIC_TLS: bool = Field( | ||||
| description="whether to use opportunistic TLS connection to smtp server", | |||||
| description="Enable opportunistic TLS for SMTP connections", | |||||
| default=False, | default=False, | ||||
| ) | ) | ||||
| class RagEtlConfig(BaseSettings): | class RagEtlConfig(BaseSettings): | ||||
| """ | """ | ||||
| RAG ETL Configurations. | |||||
| Configuration for RAG ETL processes | |||||
| """ | """ | ||||
| ETL_TYPE: str = Field( | ETL_TYPE: str = Field( | ||||
| description="RAG ETL type name, default to `dify`, available values are `dify` and `Unstructured`. ", | |||||
| description="RAG ETL type ('dify' or 'Unstructured'), default to 'dify'", | |||||
| default="dify", | default="dify", | ||||
| ) | ) | ||||
| KEYWORD_DATA_SOURCE_TYPE: str = Field( | KEYWORD_DATA_SOURCE_TYPE: str = Field( | ||||
| description="source type for keyword data, default to `database`, available values are `database` .", | |||||
| description="Data source type for keyword extraction" | |||||
| " ('database' or other supported types), default to 'database'", | |||||
| default="database", | default="database", | ||||
| ) | ) | ||||
| UNSTRUCTURED_API_URL: Optional[str] = Field( | UNSTRUCTURED_API_URL: Optional[str] = Field( | ||||
| description="API URL for Unstructured", | |||||
| description="API URL for Unstructured.io service", | |||||
| default=None, | default=None, | ||||
| ) | ) | ||||
| UNSTRUCTURED_API_KEY: Optional[str] = Field( | UNSTRUCTURED_API_KEY: Optional[str] = Field( | ||||
| description="API key for Unstructured", | |||||
| description="API key for Unstructured.io service", | |||||
| default=None, | default=None, | ||||
| ) | ) | ||||
| class DataSetConfig(BaseSettings): | class DataSetConfig(BaseSettings): | ||||
| """ | """ | ||||
| Dataset configs | |||||
| Configuration for dataset management | |||||
| """ | """ | ||||
| CLEAN_DAY_SETTING: PositiveInt = Field( | CLEAN_DAY_SETTING: PositiveInt = Field( | ||||
| description="interval in days for cleaning up dataset", | |||||
| description="Interval in days for dataset cleanup operations", | |||||
| default=30, | default=30, | ||||
| ) | ) | ||||
| DATASET_OPERATOR_ENABLED: bool = Field( | DATASET_OPERATOR_ENABLED: bool = Field( | ||||
| description="whether to enable dataset operator", | |||||
| description="Enable or disable dataset operator functionality", | |||||
| default=False, | default=False, | ||||
| ) | ) | ||||
| class WorkspaceConfig(BaseSettings): | class WorkspaceConfig(BaseSettings): | ||||
| """ | """ | ||||
| Workspace configs | |||||
| Configuration for workspace management | |||||
| """ | """ | ||||
| INVITE_EXPIRY_HOURS: PositiveInt = Field( | INVITE_EXPIRY_HOURS: PositiveInt = Field( | ||||
| description="workspaces invitation expiration in hours", | |||||
| description="Expiration time in hours for workspace invitation links", | |||||
| default=72, | default=72, | ||||
| ) | ) | ||||
| class IndexingConfig(BaseSettings): | class IndexingConfig(BaseSettings): | ||||
| """ | """ | ||||
| Indexing configs. | |||||
| Configuration for indexing operations | |||||
| """ | """ | ||||
| INDEXING_MAX_SEGMENTATION_TOKENS_LENGTH: PositiveInt = Field( | INDEXING_MAX_SEGMENTATION_TOKENS_LENGTH: PositiveInt = Field( | ||||
| description="max segmentation token length for indexing", | |||||
| description="Maximum token length for text segmentation during indexing", | |||||
| default=1000, | default=1000, | ||||
| ) | ) | ||||
| class ImageFormatConfig(BaseSettings): | class ImageFormatConfig(BaseSettings): | ||||
| MULTIMODAL_SEND_IMAGE_FORMAT: str = Field( | MULTIMODAL_SEND_IMAGE_FORMAT: str = Field( | ||||
| description="multi model send image format, support base64, url, default is base64", | |||||
| description="Format for sending images in multimodal contexts ('base64' or 'url'), default is base64", | |||||
| default="base64", | default="base64", | ||||
| ) | ) | ||||
| class CeleryBeatConfig(BaseSettings): | class CeleryBeatConfig(BaseSettings): | ||||
| CELERY_BEAT_SCHEDULER_TIME: int = Field( | CELERY_BEAT_SCHEDULER_TIME: int = Field( | ||||
| description="the time of the celery scheduler, default to 1 day", | |||||
| description="Interval in days for Celery Beat scheduler execution, default to 1 day", | |||||
| default=1, | default=1, | ||||
| ) | ) | ||||
| class PositionConfig(BaseSettings): | class PositionConfig(BaseSettings): | ||||
| POSITION_PROVIDER_PINS: str = Field( | POSITION_PROVIDER_PINS: str = Field( | ||||
| description="The heads of model providers", | |||||
| description="Comma-separated list of pinned model providers", | |||||
| default="", | default="", | ||||
| ) | ) | ||||
| POSITION_PROVIDER_INCLUDES: str = Field( | POSITION_PROVIDER_INCLUDES: str = Field( | ||||
| description="The included model providers", | |||||
| description="Comma-separated list of included model providers", | |||||
| default="", | default="", | ||||
| ) | ) | ||||
| POSITION_PROVIDER_EXCLUDES: str = Field( | POSITION_PROVIDER_EXCLUDES: str = Field( | ||||
| description="The excluded model providers", | |||||
| description="Comma-separated list of excluded model providers", | |||||
| default="", | default="", | ||||
| ) | ) | ||||
| POSITION_TOOL_PINS: str = Field( | POSITION_TOOL_PINS: str = Field( | ||||
| description="The heads of tools", | |||||
| description="Comma-separated list of pinned tools", | |||||
| default="", | default="", | ||||
| ) | ) | ||||
| POSITION_TOOL_INCLUDES: str = Field( | POSITION_TOOL_INCLUDES: str = Field( | ||||
| description="The included tools", | |||||
| description="Comma-separated list of included tools", | |||||
| default="", | default="", | ||||
| ) | ) | ||||
| POSITION_TOOL_EXCLUDES: str = Field( | POSITION_TOOL_EXCLUDES: str = Field( | ||||
| description="The excluded tools", | |||||
| description="Comma-separated list of excluded tools", | |||||
| default="", | default="", | ||||
| ) | ) | ||||
| class HostedOpenAiConfig(BaseSettings): | class HostedOpenAiConfig(BaseSettings): | ||||
| """ | """ | ||||
| Hosted OpenAI service config | |||||
| Configuration for hosted OpenAI service | |||||
| """ | """ | ||||
| HOSTED_OPENAI_API_KEY: Optional[str] = Field( | HOSTED_OPENAI_API_KEY: Optional[str] = Field( | ||||
| description="", | |||||
| description="API key for hosted OpenAI service", | |||||
| default=None, | default=None, | ||||
| ) | ) | ||||
| HOSTED_OPENAI_API_BASE: Optional[str] = Field( | HOSTED_OPENAI_API_BASE: Optional[str] = Field( | ||||
| description="", | |||||
| description="Base URL for hosted OpenAI API", | |||||
| default=None, | default=None, | ||||
| ) | ) | ||||
| HOSTED_OPENAI_API_ORGANIZATION: Optional[str] = Field( | HOSTED_OPENAI_API_ORGANIZATION: Optional[str] = Field( | ||||
| description="", | |||||
| description="Organization ID for hosted OpenAI service", | |||||
| default=None, | default=None, | ||||
| ) | ) | ||||
| HOSTED_OPENAI_TRIAL_ENABLED: bool = Field( | HOSTED_OPENAI_TRIAL_ENABLED: bool = Field( | ||||
| description="", | |||||
| description="Enable trial access to hosted OpenAI service", | |||||
| default=False, | default=False, | ||||
| ) | ) | ||||
| HOSTED_OPENAI_TRIAL_MODELS: str = Field( | HOSTED_OPENAI_TRIAL_MODELS: str = Field( | ||||
| description="", | |||||
| description="Comma-separated list of available models for trial access", | |||||
| default="gpt-3.5-turbo," | default="gpt-3.5-turbo," | ||||
| "gpt-3.5-turbo-1106," | "gpt-3.5-turbo-1106," | ||||
| "gpt-3.5-turbo-instruct," | "gpt-3.5-turbo-instruct," | ||||
| ) | ) | ||||
| HOSTED_OPENAI_QUOTA_LIMIT: NonNegativeInt = Field( | HOSTED_OPENAI_QUOTA_LIMIT: NonNegativeInt = Field( | ||||
| description="", | |||||
| description="Quota limit for hosted OpenAI service usage", | |||||
| default=200, | default=200, | ||||
| ) | ) | ||||
| HOSTED_OPENAI_PAID_ENABLED: bool = Field( | HOSTED_OPENAI_PAID_ENABLED: bool = Field( | ||||
| description="", | |||||
| description="Enable paid access to hosted OpenAI service", | |||||
| default=False, | default=False, | ||||
| ) | ) | ||||
| HOSTED_OPENAI_PAID_MODELS: str = Field( | HOSTED_OPENAI_PAID_MODELS: str = Field( | ||||
| description="", | |||||
| description="Comma-separated list of available models for paid access", | |||||
| default="gpt-4," | default="gpt-4," | ||||
| "gpt-4-turbo-preview," | "gpt-4-turbo-preview," | ||||
| "gpt-4-turbo-2024-04-09," | "gpt-4-turbo-2024-04-09," | ||||
| class HostedAzureOpenAiConfig(BaseSettings): | class HostedAzureOpenAiConfig(BaseSettings): | ||||
| """ | """ | ||||
| Hosted OpenAI service config | |||||
| Configuration for hosted Azure OpenAI service | |||||
| """ | """ | ||||
| HOSTED_AZURE_OPENAI_ENABLED: bool = Field( | HOSTED_AZURE_OPENAI_ENABLED: bool = Field( | ||||
| description="", | |||||
| description="Enable hosted Azure OpenAI service", | |||||
| default=False, | default=False, | ||||
| ) | ) | ||||
| HOSTED_AZURE_OPENAI_API_KEY: Optional[str] = Field( | HOSTED_AZURE_OPENAI_API_KEY: Optional[str] = Field( | ||||
| description="", | |||||
| description="API key for hosted Azure OpenAI service", | |||||
| default=None, | default=None, | ||||
| ) | ) | ||||
| HOSTED_AZURE_OPENAI_API_BASE: Optional[str] = Field( | HOSTED_AZURE_OPENAI_API_BASE: Optional[str] = Field( | ||||
| description="", | |||||
| description="Base URL for hosted Azure OpenAI API", | |||||
| default=None, | default=None, | ||||
| ) | ) | ||||
| HOSTED_AZURE_OPENAI_QUOTA_LIMIT: NonNegativeInt = Field( | HOSTED_AZURE_OPENAI_QUOTA_LIMIT: NonNegativeInt = Field( | ||||
| description="", | |||||
| description="Quota limit for hosted Azure OpenAI service usage", | |||||
| default=200, | default=200, | ||||
| ) | ) | ||||
| class HostedAnthropicConfig(BaseSettings): | class HostedAnthropicConfig(BaseSettings): | ||||
| """ | """ | ||||
| Hosted Azure OpenAI service config | |||||
| Configuration for hosted Anthropic service | |||||
| """ | """ | ||||
| HOSTED_ANTHROPIC_API_BASE: Optional[str] = Field( | HOSTED_ANTHROPIC_API_BASE: Optional[str] = Field( | ||||
| description="", | |||||
| description="Base URL for hosted Anthropic API", | |||||
| default=None, | default=None, | ||||
| ) | ) | ||||
| HOSTED_ANTHROPIC_API_KEY: Optional[str] = Field( | HOSTED_ANTHROPIC_API_KEY: Optional[str] = Field( | ||||
| description="", | |||||
| description="API key for hosted Anthropic service", | |||||
| default=None, | default=None, | ||||
| ) | ) | ||||
| HOSTED_ANTHROPIC_TRIAL_ENABLED: bool = Field( | HOSTED_ANTHROPIC_TRIAL_ENABLED: bool = Field( | ||||
| description="", | |||||
| description="Enable trial access to hosted Anthropic service", | |||||
| default=False, | default=False, | ||||
| ) | ) | ||||
| HOSTED_ANTHROPIC_QUOTA_LIMIT: NonNegativeInt = Field( | HOSTED_ANTHROPIC_QUOTA_LIMIT: NonNegativeInt = Field( | ||||
| description="", | |||||
| description="Quota limit for hosted Anthropic service usage", | |||||
| default=600000, | default=600000, | ||||
| ) | ) | ||||
| HOSTED_ANTHROPIC_PAID_ENABLED: bool = Field( | HOSTED_ANTHROPIC_PAID_ENABLED: bool = Field( | ||||
| description="", | |||||
| description="Enable paid access to hosted Anthropic service", | |||||
| default=False, | default=False, | ||||
| ) | ) | ||||
| class HostedMinmaxConfig(BaseSettings): | class HostedMinmaxConfig(BaseSettings): | ||||
| """ | """ | ||||
| Hosted Minmax service config | |||||
| Configuration for hosted Minmax service | |||||
| """ | """ | ||||
| HOSTED_MINIMAX_ENABLED: bool = Field( | HOSTED_MINIMAX_ENABLED: bool = Field( | ||||
| description="", | |||||
| description="Enable hosted Minmax service", | |||||
| default=False, | default=False, | ||||
| ) | ) | ||||
| class HostedSparkConfig(BaseSettings): | class HostedSparkConfig(BaseSettings): | ||||
| """ | """ | ||||
| Hosted Spark service config | |||||
| Configuration for hosted Spark service | |||||
| """ | """ | ||||
| HOSTED_SPARK_ENABLED: bool = Field( | HOSTED_SPARK_ENABLED: bool = Field( | ||||
| description="", | |||||
| description="Enable hosted Spark service", | |||||
| default=False, | default=False, | ||||
| ) | ) | ||||
| class HostedZhipuAIConfig(BaseSettings): | class HostedZhipuAIConfig(BaseSettings): | ||||
| """ | """ | ||||
| Hosted Minmax service config | |||||
| Configuration for hosted ZhipuAI service | |||||
| """ | """ | ||||
| HOSTED_ZHIPUAI_ENABLED: bool = Field( | HOSTED_ZHIPUAI_ENABLED: bool = Field( | ||||
| description="", | |||||
| description="Enable hosted ZhipuAI service", | |||||
| default=False, | default=False, | ||||
| ) | ) | ||||
| class HostedModerationConfig(BaseSettings): | class HostedModerationConfig(BaseSettings): | ||||
| """ | """ | ||||
| Hosted Moderation service config | |||||
| Configuration for hosted Moderation service | |||||
| """ | """ | ||||
| HOSTED_MODERATION_ENABLED: bool = Field( | HOSTED_MODERATION_ENABLED: bool = Field( | ||||
| description="", | |||||
| description="Enable hosted Moderation service", | |||||
| default=False, | default=False, | ||||
| ) | ) | ||||
| HOSTED_MODERATION_PROVIDERS: str = Field( | HOSTED_MODERATION_PROVIDERS: str = Field( | ||||
| description="", | |||||
| description="Comma-separated list of moderation providers", | |||||
| default="", | default="", | ||||
| ) | ) | ||||
| class HostedFetchAppTemplateConfig(BaseSettings): | class HostedFetchAppTemplateConfig(BaseSettings): | ||||
| """ | """ | ||||
| Hosted Moderation service config | |||||
| Configuration for fetching app templates | |||||
| """ | """ | ||||
| HOSTED_FETCH_APP_TEMPLATES_MODE: str = Field( | HOSTED_FETCH_APP_TEMPLATES_MODE: str = Field( | ||||
| description="the mode for fetching app templates," | |||||
| " default to remote," | |||||
| " available values: remote, db, builtin", | |||||
| description="Mode for fetching app templates: remote, db, or builtin" " default to remote,", | |||||
| default="remote", | default="remote", | ||||
| ) | ) | ||||
| HOSTED_FETCH_APP_TEMPLATES_REMOTE_DOMAIN: str = Field( | HOSTED_FETCH_APP_TEMPLATES_REMOTE_DOMAIN: str = Field( | ||||
| description="the domain for fetching remote app templates", | |||||
| description="Domain for fetching remote app templates", | |||||
| default="https://tmpl.dify.ai", | default="https://tmpl.dify.ai", | ||||
| ) | ) | ||||
| class StorageConfig(BaseSettings): | class StorageConfig(BaseSettings): | ||||
| STORAGE_TYPE: str = Field( | STORAGE_TYPE: str = Field( | ||||
| description="storage type," | |||||
| " default to `local`," | |||||
| " available values are `local`, `s3`, `azure-blob`, `aliyun-oss`, `google-storage`.", | |||||
| description="Type of storage to use." | |||||
| " Options: 'local', 's3', 'azure-blob', 'aliyun-oss', 'google-storage'. Default is 'local'.", | |||||
| default="local", | default="local", | ||||
| ) | ) | ||||
| STORAGE_LOCAL_PATH: str = Field( | STORAGE_LOCAL_PATH: str = Field( | ||||
| description="local storage path", | |||||
| description="Path for local storage when STORAGE_TYPE is set to 'local'.", | |||||
| default="storage", | default="storage", | ||||
| ) | ) | ||||
| class VectorStoreConfig(BaseSettings): | class VectorStoreConfig(BaseSettings): | ||||
| VECTOR_STORE: Optional[str] = Field( | VECTOR_STORE: Optional[str] = Field( | ||||
| description="vector store type", | |||||
| description="Type of vector store to use for efficient similarity search." | |||||
| " Set to None if not using a vector store.", | |||||
| default=None, | default=None, | ||||
| ) | ) | ||||
| class KeywordStoreConfig(BaseSettings): | class KeywordStoreConfig(BaseSettings): | ||||
| KEYWORD_STORE: str = Field( | KEYWORD_STORE: str = Field( | ||||
| description="keyword store type", | |||||
| description="Method for keyword extraction and storage." | |||||
| " Default is 'jieba', a Chinese text segmentation library.", | |||||
| default="jieba", | default="jieba", | ||||
| ) | ) | ||||
| class DatabaseConfig: | class DatabaseConfig: | ||||
| DB_HOST: str = Field( | DB_HOST: str = Field( | ||||
| description="db host", | |||||
| description="Hostname or IP address of the database server.", | |||||
| default="localhost", | default="localhost", | ||||
| ) | ) | ||||
| DB_PORT: PositiveInt = Field( | DB_PORT: PositiveInt = Field( | ||||
| description="db port", | |||||
| description="Port number for database connection.", | |||||
| default=5432, | default=5432, | ||||
| ) | ) | ||||
| DB_USERNAME: str = Field( | DB_USERNAME: str = Field( | ||||
| description="db username", | |||||
| description="Username for database authentication.", | |||||
| default="postgres", | default="postgres", | ||||
| ) | ) | ||||
| DB_PASSWORD: str = Field( | DB_PASSWORD: str = Field( | ||||
| description="db password", | |||||
| description="Password for database authentication.", | |||||
| default="", | default="", | ||||
| ) | ) | ||||
| DB_DATABASE: str = Field( | DB_DATABASE: str = Field( | ||||
| description="db database", | |||||
| description="Name of the database to connect to.", | |||||
| default="dify", | default="dify", | ||||
| ) | ) | ||||
| DB_CHARSET: str = Field( | DB_CHARSET: str = Field( | ||||
| description="db charset", | |||||
| description="Character set for database connection.", | |||||
| default="", | default="", | ||||
| ) | ) | ||||
| DB_EXTRAS: str = Field( | DB_EXTRAS: str = Field( | ||||
| description="db extras options. Example: keepalives_idle=60&keepalives=1", | |||||
| description="Additional database connection parameters. Example: 'keepalives_idle=60&keepalives=1'", | |||||
| default="", | default="", | ||||
| ) | ) | ||||
| SQLALCHEMY_DATABASE_URI_SCHEME: str = Field( | SQLALCHEMY_DATABASE_URI_SCHEME: str = Field( | ||||
| description="db uri scheme", | |||||
| description="Database URI scheme for SQLAlchemy connection.", | |||||
| default="postgresql", | default="postgresql", | ||||
| ) | ) | ||||
| ) | ) | ||||
| SQLALCHEMY_POOL_SIZE: NonNegativeInt = Field( | SQLALCHEMY_POOL_SIZE: NonNegativeInt = Field( | ||||
| description="pool size of SqlAlchemy", | |||||
| description="Maximum number of database connections in the pool.", | |||||
| default=30, | default=30, | ||||
| ) | ) | ||||
| SQLALCHEMY_MAX_OVERFLOW: NonNegativeInt = Field( | SQLALCHEMY_MAX_OVERFLOW: NonNegativeInt = Field( | ||||
| description="max overflows for SqlAlchemy", | |||||
| description="Maximum number of connections that can be created beyond the pool_size.", | |||||
| default=10, | default=10, | ||||
| ) | ) | ||||
| SQLALCHEMY_POOL_RECYCLE: NonNegativeInt = Field( | SQLALCHEMY_POOL_RECYCLE: NonNegativeInt = Field( | ||||
| description="SqlAlchemy pool recycle", | |||||
| description="Number of seconds after which a connection is automatically recycled.", | |||||
| default=3600, | default=3600, | ||||
| ) | ) | ||||
| SQLALCHEMY_POOL_PRE_PING: bool = Field( | SQLALCHEMY_POOL_PRE_PING: bool = Field( | ||||
| description="whether to enable pool pre-ping in SqlAlchemy", | |||||
| description="If True, enables connection pool pre-ping feature to check connections.", | |||||
| default=False, | default=False, | ||||
| ) | ) | ||||
| SQLALCHEMY_ECHO: bool | str = Field( | SQLALCHEMY_ECHO: bool | str = Field( | ||||
| description="whether to enable SqlAlchemy echo", | |||||
| description="If True, SQLAlchemy will log all SQL statements.", | |||||
| default=False, | default=False, | ||||
| ) | ) | ||||
| class CeleryConfig(DatabaseConfig): | class CeleryConfig(DatabaseConfig): | ||||
| CELERY_BACKEND: str = Field( | CELERY_BACKEND: str = Field( | ||||
| description="Celery backend, available values are `database`, `redis`", | |||||
| description="Backend for Celery task results. Options: 'database', 'redis'.", | |||||
| default="database", | default="database", | ||||
| ) | ) | ||||
| CELERY_BROKER_URL: Optional[str] = Field( | CELERY_BROKER_URL: Optional[str] = Field( | ||||
| description="CELERY_BROKER_URL", | |||||
| description="URL of the message broker for Celery tasks.", | |||||
| default=None, | default=None, | ||||
| ) | ) | ||||
| CELERY_USE_SENTINEL: Optional[bool] = Field( | CELERY_USE_SENTINEL: Optional[bool] = Field( | ||||
| description="Whether to use Redis Sentinel mode", | |||||
| description="Whether to use Redis Sentinel for high availability.", | |||||
| default=False, | default=False, | ||||
| ) | ) | ||||
| CELERY_SENTINEL_MASTER_NAME: Optional[str] = Field( | CELERY_SENTINEL_MASTER_NAME: Optional[str] = Field( | ||||
| description="Redis Sentinel master name", | |||||
| description="Name of the Redis Sentinel master.", | |||||
| default=None, | default=None, | ||||
| ) | ) | ||||
| CELERY_SENTINEL_SOCKET_TIMEOUT: Optional[PositiveFloat] = Field( | CELERY_SENTINEL_SOCKET_TIMEOUT: Optional[PositiveFloat] = Field( | ||||
| description="Redis Sentinel socket timeout", | |||||
| description="Timeout for Redis Sentinel socket operations in seconds.", | |||||
| default=0.1, | default=0.1, | ||||
| ) | ) | ||||
| class RedisConfig(BaseSettings): | class RedisConfig(BaseSettings): | ||||
| """ | """ | ||||
| Redis configs | |||||
| Configuration settings for Redis connection | |||||
| """ | """ | ||||
| REDIS_HOST: str = Field( | REDIS_HOST: str = Field( | ||||
| description="Redis host", | |||||
| description="Hostname or IP address of the Redis server", | |||||
| default="localhost", | default="localhost", | ||||
| ) | ) | ||||
| REDIS_PORT: PositiveInt = Field( | REDIS_PORT: PositiveInt = Field( | ||||
| description="Redis port", | |||||
| description="Port number on which the Redis server is listening", | |||||
| default=6379, | default=6379, | ||||
| ) | ) | ||||
| REDIS_USERNAME: Optional[str] = Field( | REDIS_USERNAME: Optional[str] = Field( | ||||
| description="Redis username", | |||||
| description="Username for Redis authentication (if required)", | |||||
| default=None, | default=None, | ||||
| ) | ) | ||||
| REDIS_PASSWORD: Optional[str] = Field( | REDIS_PASSWORD: Optional[str] = Field( | ||||
| description="Redis password", | |||||
| description="Password for Redis authentication (if required)", | |||||
| default=None, | default=None, | ||||
| ) | ) | ||||
| REDIS_DB: NonNegativeInt = Field( | REDIS_DB: NonNegativeInt = Field( | ||||
| description="Redis database id, default to 0", | |||||
| description="Redis database number to use (0-15)", | |||||
| default=0, | default=0, | ||||
| ) | ) | ||||
| REDIS_USE_SSL: bool = Field( | REDIS_USE_SSL: bool = Field( | ||||
| description="whether to use SSL for Redis connection", | |||||
| description="Enable SSL/TLS for the Redis connection", | |||||
| default=False, | default=False, | ||||
| ) | ) | ||||
| REDIS_USE_SENTINEL: Optional[bool] = Field( | REDIS_USE_SENTINEL: Optional[bool] = Field( | ||||
| description="Whether to use Redis Sentinel mode", | |||||
| description="Enable Redis Sentinel mode for high availability", | |||||
| default=False, | default=False, | ||||
| ) | ) | ||||
| REDIS_SENTINELS: Optional[str] = Field( | REDIS_SENTINELS: Optional[str] = Field( | ||||
| description="Redis Sentinel nodes", | |||||
| description="Comma-separated list of Redis Sentinel nodes (host:port)", | |||||
| default=None, | default=None, | ||||
| ) | ) | ||||
| REDIS_SENTINEL_SERVICE_NAME: Optional[str] = Field( | REDIS_SENTINEL_SERVICE_NAME: Optional[str] = Field( | ||||
| description="Redis Sentinel service name", | |||||
| description="Name of the Redis Sentinel service to monitor", | |||||
| default=None, | default=None, | ||||
| ) | ) | ||||
| REDIS_SENTINEL_USERNAME: Optional[str] = Field( | REDIS_SENTINEL_USERNAME: Optional[str] = Field( | ||||
| description="Redis Sentinel username", | |||||
| description="Username for Redis Sentinel authentication (if required)", | |||||
| default=None, | default=None, | ||||
| ) | ) | ||||
| REDIS_SENTINEL_PASSWORD: Optional[str] = Field( | REDIS_SENTINEL_PASSWORD: Optional[str] = Field( | ||||
| description="Redis Sentinel password", | |||||
| description="Password for Redis Sentinel authentication (if required)", | |||||
| default=None, | default=None, | ||||
| ) | ) | ||||
| REDIS_SENTINEL_SOCKET_TIMEOUT: Optional[PositiveFloat] = Field( | REDIS_SENTINEL_SOCKET_TIMEOUT: Optional[PositiveFloat] = Field( | ||||
| description="Redis Sentinel socket timeout", | |||||
| description="Socket timeout in seconds for Redis Sentinel connections", | |||||
| default=0.1, | default=0.1, | ||||
| ) | ) |
| class AliyunOSSStorageConfig(BaseSettings): | class AliyunOSSStorageConfig(BaseSettings): | ||||
| """ | """ | ||||
| Aliyun storage configs | |||||
| Configuration settings for Aliyun Object Storage Service (OSS) | |||||
| """ | """ | ||||
| ALIYUN_OSS_BUCKET_NAME: Optional[str] = Field( | ALIYUN_OSS_BUCKET_NAME: Optional[str] = Field( | ||||
| description="Aliyun OSS bucket name", | |||||
| description="Name of the Aliyun OSS bucket to store and retrieve objects", | |||||
| default=None, | default=None, | ||||
| ) | ) | ||||
| ALIYUN_OSS_ACCESS_KEY: Optional[str] = Field( | ALIYUN_OSS_ACCESS_KEY: Optional[str] = Field( | ||||
| description="Aliyun OSS access key", | |||||
| description="Access key ID for authenticating with Aliyun OSS", | |||||
| default=None, | default=None, | ||||
| ) | ) | ||||
| ALIYUN_OSS_SECRET_KEY: Optional[str] = Field( | ALIYUN_OSS_SECRET_KEY: Optional[str] = Field( | ||||
| description="Aliyun OSS secret key", | |||||
| description="Secret access key for authenticating with Aliyun OSS", | |||||
| default=None, | default=None, | ||||
| ) | ) | ||||
| ALIYUN_OSS_ENDPOINT: Optional[str] = Field( | ALIYUN_OSS_ENDPOINT: Optional[str] = Field( | ||||
| description="Aliyun OSS endpoint URL", | |||||
| description="URL of the Aliyun OSS endpoint for your chosen region", | |||||
| default=None, | default=None, | ||||
| ) | ) | ||||
| ALIYUN_OSS_REGION: Optional[str] = Field( | ALIYUN_OSS_REGION: Optional[str] = Field( | ||||
| description="Aliyun OSS region", | |||||
| description="Aliyun OSS region where your bucket is located (e.g., 'oss-cn-hangzhou')", | |||||
| default=None, | default=None, | ||||
| ) | ) | ||||
| ALIYUN_OSS_AUTH_VERSION: Optional[str] = Field( | ALIYUN_OSS_AUTH_VERSION: Optional[str] = Field( | ||||
| description="Aliyun OSS authentication version", | |||||
| description="Version of the authentication protocol to use with Aliyun OSS (e.g., 'v4')", | |||||
| default=None, | default=None, | ||||
| ) | ) | ||||
| ALIYUN_OSS_PATH: Optional[str] = Field( | ALIYUN_OSS_PATH: Optional[str] = Field( | ||||
| description="Aliyun OSS path", | |||||
| description="Base path within the bucket to store objects (e.g., 'my-app-data/')", | |||||
| default=None, | default=None, | ||||
| ) | ) |
| class S3StorageConfig(BaseSettings): | class S3StorageConfig(BaseSettings): | ||||
| """ | """ | ||||
| S3 storage configs | |||||
| Configuration settings for S3-compatible object storage | |||||
| """ | """ | ||||
| S3_ENDPOINT: Optional[str] = Field( | S3_ENDPOINT: Optional[str] = Field( | ||||
| description="S3 storage endpoint", | |||||
| description="URL of the S3-compatible storage endpoint (e.g., 'https://s3.amazonaws.com')", | |||||
| default=None, | default=None, | ||||
| ) | ) | ||||
| S3_REGION: Optional[str] = Field( | S3_REGION: Optional[str] = Field( | ||||
| description="S3 storage region", | |||||
| description="Region where the S3 bucket is located (e.g., 'us-east-1')", | |||||
| default=None, | default=None, | ||||
| ) | ) | ||||
| S3_BUCKET_NAME: Optional[str] = Field( | S3_BUCKET_NAME: Optional[str] = Field( | ||||
| description="S3 storage bucket name", | |||||
| description="Name of the S3 bucket to store and retrieve objects", | |||||
| default=None, | default=None, | ||||
| ) | ) | ||||
| S3_ACCESS_KEY: Optional[str] = Field( | S3_ACCESS_KEY: Optional[str] = Field( | ||||
| description="S3 storage access key", | |||||
| description="Access key ID for authenticating with the S3 service", | |||||
| default=None, | default=None, | ||||
| ) | ) | ||||
| S3_SECRET_KEY: Optional[str] = Field( | S3_SECRET_KEY: Optional[str] = Field( | ||||
| description="S3 storage secret key", | |||||
| description="Secret access key for authenticating with the S3 service", | |||||
| default=None, | default=None, | ||||
| ) | ) | ||||
| S3_ADDRESS_STYLE: str = Field( | S3_ADDRESS_STYLE: str = Field( | ||||
| description="S3 storage address style", | |||||
| description="S3 addressing style: 'auto', 'path', or 'virtual'", | |||||
| default="auto", | default="auto", | ||||
| ) | ) | ||||
| S3_USE_AWS_MANAGED_IAM: bool = Field( | S3_USE_AWS_MANAGED_IAM: bool = Field( | ||||
| description="whether to use aws managed IAM for S3", | |||||
| description="Use AWS managed IAM roles for authentication instead of access/secret keys", | |||||
| default=False, | default=False, | ||||
| ) | ) |
| class AzureBlobStorageConfig(BaseSettings): | class AzureBlobStorageConfig(BaseSettings): | ||||
| """ | """ | ||||
| Azure Blob storage configs | |||||
| Configuration settings for Azure Blob Storage | |||||
| """ | """ | ||||
| AZURE_BLOB_ACCOUNT_NAME: Optional[str] = Field( | AZURE_BLOB_ACCOUNT_NAME: Optional[str] = Field( | ||||
| description="Azure Blob account name", | |||||
| description="Name of the Azure Storage account (e.g., 'mystorageaccount')", | |||||
| default=None, | default=None, | ||||
| ) | ) | ||||
| AZURE_BLOB_ACCOUNT_KEY: Optional[str] = Field( | AZURE_BLOB_ACCOUNT_KEY: Optional[str] = Field( | ||||
| description="Azure Blob account key", | |||||
| description="Access key for authenticating with the Azure Storage account", | |||||
| default=None, | default=None, | ||||
| ) | ) | ||||
| AZURE_BLOB_CONTAINER_NAME: Optional[str] = Field( | AZURE_BLOB_CONTAINER_NAME: Optional[str] = Field( | ||||
| description="Azure Blob container name", | |||||
| description="Name of the Azure Blob container to store and retrieve objects", | |||||
| default=None, | default=None, | ||||
| ) | ) | ||||
| AZURE_BLOB_ACCOUNT_URL: Optional[str] = Field( | AZURE_BLOB_ACCOUNT_URL: Optional[str] = Field( | ||||
| description="Azure Blob account URL", | |||||
| description="URL of the Azure Blob storage endpoint (e.g., 'https://mystorageaccount.blob.core.windows.net')", | |||||
| default=None, | default=None, | ||||
| ) | ) |
| class GoogleCloudStorageConfig(BaseSettings): | class GoogleCloudStorageConfig(BaseSettings): | ||||
| """ | """ | ||||
| Google Cloud storage configs | |||||
| Configuration settings for Google Cloud Storage | |||||
| """ | """ | ||||
| GOOGLE_STORAGE_BUCKET_NAME: Optional[str] = Field( | GOOGLE_STORAGE_BUCKET_NAME: Optional[str] = Field( | ||||
| description="Google Cloud storage bucket name", | |||||
| description="Name of the Google Cloud Storage bucket to store and retrieve objects (e.g., 'my-gcs-bucket')", | |||||
| default=None, | default=None, | ||||
| ) | ) | ||||
| GOOGLE_STORAGE_SERVICE_ACCOUNT_JSON_BASE64: Optional[str] = Field( | GOOGLE_STORAGE_SERVICE_ACCOUNT_JSON_BASE64: Optional[str] = Field( | ||||
| description="Google Cloud storage service account json base64", | |||||
| description="Base64-encoded JSON key file for Google Cloud service account authentication", | |||||
| default=None, | default=None, | ||||
| ) | ) |
| class HuaweiCloudOBSStorageConfig(BaseModel): | class HuaweiCloudOBSStorageConfig(BaseModel): | ||||
| """ | """ | ||||
| Huawei Cloud OBS storage configs | |||||
| Configuration settings for Huawei Cloud Object Storage Service (OBS) | |||||
| """ | """ | ||||
| HUAWEI_OBS_BUCKET_NAME: Optional[str] = Field( | HUAWEI_OBS_BUCKET_NAME: Optional[str] = Field( | ||||
| description="Huawei Cloud OBS bucket name", | |||||
| description="Name of the Huawei Cloud OBS bucket to store and retrieve objects (e.g., 'my-obs-bucket')", | |||||
| default=None, | default=None, | ||||
| ) | ) | ||||
| HUAWEI_OBS_ACCESS_KEY: Optional[str] = Field( | HUAWEI_OBS_ACCESS_KEY: Optional[str] = Field( | ||||
| description="Huawei Cloud OBS Access key", | |||||
| description="Access Key ID for authenticating with Huawei Cloud OBS", | |||||
| default=None, | default=None, | ||||
| ) | ) | ||||
| HUAWEI_OBS_SECRET_KEY: Optional[str] = Field( | HUAWEI_OBS_SECRET_KEY: Optional[str] = Field( | ||||
| description="Huawei Cloud OBS Secret key", | |||||
| description="Secret Access Key for authenticating with Huawei Cloud OBS", | |||||
| default=None, | default=None, | ||||
| ) | ) | ||||
| HUAWEI_OBS_SERVER: Optional[str] = Field( | HUAWEI_OBS_SERVER: Optional[str] = Field( | ||||
| description="Huawei Cloud OBS server URL", | |||||
| description="Endpoint URL for Huawei Cloud OBS (e.g., 'https://obs.cn-north-4.myhuaweicloud.com')", | |||||
| default=None, | default=None, | ||||
| ) | ) |
| class OCIStorageConfig(BaseSettings): | class OCIStorageConfig(BaseSettings): | ||||
| """ | """ | ||||
| OCI storage configs | |||||
| Configuration settings for Oracle Cloud Infrastructure (OCI) Object Storage | |||||
| """ | """ | ||||
| OCI_ENDPOINT: Optional[str] = Field( | OCI_ENDPOINT: Optional[str] = Field( | ||||
| description="OCI storage endpoint", | |||||
| description="URL of the OCI Object Storage endpoint (e.g., 'https://objectstorage.us-phoenix-1.oraclecloud.com')", | |||||
| default=None, | default=None, | ||||
| ) | ) | ||||
| OCI_REGION: Optional[str] = Field( | OCI_REGION: Optional[str] = Field( | ||||
| description="OCI storage region", | |||||
| description="OCI region where the bucket is located (e.g., 'us-phoenix-1')", | |||||
| default=None, | default=None, | ||||
| ) | ) | ||||
| OCI_BUCKET_NAME: Optional[str] = Field( | OCI_BUCKET_NAME: Optional[str] = Field( | ||||
| description="OCI storage bucket name", | |||||
| description="Name of the OCI Object Storage bucket to store and retrieve objects (e.g., 'my-oci-bucket')", | |||||
| default=None, | default=None, | ||||
| ) | ) | ||||
| OCI_ACCESS_KEY: Optional[str] = Field( | OCI_ACCESS_KEY: Optional[str] = Field( | ||||
| description="OCI storage access key", | |||||
| description="Access key (also known as API key) for authenticating with OCI Object Storage", | |||||
| default=None, | default=None, | ||||
| ) | ) | ||||
| OCI_SECRET_KEY: Optional[str] = Field( | OCI_SECRET_KEY: Optional[str] = Field( | ||||
| description="OCI storage secret key", | |||||
| description="Secret key associated with the access key for authenticating with OCI Object Storage", | |||||
| default=None, | default=None, | ||||
| ) | ) |
| class TencentCloudCOSStorageConfig(BaseSettings): | class TencentCloudCOSStorageConfig(BaseSettings): | ||||
| """ | """ | ||||
| Tencent Cloud COS storage configs | |||||
| Configuration settings for Tencent Cloud Object Storage (COS) | |||||
| """ | """ | ||||
| TENCENT_COS_BUCKET_NAME: Optional[str] = Field( | TENCENT_COS_BUCKET_NAME: Optional[str] = Field( | ||||
| description="Tencent Cloud COS bucket name", | |||||
| description="Name of the Tencent Cloud COS bucket to store and retrieve objects", | |||||
| default=None, | default=None, | ||||
| ) | ) | ||||
| TENCENT_COS_REGION: Optional[str] = Field( | TENCENT_COS_REGION: Optional[str] = Field( | ||||
| description="Tencent Cloud COS region", | |||||
| description="Tencent Cloud region where the COS bucket is located (e.g., 'ap-guangzhou')", | |||||
| default=None, | default=None, | ||||
| ) | ) | ||||
| TENCENT_COS_SECRET_ID: Optional[str] = Field( | TENCENT_COS_SECRET_ID: Optional[str] = Field( | ||||
| description="Tencent Cloud COS secret id", | |||||
| description="SecretId for authenticating with Tencent Cloud COS (part of API credentials)", | |||||
| default=None, | default=None, | ||||
| ) | ) | ||||
| TENCENT_COS_SECRET_KEY: Optional[str] = Field( | TENCENT_COS_SECRET_KEY: Optional[str] = Field( | ||||
| description="Tencent Cloud COS secret key", | |||||
| description="SecretKey for authenticating with Tencent Cloud COS (part of API credentials)", | |||||
| default=None, | default=None, | ||||
| ) | ) | ||||
| TENCENT_COS_SCHEME: Optional[str] = Field( | TENCENT_COS_SCHEME: Optional[str] = Field( | ||||
| description="Tencent Cloud COS scheme", | |||||
| description="Protocol scheme for COS requests: 'https' (recommended) or 'http'", | |||||
| default=None, | default=None, | ||||
| ) | ) |
| class VolcengineTOSStorageConfig(BaseModel): | class VolcengineTOSStorageConfig(BaseModel): | ||||
| """ | """ | ||||
| Volcengine tos storage configs | |||||
| Configuration settings for Volcengine Tinder Object Storage (TOS) | |||||
| """ | """ | ||||
| VOLCENGINE_TOS_BUCKET_NAME: Optional[str] = Field( | VOLCENGINE_TOS_BUCKET_NAME: Optional[str] = Field( | ||||
| description="Volcengine TOS Bucket Name", | |||||
| description="Name of the Volcengine TOS bucket to store and retrieve objects (e.g., 'my-tos-bucket')", | |||||
| default=None, | default=None, | ||||
| ) | ) | ||||
| VOLCENGINE_TOS_ACCESS_KEY: Optional[str] = Field( | VOLCENGINE_TOS_ACCESS_KEY: Optional[str] = Field( | ||||
| description="Volcengine TOS Access Key", | |||||
| description="Access Key ID for authenticating with Volcengine TOS", | |||||
| default=None, | default=None, | ||||
| ) | ) | ||||
| VOLCENGINE_TOS_SECRET_KEY: Optional[str] = Field( | VOLCENGINE_TOS_SECRET_KEY: Optional[str] = Field( | ||||
| description="Volcengine TOS Secret Key", | |||||
| description="Secret Access Key for authenticating with Volcengine TOS", | |||||
| default=None, | default=None, | ||||
| ) | ) | ||||
| VOLCENGINE_TOS_ENDPOINT: Optional[str] = Field( | VOLCENGINE_TOS_ENDPOINT: Optional[str] = Field( | ||||
| description="Volcengine TOS Endpoint URL", | |||||
| description="URL of the Volcengine TOS endpoint (e.g., 'https://tos-cn-beijing.volces.com')", | |||||
| default=None, | default=None, | ||||
| ) | ) | ||||
| VOLCENGINE_TOS_REGION: Optional[str] = Field( | VOLCENGINE_TOS_REGION: Optional[str] = Field( | ||||
| description="Volcengine TOS Region", | |||||
| description="Volcengine region where the TOS bucket is located (e.g., 'cn-beijing')", | |||||
| default=None, | default=None, | ||||
| ) | ) |
| class AnalyticdbConfig(BaseModel): | class AnalyticdbConfig(BaseModel): | ||||
| """ | """ | ||||
| Configuration for connecting to AnalyticDB. | |||||
| Configuration for connecting to Alibaba Cloud AnalyticDB for PostgreSQL. | |||||
| Refer to the following documentation for details on obtaining credentials: | Refer to the following documentation for details on obtaining credentials: | ||||
| https://www.alibabacloud.com/help/en/analyticdb-for-postgresql/getting-started/create-an-instance-instances-with-vector-engine-optimization-enabled | https://www.alibabacloud.com/help/en/analyticdb-for-postgresql/getting-started/create-an-instance-instances-with-vector-engine-optimization-enabled | ||||
| """ | """ | ||||
| ANALYTICDB_KEY_ID: Optional[str] = Field( | ANALYTICDB_KEY_ID: Optional[str] = Field( | ||||
| default=None, description="The Access Key ID provided by Alibaba Cloud for authentication." | |||||
| default=None, description="The Access Key ID provided by Alibaba Cloud for API authentication." | |||||
| ) | ) | ||||
| ANALYTICDB_KEY_SECRET: Optional[str] = Field( | ANALYTICDB_KEY_SECRET: Optional[str] = Field( | ||||
| default=None, description="The Secret Access Key corresponding to the Access Key ID for secure access." | |||||
| default=None, description="The Secret Access Key corresponding to the Access Key ID for secure API access." | |||||
| ) | ) | ||||
| ANALYTICDB_REGION_ID: Optional[str] = Field( | ANALYTICDB_REGION_ID: Optional[str] = Field( | ||||
| default=None, description="The region where the AnalyticDB instance is deployed (e.g., 'cn-hangzhou')." | |||||
| default=None, | |||||
| description="The region where the AnalyticDB instance is deployed (e.g., 'cn-hangzhou', 'ap-southeast-1').", | |||||
| ) | ) | ||||
| ANALYTICDB_INSTANCE_ID: Optional[str] = Field( | ANALYTICDB_INSTANCE_ID: Optional[str] = Field( | ||||
| default=None, | default=None, | ||||
| description="The unique identifier of the AnalyticDB instance you want to connect to (e.g., 'gp-ab123456')..", | |||||
| description="The unique identifier of the AnalyticDB instance you want to connect to.", | |||||
| ) | ) | ||||
| ANALYTICDB_ACCOUNT: Optional[str] = Field( | ANALYTICDB_ACCOUNT: Optional[str] = Field( | ||||
| default=None, description="The account name used to log in to the AnalyticDB instance." | |||||
| default=None, | |||||
| description="The account name used to log in to the AnalyticDB instance" | |||||
| " (usually the initial account created with the instance).", | |||||
| ) | ) | ||||
| ANALYTICDB_PASSWORD: Optional[str] = Field( | ANALYTICDB_PASSWORD: Optional[str] = Field( | ||||
| default=None, description="The password associated with the AnalyticDB account for authentication." | |||||
| default=None, description="The password associated with the AnalyticDB account for database authentication." | |||||
| ) | ) | ||||
| ANALYTICDB_NAMESPACE: Optional[str] = Field( | ANALYTICDB_NAMESPACE: Optional[str] = Field( | ||||
| default=None, description="The namespace within AnalyticDB for schema isolation." | |||||
| default=None, description="The namespace within AnalyticDB for schema isolation (if using namespace feature)." | |||||
| ) | ) | ||||
| ANALYTICDB_NAMESPACE_PASSWORD: Optional[str] = Field( | ANALYTICDB_NAMESPACE_PASSWORD: Optional[str] = Field( | ||||
| default=None, description="The password for accessing the specified namespace within the AnalyticDB instance." | |||||
| default=None, | |||||
| description="The password for accessing the specified namespace within the AnalyticDB instance" | |||||
| " (if namespace feature is enabled).", | |||||
| ) | ) |
| class ChromaConfig(BaseSettings): | class ChromaConfig(BaseSettings): | ||||
| """ | """ | ||||
| Chroma configs | |||||
| Configuration settings for Chroma vector database | |||||
| """ | """ | ||||
| CHROMA_HOST: Optional[str] = Field( | CHROMA_HOST: Optional[str] = Field( | ||||
| description="Chroma host", | |||||
| description="Hostname or IP address of the Chroma server (e.g., 'localhost' or '192.168.1.100')", | |||||
| default=None, | default=None, | ||||
| ) | ) | ||||
| CHROMA_PORT: PositiveInt = Field( | CHROMA_PORT: PositiveInt = Field( | ||||
| description="Chroma port", | |||||
| description="Port number on which the Chroma server is listening (default is 8000)", | |||||
| default=8000, | default=8000, | ||||
| ) | ) | ||||
| CHROMA_TENANT: Optional[str] = Field( | CHROMA_TENANT: Optional[str] = Field( | ||||
| description="Chroma database", | |||||
| description="Tenant identifier for multi-tenancy support in Chroma", | |||||
| default=None, | default=None, | ||||
| ) | ) | ||||
| CHROMA_DATABASE: Optional[str] = Field( | CHROMA_DATABASE: Optional[str] = Field( | ||||
| description="Chroma database", | |||||
| description="Name of the Chroma database to connect to", | |||||
| default=None, | default=None, | ||||
| ) | ) | ||||
| CHROMA_AUTH_PROVIDER: Optional[str] = Field( | CHROMA_AUTH_PROVIDER: Optional[str] = Field( | ||||
| description="Chroma authentication provider", | |||||
| description="Authentication provider for Chroma (e.g., 'basic', 'token', or a custom provider)", | |||||
| default=None, | default=None, | ||||
| ) | ) | ||||
| CHROMA_AUTH_CREDENTIALS: Optional[str] = Field( | CHROMA_AUTH_CREDENTIALS: Optional[str] = Field( | ||||
| description="Chroma authentication credentials", | |||||
| description="Authentication credentials for Chroma (format depends on the auth provider)", | |||||
| default=None, | default=None, | ||||
| ) | ) |
| class ElasticsearchConfig(BaseSettings): | class ElasticsearchConfig(BaseSettings): | ||||
| """ | """ | ||||
| Elasticsearch configs | |||||
| Configuration settings for Elasticsearch | |||||
| """ | """ | ||||
| ELASTICSEARCH_HOST: Optional[str] = Field( | ELASTICSEARCH_HOST: Optional[str] = Field( | ||||
| description="Elasticsearch host", | |||||
| description="Hostname or IP address of the Elasticsearch server (e.g., 'localhost' or '192.168.1.100')", | |||||
| default="127.0.0.1", | default="127.0.0.1", | ||||
| ) | ) | ||||
| ELASTICSEARCH_PORT: PositiveInt = Field( | ELASTICSEARCH_PORT: PositiveInt = Field( | ||||
| description="Elasticsearch port", | |||||
| description="Port number on which the Elasticsearch server is listening (default is 9200)", | |||||
| default=9200, | default=9200, | ||||
| ) | ) | ||||
| ELASTICSEARCH_USERNAME: Optional[str] = Field( | ELASTICSEARCH_USERNAME: Optional[str] = Field( | ||||
| description="Elasticsearch username", | |||||
| description="Username for authenticating with Elasticsearch (default is 'elastic')", | |||||
| default="elastic", | default="elastic", | ||||
| ) | ) | ||||
| ELASTICSEARCH_PASSWORD: Optional[str] = Field( | ELASTICSEARCH_PASSWORD: Optional[str] = Field( | ||||
| description="Elasticsearch password", | |||||
| description="Password for authenticating with Elasticsearch (default is 'elastic')", | |||||
| default="elastic", | default="elastic", | ||||
| ) | ) |
| class MilvusConfig(BaseSettings): | class MilvusConfig(BaseSettings): | ||||
| """ | """ | ||||
| Milvus configs | |||||
| Configuration settings for Milvus vector database | |||||
| """ | """ | ||||
| MILVUS_URI: Optional[str] = Field( | MILVUS_URI: Optional[str] = Field( | ||||
| description="Milvus uri", | |||||
| description="URI for connecting to the Milvus server (e.g., 'http://localhost:19530' or 'https://milvus-instance.example.com:19530')", | |||||
| default="http://127.0.0.1:19530", | default="http://127.0.0.1:19530", | ||||
| ) | ) | ||||
| MILVUS_TOKEN: Optional[str] = Field( | MILVUS_TOKEN: Optional[str] = Field( | ||||
| description="Milvus token", | |||||
| description="Authentication token for Milvus, if token-based authentication is enabled", | |||||
| default=None, | default=None, | ||||
| ) | ) | ||||
| MILVUS_USER: Optional[str] = Field( | MILVUS_USER: Optional[str] = Field( | ||||
| description="Milvus user", | |||||
| description="Username for authenticating with Milvus, if username/password authentication is enabled", | |||||
| default=None, | default=None, | ||||
| ) | ) | ||||
| MILVUS_PASSWORD: Optional[str] = Field( | MILVUS_PASSWORD: Optional[str] = Field( | ||||
| description="Milvus password", | |||||
| description="Password for authenticating with Milvus, if username/password authentication is enabled", | |||||
| default=None, | default=None, | ||||
| ) | ) | ||||
| MILVUS_DATABASE: str = Field( | MILVUS_DATABASE: str = Field( | ||||
| description="Milvus database, default to `default`", | |||||
| description="Name of the Milvus database to connect to (default is 'default')", | |||||
| default="default", | default="default", | ||||
| ) | ) |
| class MyScaleConfig(BaseModel): | class MyScaleConfig(BaseModel): | ||||
| """ | """ | ||||
| MyScale configs | |||||
| Configuration settings for MyScale vector database | |||||
| """ | """ | ||||
| MYSCALE_HOST: str = Field( | MYSCALE_HOST: str = Field( | ||||
| description="MyScale host", | |||||
| description="Hostname or IP address of the MyScale server (e.g., 'localhost' or 'myscale.example.com')", | |||||
| default="localhost", | default="localhost", | ||||
| ) | ) | ||||
| MYSCALE_PORT: PositiveInt = Field( | MYSCALE_PORT: PositiveInt = Field( | ||||
| description="MyScale port", | |||||
| description="Port number on which the MyScale server is listening (default is 8123)", | |||||
| default=8123, | default=8123, | ||||
| ) | ) | ||||
| MYSCALE_USER: str = Field( | MYSCALE_USER: str = Field( | ||||
| description="MyScale user", | |||||
| description="Username for authenticating with MyScale (default is 'default')", | |||||
| default="default", | default="default", | ||||
| ) | ) | ||||
| MYSCALE_PASSWORD: str = Field( | MYSCALE_PASSWORD: str = Field( | ||||
| description="MyScale password", | |||||
| description="Password for authenticating with MyScale (default is an empty string)", | |||||
| default="", | default="", | ||||
| ) | ) | ||||
| MYSCALE_DATABASE: str = Field( | MYSCALE_DATABASE: str = Field( | ||||
| description="MyScale database name", | |||||
| description="Name of the MyScale database to connect to (default is 'default')", | |||||
| default="default", | default="default", | ||||
| ) | ) | ||||
| MYSCALE_FTS_PARAMS: str = Field( | MYSCALE_FTS_PARAMS: str = Field( | ||||
| description="MyScale fts index parameters", | |||||
| description="Additional parameters for MyScale Full Text Search index)", | |||||
| default="", | default="", | ||||
| ) | ) |
| class OpenSearchConfig(BaseSettings): | class OpenSearchConfig(BaseSettings): | ||||
| """ | """ | ||||
| OpenSearch configs | |||||
| Configuration settings for OpenSearch | |||||
| """ | """ | ||||
| OPENSEARCH_HOST: Optional[str] = Field( | OPENSEARCH_HOST: Optional[str] = Field( | ||||
| description="OpenSearch host", | |||||
| description="Hostname or IP address of the OpenSearch server (e.g., 'localhost' or 'opensearch.example.com')", | |||||
| default=None, | default=None, | ||||
| ) | ) | ||||
| OPENSEARCH_PORT: PositiveInt = Field( | OPENSEARCH_PORT: PositiveInt = Field( | ||||
| description="OpenSearch port", | |||||
| description="Port number on which the OpenSearch server is listening (default is 9200)", | |||||
| default=9200, | default=9200, | ||||
| ) | ) | ||||
| OPENSEARCH_USER: Optional[str] = Field( | OPENSEARCH_USER: Optional[str] = Field( | ||||
| description="OpenSearch user", | |||||
| description="Username for authenticating with OpenSearch", | |||||
| default=None, | default=None, | ||||
| ) | ) | ||||
| OPENSEARCH_PASSWORD: Optional[str] = Field( | OPENSEARCH_PASSWORD: Optional[str] = Field( | ||||
| description="OpenSearch password", | |||||
| description="Password for authenticating with OpenSearch", | |||||
| default=None, | default=None, | ||||
| ) | ) | ||||
| OPENSEARCH_SECURE: bool = Field( | OPENSEARCH_SECURE: bool = Field( | ||||
| description="whether to use SSL connection for OpenSearch", | |||||
| description="Whether to use SSL/TLS encrypted connection for OpenSearch (True for HTTPS, False for HTTP)", | |||||
| default=False, | default=False, | ||||
| ) | ) |
| class OracleConfig(BaseSettings): | class OracleConfig(BaseSettings): | ||||
| """ | """ | ||||
| ORACLE configs | |||||
| Configuration settings for Oracle database | |||||
| """ | """ | ||||
| ORACLE_HOST: Optional[str] = Field( | ORACLE_HOST: Optional[str] = Field( | ||||
| description="ORACLE host", | |||||
| description="Hostname or IP address of the Oracle database server (e.g., 'localhost' or 'oracle.example.com')", | |||||
| default=None, | default=None, | ||||
| ) | ) | ||||
| ORACLE_PORT: Optional[PositiveInt] = Field( | ORACLE_PORT: Optional[PositiveInt] = Field( | ||||
| description="ORACLE port", | |||||
| description="Port number on which the Oracle database server is listening (default is 1521)", | |||||
| default=1521, | default=1521, | ||||
| ) | ) | ||||
| ORACLE_USER: Optional[str] = Field( | ORACLE_USER: Optional[str] = Field( | ||||
| description="ORACLE user", | |||||
| description="Username for authenticating with the Oracle database", | |||||
| default=None, | default=None, | ||||
| ) | ) | ||||
| ORACLE_PASSWORD: Optional[str] = Field( | ORACLE_PASSWORD: Optional[str] = Field( | ||||
| description="ORACLE password", | |||||
| description="Password for authenticating with the Oracle database", | |||||
| default=None, | default=None, | ||||
| ) | ) | ||||
| ORACLE_DATABASE: Optional[str] = Field( | ORACLE_DATABASE: Optional[str] = Field( | ||||
| description="ORACLE database", | |||||
| description="Name of the Oracle database or service to connect to (e.g., 'ORCL' or 'pdborcl')", | |||||
| default=None, | default=None, | ||||
| ) | ) |
| class PGVectorConfig(BaseSettings): | class PGVectorConfig(BaseSettings): | ||||
| """ | """ | ||||
| PGVector configs | |||||
| Configuration settings for PGVector (PostgreSQL with vector extension) | |||||
| """ | """ | ||||
| PGVECTOR_HOST: Optional[str] = Field( | PGVECTOR_HOST: Optional[str] = Field( | ||||
| description="PGVector host", | |||||
| description="Hostname or IP address of the PostgreSQL server with PGVector extension (e.g., 'localhost')", | |||||
| default=None, | default=None, | ||||
| ) | ) | ||||
| PGVECTOR_PORT: Optional[PositiveInt] = Field( | PGVECTOR_PORT: Optional[PositiveInt] = Field( | ||||
| description="PGVector port", | |||||
| description="Port number on which the PostgreSQL server is listening (default is 5433)", | |||||
| default=5433, | default=5433, | ||||
| ) | ) | ||||
| PGVECTOR_USER: Optional[str] = Field( | PGVECTOR_USER: Optional[str] = Field( | ||||
| description="PGVector user", | |||||
| description="Username for authenticating with the PostgreSQL database", | |||||
| default=None, | default=None, | ||||
| ) | ) | ||||
| PGVECTOR_PASSWORD: Optional[str] = Field( | PGVECTOR_PASSWORD: Optional[str] = Field( | ||||
| description="PGVector password", | |||||
| description="Password for authenticating with the PostgreSQL database", | |||||
| default=None, | default=None, | ||||
| ) | ) | ||||
| PGVECTOR_DATABASE: Optional[str] = Field( | PGVECTOR_DATABASE: Optional[str] = Field( | ||||
| description="PGVector database", | |||||
| description="Name of the PostgreSQL database to connect to", | |||||
| default=None, | default=None, | ||||
| ) | ) |
| class PGVectoRSConfig(BaseSettings): | class PGVectoRSConfig(BaseSettings): | ||||
| """ | """ | ||||
| PGVectoRS configs | |||||
| Configuration settings for PGVecto.RS (Rust-based vector extension for PostgreSQL) | |||||
| """ | """ | ||||
| PGVECTO_RS_HOST: Optional[str] = Field( | PGVECTO_RS_HOST: Optional[str] = Field( | ||||
| description="PGVectoRS host", | |||||
| description="Hostname or IP address of the PostgreSQL server with PGVecto.RS extension (e.g., 'localhost')", | |||||
| default=None, | default=None, | ||||
| ) | ) | ||||
| PGVECTO_RS_PORT: Optional[PositiveInt] = Field( | PGVECTO_RS_PORT: Optional[PositiveInt] = Field( | ||||
| description="PGVectoRS port", | |||||
| description="Port number on which the PostgreSQL server with PGVecto.RS is listening (default is 5431)", | |||||
| default=5431, | default=5431, | ||||
| ) | ) | ||||
| PGVECTO_RS_USER: Optional[str] = Field( | PGVECTO_RS_USER: Optional[str] = Field( | ||||
| description="PGVectoRS user", | |||||
| description="Username for authenticating with the PostgreSQL database using PGVecto.RS", | |||||
| default=None, | default=None, | ||||
| ) | ) | ||||
| PGVECTO_RS_PASSWORD: Optional[str] = Field( | PGVECTO_RS_PASSWORD: Optional[str] = Field( | ||||
| description="PGVectoRS password", | |||||
| description="Password for authenticating with the PostgreSQL database using PGVecto.RS", | |||||
| default=None, | default=None, | ||||
| ) | ) | ||||
| PGVECTO_RS_DATABASE: Optional[str] = Field( | PGVECTO_RS_DATABASE: Optional[str] = Field( | ||||
| description="PGVectoRS database", | |||||
| description="Name of the PostgreSQL database with PGVecto.RS extension to connect to", | |||||
| default=None, | default=None, | ||||
| ) | ) |
| class QdrantConfig(BaseSettings): | class QdrantConfig(BaseSettings): | ||||
| """ | """ | ||||
| Qdrant configs | |||||
| Configuration settings for Qdrant vector database | |||||
| """ | """ | ||||
| QDRANT_URL: Optional[str] = Field( | QDRANT_URL: Optional[str] = Field( | ||||
| description="Qdrant url", | |||||
| description="URL of the Qdrant server (e.g., 'http://localhost:6333' or 'https://qdrant.example.com')", | |||||
| default=None, | default=None, | ||||
| ) | ) | ||||
| QDRANT_API_KEY: Optional[str] = Field( | QDRANT_API_KEY: Optional[str] = Field( | ||||
| description="Qdrant api key", | |||||
| description="API key for authenticating with the Qdrant server", | |||||
| default=None, | default=None, | ||||
| ) | ) | ||||
| QDRANT_CLIENT_TIMEOUT: NonNegativeInt = Field( | QDRANT_CLIENT_TIMEOUT: NonNegativeInt = Field( | ||||
| description="Qdrant client timeout in seconds", | |||||
| description="Timeout in seconds for Qdrant client operations (default is 20 seconds)", | |||||
| default=20, | default=20, | ||||
| ) | ) | ||||
| QDRANT_GRPC_ENABLED: bool = Field( | QDRANT_GRPC_ENABLED: bool = Field( | ||||
| description="whether enable grpc support for Qdrant connection", | |||||
| description="Whether to enable gRPC support for Qdrant connection (True for gRPC, False for HTTP)", | |||||
| default=False, | default=False, | ||||
| ) | ) | ||||
| QDRANT_GRPC_PORT: PositiveInt = Field( | QDRANT_GRPC_PORT: PositiveInt = Field( | ||||
| description="Qdrant grpc port", | |||||
| description="Port number for gRPC connection to Qdrant server (default is 6334)", | |||||
| default=6334, | default=6334, | ||||
| ) | ) |
| class RelytConfig(BaseSettings): | class RelytConfig(BaseSettings): | ||||
| """ | """ | ||||
| Relyt configs | |||||
| Configuration settings for Relyt database | |||||
| """ | """ | ||||
| RELYT_HOST: Optional[str] = Field( | RELYT_HOST: Optional[str] = Field( | ||||
| description="Relyt host", | |||||
| description="Hostname or IP address of the Relyt server (e.g., 'localhost' or 'relyt.example.com')", | |||||
| default=None, | default=None, | ||||
| ) | ) | ||||
| RELYT_PORT: PositiveInt = Field( | RELYT_PORT: PositiveInt = Field( | ||||
| description="Relyt port", | |||||
| description="Port number on which the Relyt server is listening (default is 9200)", | |||||
| default=9200, | default=9200, | ||||
| ) | ) | ||||
| RELYT_USER: Optional[str] = Field( | RELYT_USER: Optional[str] = Field( | ||||
| description="Relyt user", | |||||
| description="Username for authenticating with the Relyt database", | |||||
| default=None, | default=None, | ||||
| ) | ) | ||||
| RELYT_PASSWORD: Optional[str] = Field( | RELYT_PASSWORD: Optional[str] = Field( | ||||
| description="Relyt password", | |||||
| description="Password for authenticating with the Relyt database", | |||||
| default=None, | default=None, | ||||
| ) | ) | ||||
| RELYT_DATABASE: Optional[str] = Field( | RELYT_DATABASE: Optional[str] = Field( | ||||
| description="Relyt database", | |||||
| description="Name of the Relyt database to connect to (default is 'default')", | |||||
| default="default", | default="default", | ||||
| ) | ) |
| class TencentVectorDBConfig(BaseSettings): | class TencentVectorDBConfig(BaseSettings): | ||||
| """ | """ | ||||
| Tencent Vector configs | |||||
| Configuration settings for Tencent Vector Database | |||||
| """ | """ | ||||
| TENCENT_VECTOR_DB_URL: Optional[str] = Field( | TENCENT_VECTOR_DB_URL: Optional[str] = Field( | ||||
| description="Tencent Vector URL", | |||||
| description="URL of the Tencent Vector Database service (e.g., 'https://vectordb.tencentcloudapi.com')", | |||||
| default=None, | default=None, | ||||
| ) | ) | ||||
| TENCENT_VECTOR_DB_API_KEY: Optional[str] = Field( | TENCENT_VECTOR_DB_API_KEY: Optional[str] = Field( | ||||
| description="Tencent Vector API key", | |||||
| description="API key for authenticating with the Tencent Vector Database service", | |||||
| default=None, | default=None, | ||||
| ) | ) | ||||
| TENCENT_VECTOR_DB_TIMEOUT: PositiveInt = Field( | TENCENT_VECTOR_DB_TIMEOUT: PositiveInt = Field( | ||||
| description="Tencent Vector timeout in seconds", | |||||
| description="Timeout in seconds for Tencent Vector Database operations (default is 30 seconds)", | |||||
| default=30, | default=30, | ||||
| ) | ) | ||||
| TENCENT_VECTOR_DB_USERNAME: Optional[str] = Field( | TENCENT_VECTOR_DB_USERNAME: Optional[str] = Field( | ||||
| description="Tencent Vector username", | |||||
| description="Username for authenticating with the Tencent Vector Database (if required)", | |||||
| default=None, | default=None, | ||||
| ) | ) | ||||
| TENCENT_VECTOR_DB_PASSWORD: Optional[str] = Field( | TENCENT_VECTOR_DB_PASSWORD: Optional[str] = Field( | ||||
| description="Tencent Vector password", | |||||
| description="Password for authenticating with the Tencent Vector Database (if required)", | |||||
| default=None, | default=None, | ||||
| ) | ) | ||||
| TENCENT_VECTOR_DB_SHARD: PositiveInt = Field( | TENCENT_VECTOR_DB_SHARD: PositiveInt = Field( | ||||
| description="Tencent Vector sharding number", | |||||
| description="Number of shards for the Tencent Vector Database (default is 1)", | |||||
| default=1, | default=1, | ||||
| ) | ) | ||||
| TENCENT_VECTOR_DB_REPLICAS: NonNegativeInt = Field( | TENCENT_VECTOR_DB_REPLICAS: NonNegativeInt = Field( | ||||
| description="Tencent Vector replicas", | |||||
| description="Number of replicas for the Tencent Vector Database (default is 2)", | |||||
| default=2, | default=2, | ||||
| ) | ) | ||||
| TENCENT_VECTOR_DB_DATABASE: Optional[str] = Field( | TENCENT_VECTOR_DB_DATABASE: Optional[str] = Field( | ||||
| description="Tencent Vector Database", | |||||
| description="Name of the specific Tencent Vector Database to connect to", | |||||
| default=None, | default=None, | ||||
| ) | ) |
| class TiDBVectorConfig(BaseSettings): | class TiDBVectorConfig(BaseSettings): | ||||
| """ | """ | ||||
| TiDB Vector configs | |||||
| Configuration settings for TiDB Vector database | |||||
| """ | """ | ||||
| TIDB_VECTOR_HOST: Optional[str] = Field( | TIDB_VECTOR_HOST: Optional[str] = Field( | ||||
| description="TiDB Vector host", | |||||
| description="Hostname or IP address of the TiDB Vector server (e.g., 'localhost' or 'tidb.example.com')", | |||||
| default=None, | default=None, | ||||
| ) | ) | ||||
| TIDB_VECTOR_PORT: Optional[PositiveInt] = Field( | TIDB_VECTOR_PORT: Optional[PositiveInt] = Field( | ||||
| description="TiDB Vector port", | |||||
| description="Port number on which the TiDB Vector server is listening (default is 4000)", | |||||
| default=4000, | default=4000, | ||||
| ) | ) | ||||
| TIDB_VECTOR_USER: Optional[str] = Field( | TIDB_VECTOR_USER: Optional[str] = Field( | ||||
| description="TiDB Vector user", | |||||
| description="Username for authenticating with the TiDB Vector database", | |||||
| default=None, | default=None, | ||||
| ) | ) | ||||
| TIDB_VECTOR_PASSWORD: Optional[str] = Field( | TIDB_VECTOR_PASSWORD: Optional[str] = Field( | ||||
| description="TiDB Vector password", | |||||
| description="Password for authenticating with the TiDB Vector database", | |||||
| default=None, | default=None, | ||||
| ) | ) | ||||
| TIDB_VECTOR_DATABASE: Optional[str] = Field( | TIDB_VECTOR_DATABASE: Optional[str] = Field( | ||||
| description="TiDB Vector database", | |||||
| description="Name of the TiDB Vector database to connect to", | |||||
| default=None, | default=None, | ||||
| ) | ) |
| class WeaviateConfig(BaseSettings): | class WeaviateConfig(BaseSettings): | ||||
| """ | """ | ||||
| Weaviate configs | |||||
| Configuration settings for Weaviate vector database | |||||
| """ | """ | ||||
| WEAVIATE_ENDPOINT: Optional[str] = Field( | WEAVIATE_ENDPOINT: Optional[str] = Field( | ||||
| description="Weaviate endpoint URL", | |||||
| description="URL of the Weaviate server (e.g., 'http://localhost:8080' or 'https://weaviate.example.com')", | |||||
| default=None, | default=None, | ||||
| ) | ) | ||||
| WEAVIATE_API_KEY: Optional[str] = Field( | WEAVIATE_API_KEY: Optional[str] = Field( | ||||
| description="Weaviate API key", | |||||
| description="API key for authenticating with the Weaviate server", | |||||
| default=None, | default=None, | ||||
| ) | ) | ||||
| WEAVIATE_GRPC_ENABLED: bool = Field( | WEAVIATE_GRPC_ENABLED: bool = Field( | ||||
| description="whether to enable gRPC for Weaviate connection", | |||||
| description="Whether to enable gRPC for Weaviate connection (True for gRPC, False for HTTP)", | |||||
| default=True, | default=True, | ||||
| ) | ) | ||||
| WEAVIATE_BATCH_SIZE: PositiveInt = Field( | WEAVIATE_BATCH_SIZE: PositiveInt = Field( | ||||
| description="Weaviate batch size", | |||||
| description="Number of objects to be processed in a single batch operation (default is 100)", | |||||
| default=100, | default=100, | ||||
| ) | ) |