-
Notifications
You must be signed in to change notification settings - Fork 108
Expand file tree
/
Copy pathconfig.py
More file actions
28 lines (22 loc) · 772 Bytes
/
config.py
File metadata and controls
28 lines (22 loc) · 772 Bytes
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
from __future__ import annotations
import os
from dataclasses import dataclass
from pathlib import Path
from dotenv import load_dotenv
@dataclass
class Config:
model: str = ""
api_key: str | None = None
base_url: str | None = None
feldera_compiler: str = ""
@classmethod
def from_env(cls) -> Config:
# Load .env from project root (won't override existing env vars)
env_path = Path(__file__).resolve().parent.parent / ".env"
load_dotenv(env_path)
return cls(
model=os.environ.get("FELDERIZE_MODEL", ""),
api_key=os.environ.get("ANTHROPIC_API_KEY"),
base_url=os.environ.get("ANTHROPIC_BASE_URL"),
feldera_compiler=os.environ.get("FELDERA_COMPILER", ""),
)