@@ -62,36 +62,47 @@ def _init_db_provider(db_type: str) -> DBProvider:
6262 """
6363 Initialize the correct DBProvider subclass based on DB_TYPE.
6464 """
65+ get = Config ._get_required_env_var
6566 db_type = db_type .upper ()
67+ embedding_model = get ("EMBEDDING_MODEL" )
6668
6769 if db_type == "REDIS" :
68- url = Config . _get_required_env_var ("REDIS_URL" )
70+ url = get ("REDIS_URL" )
6971 index = os .getenv ("REDIS_INDEX" , "docs" )
7072 schema = os .getenv ("REDIS_SCHEMA" , "redis_schema.yaml" )
71- return RedisProvider (url , index , schema )
73+ return RedisProvider (embedding_model , url , index , schema )
7274
7375 elif db_type == "ELASTIC" :
74- url = Config . _get_required_env_var ("ELASTIC_URL" )
75- password = Config . _get_required_env_var ("ELASTIC_PASSWORD" )
76+ url = get ("ELASTIC_URL" )
77+ password = get ("ELASTIC_PASSWORD" )
7678 index = os .getenv ("ELASTIC_INDEX" , "docs" )
7779 user = os .getenv ("ELASTIC_USER" , "elastic" )
78- return ElasticProvider (url , password , index , user )
80+ return ElasticProvider (embedding_model , url , password , index , user )
7981
8082 elif db_type == "PGVECTOR" :
81- url = Config . _get_required_env_var ("PGVECTOR_URL" )
82- collection = Config . _get_required_env_var ("PGVECTOR_COLLECTION_NAME" )
83- return PGVectorProvider (url , collection )
83+ url = get ("PGVECTOR_URL" )
84+ collection = get ("PGVECTOR_COLLECTION_NAME" )
85+ return PGVectorProvider (embedding_model , url , collection )
8486
8587 elif db_type == "SQLSERVER" :
86- return SQLServerProvider () # Handles its own env var loading
88+ host = get ("SQLSERVER_HOST" )
89+ port = get ("SQLSERVER_PORT" )
90+ user = get ("SQLSERVER_USER" )
91+ password = get ("SQLSERVER_PASSWORD" )
92+ database = get ("SQLSERVER_DB" )
93+ table = get ("SQLSERVER_TABLE" )
94+ driver = get ("SQLSERVER_DRIVER" )
95+ return SQLServerProvider (
96+ embedding_model , host , port , user , password , database , table , driver
97+ )
8798
8899 elif db_type == "QDRANT" :
89- url = Config . _get_required_env_var ("QDRANT_URL" )
90- collection = Config . _get_required_env_var ("QDRANT_COLLECTION" )
91- return QdrantProvider (url , collection )
100+ url = get ("QDRANT_URL" )
101+ collection = get ("QDRANT_COLLECTION" )
102+ return QdrantProvider (embedding_model , url , collection )
92103
93104 elif db_type == "DRYRUN" :
94- return DryRunProvider ()
105+ return DryRunProvider (embedding_model )
95106
96107 raise ValueError (f"Unsupported DB_TYPE '{ db_type } '" )
97108
@@ -135,9 +146,11 @@ def load() -> "Config":
135146 except json .JSONDecodeError as e :
136147 raise ValueError (f"Invalid REPO_SOURCES JSON: { e } " ) from e
137148
138- # Misc
149+ # Embedding settings
139150 chunk_size = int (get ("CHUNK_SIZE" ))
140151 chunk_overlap = int (get ("CHUNK_OVERLAP" ))
152+
153+ # Misc
141154 temp_dir = get ("TEMP_DIR" )
142155
143156 return Config (
0 commit comments