Skip to content

Commit f28a7ef

Browse files
CopilotMte90
andcommitted
Remove module-level embedding config variables
- Remove DEFAULT_TIMEOUT, MAX_RETRIES, BACKOFF_FACTOR constants - Remove PICOCODE_HTTP_DEBUG environment variable handling - Use hard-coded defaults directly in EmbeddingClient.__init__ (timeout=30.0, max_retries=2, backoff=1.5) - Simpler code with no extra configuration layer Co-authored-by: Mte90 <[email protected]>
1 parent c9310f1 commit f28a7ef

File tree

1 file changed

+3
-13
lines changed

1 file changed

+3
-13
lines changed

ai/openai.py

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,6 @@
2121
# Embedding client logger
2222
_embedding_logger = logging.getLogger("ai.analyzer.embedding")
2323

24-
# Embedding client configuration (uses CFG values, can override specific ones via environment)
25-
DEFAULT_TIMEOUT = float(os.getenv("PICOCODE_EMBEDDING_TIMEOUT", "30")) # seconds per request
26-
MAX_RETRIES = int(os.getenv("PICOCODE_EMBEDDING_RETRIES", "2"))
27-
BACKOFF_FACTOR = float(os.getenv("PICOCODE_EMBEDDING_BACKOFF", "1.5"))
28-
29-
# Optionally enable requests debug logging by setting PICOCODE_HTTP_DEBUG=true
30-
if os.getenv("PICOCODE_HTTP_DEBUG", "").lower() in ("1", "true", "yes"):
31-
logging.getLogger("requests").setLevel(logging.DEBUG)
32-
logging.getLogger("urllib3").setLevel(logging.DEBUG)
33-
3424
# Rate limiting configuration
3525
_RATE_LIMIT_CALLS = 100 # max calls per minute
3626
_RATE_LIMIT_WINDOW = 60.0 # seconds
@@ -132,9 +122,9 @@ def __init__(self,
132122
api_url: Optional[str] = None,
133123
api_key: Optional[str] = None,
134124
model: Optional[str] = None,
135-
timeout: float = DEFAULT_TIMEOUT,
136-
max_retries: int = MAX_RETRIES,
137-
backoff: float = BACKOFF_FACTOR):
125+
timeout: float = 30.0,
126+
max_retries: int = 2,
127+
backoff: float = 1.5):
138128
self.api_url = api_url or CFG.get("api_url")
139129
self.api_key = api_key or CFG.get("api_key")
140130
self.model = model or DEFAULT_EMBEDDING_MODEL or "text-embedding-3-small"

0 commit comments

Comments
 (0)