rag-chat/rag-chat-backend/src/endpoints/configurations.py
2024-07-03 10:15:05 +02:00

29 lines
827 B
Python

"""Endpoints to retrieve information about the backend configuration."""
import json
from fastapi import APIRouter, Response
from endpoints.llm import LLM
from core.config import settings
router = APIRouter()
@router.get("/configs")
def get_configs():
"""Get configurations of the backend"""
backend_configs = {
"llm": {
'language': LLM.language,
'max_num_tokens': LLM.max_num_tokens,
'modelname': settings.LLM_MODEL_NAME
},
'env_vars': {
'language': settings.LLM_LANGUAGE,
'llm_option': settings.LLM_OPTION,
'llm_endpoint': settings.LLM_API_ENDPOINT,
'bucket_name': settings.BUCKET,
}
}
return Response(status_code=200, content=json.dumps(backend_configs), media_type="application/json")