-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsettings.py
More file actions
60 lines (48 loc) · 1.32 KB
/
settings.py
File metadata and controls
60 lines (48 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
from pydantic_settings import BaseSettings
from qdrant_client.models import (
SparseVectorParams,
SparseIndexParams,
VectorParams,
Distance,
)
class Settings(BaseSettings):
# FastAPI settings
API_V1_STR: str
PROJECT_NAME: str
# Gemini settings
GEMINI_API_KEY: str
OCR_MODEL: str
GEMINI_MAX_CONCURRENT_REQUESTS: int
GEMINI_MAX_ATTEMPTS: int
# Database settings
ASYNC_DATABASE_URL: str
SYNC_DATABASE_URL: str
# Hugging Face settings
HF_DENSE_EMBEDDINGS_MODEL: str
HF_DENSE_EMBEDDINGS_DIMENSION: int
HF_DENSE_EMBEDDINGS_MAX_LENGTH: int
HF_SPARSE_EMBEDDINGS_MODEL: str
# Qdrant settings
QDRANT_HOST: str
QDRANT_PORT: int
QDRANT_COLLECTION_NAME: str
QDRANT_TIMEOUT: int
@property
def sparse_vector_config(self) -> SparseVectorParams:
return SparseVectorParams(
index=SparseIndexParams(on_disk=False)
)
@property
def dense_vector_config(self) -> VectorParams:
return VectorParams(
size=self.HF_DENSE_EMBEDDINGS_DIMENSION, distance=Distance.COSINE
)
# Retrieval settings
DENSE_RETRIEVAL_K: int
SPARSE_RETRIEVAL_K: int
HYBRID_RETRIEVAL_K: int
HYBRID_RETRIEVAL_ALPHA: float
RRF_K: int
class Config:
env_file = ".env"
settings = Settings()