Files
Agents/api/dependencies.py
T

8 lines
229 B
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
from fastapi import Request
from openai import OpenAI
def get_llm_client(request: Request) -> OpenAI:
"""FastAPI dependency returns the singleton OpenAI client from app.state."""
return request.app.state.llm_client