ppsingh commited on
Commit
cd53804
·
verified ·
1 Parent(s): 78519a5

Delete app/utils.py

Browse files
Files changed (1) hide show
  1. app/utils.py +0 -46
app/utils.py DELETED
@@ -1,46 +0,0 @@
1
- import configparser
2
- import logging
3
- import os
4
- import ast
5
- import re
6
- from dotenv import load_dotenv
7
-
8
- # Local .env file
9
- load_dotenv()
10
-
11
- def getconfig(configfile_path: str):
12
- """
13
- Read the config file
14
- Params
15
- ----------------
16
- configfile_path: file path of .cfg file
17
- """
18
- config = configparser.ConfigParser()
19
- try:
20
- config.read_file(open(configfile_path))
21
- return config
22
- except:
23
- logging.warning("config file not found")
24
-
25
-
26
- def get_auth(provider: str) -> dict:
27
- """Get authentication configuration for different providers"""
28
- auth_configs = {
29
- "huggingface": {"api_key": os.getenv("HF_TOKEN")},
30
- "qdrant": {"api_key": os.getenv("QDRANT_API_KEY")},
31
- }
32
-
33
- provider = provider.lower() # Normalize to lowercase
34
-
35
- if provider not in auth_configs:
36
- raise ValueError(f"Unsupported provider: {provider}")
37
-
38
- auth_config = auth_configs[provider]
39
- api_key = auth_config.get("api_key")
40
-
41
- if not api_key:
42
- logging.warning(f"No API key found for provider '{provider}'. Please set the appropriate environment variable.")
43
- auth_config["api_key"] = None
44
-
45
- return auth_config
46
-