- Add web_search tool with Jina Search/Reader/Rerank - Flash mode: top 3, 8s timeout, no Reader/Rerank - Pro mode: top 10, 20s timeout, concurrent Reader + Rerank top 5 - Add Redis async cache (TTL=300s) for search results - Register "search" in ALL_TOOLS mapping Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
57 lines
1.8 KiB
Python
57 lines
1.8 KiB
Python
"""Application configuration via pydantic-settings."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from pydantic_settings import BaseSettings, SettingsConfigDict
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
model_config = SettingsConfigDict(
|
|
env_file=".env",
|
|
env_file_encoding="utf-8",
|
|
extra="ignore",
|
|
)
|
|
|
|
# Azure OpenAI
|
|
azure_openai_endpoint: str = ""
|
|
azure_openai_api_key: str = ""
|
|
azure_openai_api_version: str = "2025-04-01-preview"
|
|
azure_openai_deployment: str = "gpt-5.4"
|
|
|
|
# PostgreSQL
|
|
database_url: str = "postgresql+asyncpg://azuredb:h13nYoFJX6QrfLzB8bdipEUCjsZq2P7W@dataope.postgres.database.azure.com:5432/soc?ssl=require"
|
|
|
|
# LangGraph checkpointer uses psycopg (not asyncpg) connection string
|
|
@property
|
|
def database_url_psycopg(self) -> str:
|
|
"""Return psycopg-compatible connection string for LangGraph checkpointer."""
|
|
url = self.database_url.replace("postgresql+asyncpg://", "postgresql://")
|
|
# psycopg uses sslmode=require, not ssl=require
|
|
url = url.replace("?ssl=require", "?sslmode=require")
|
|
url = url.replace("&ssl=require", "&sslmode=require")
|
|
return url
|
|
|
|
# KB Agent
|
|
kb_agent_url: str = "https://agnetdoc-cve0guf5h8eggmej.southeastasia-01.azurewebsites.net"
|
|
kb_agent_api_key: str = ""
|
|
kb_agent_search_path: str = "/api/v1/search"
|
|
kb_agent_search_timeout_sec: int = 15
|
|
|
|
# Gongdan (ticket system)
|
|
gongdan_api_base: str = "https://gongdan-b5fzbtgteqd5gzfb.eastasia-01.azurewebsites.net"
|
|
gongdan_api_key: str = ""
|
|
|
|
# Jina AI (Search / Reader / Rerank)
|
|
jina_api_key: str = ""
|
|
|
|
# Redis
|
|
redis_url: str = "rediss://:bY8ZNwyJX60UwN5NPqnl6HRODfTV0efkDAzCaF1PrOU=@oper.redis.cache.windows.net:6380"
|
|
|
|
# Server
|
|
host: str = "0.0.0.0"
|
|
port: int = 8000
|
|
debug: bool = False
|
|
|
|
|
|
settings = Settings()
|