Skip to content

Commit 0402fa8

Browse files
fix: inject proper Azure env vars for RankifyAgent
1 parent 053aa54 commit 0402fa8

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

demo_server.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,13 @@ async def gen():
438438
if req.session_id not in _agent_cache:
439439
logger.info(f"Initializing RankifyAgent for session {req.session_id}")
440440
backend = "azure" if AZURE_KEY else "openai"
441+
if backend == "azure":
442+
os.environ["AZURE_API_KEY"] = AZURE_KEY
443+
os.environ["AZURE_API_BASE"] = AZURE_ENDPOINT
444+
os.environ["AZURE_API_VERSION"] = AZURE_API_VER
445+
os.environ["AZURE_OPENAI_API_KEY"] = AZURE_KEY
446+
os.environ["AZURE_OPENAI_ENDPOINT"] = AZURE_ENDPOINT
447+
os.environ["AZURE_DEPLOYMENT_NAME"] = AZURE_DEPLOYMENT
441448
_agent_cache[req.session_id] = RankifyAgent(backend=backend)
442449

443450
agent = _agent_cache[req.session_id]

0 commit comments

Comments
 (0)