Telemetry Revision (#868)

This commit is contained in:
Yuhong Sun
2023-12-24 17:39:37 -08:00
committed by GitHub
parent 0370b9b38d
commit c3cf9134bb
18 changed files with 67 additions and 48 deletions

View File

@ -4,14 +4,12 @@ from fastapi import APIRouter
from danswer.search.search_nlp_models import get_intent_model_tokenizer
from danswer.search.search_nlp_models import get_local_intent_model
from danswer.utils.timing import log_function_time
from shared_models.model_server_models import IntentRequest
from shared_models.model_server_models import IntentResponse
router = APIRouter(prefix="/custom")
@log_function_time()
def classify_intent(query: str) -> list[float]:
tokenizer = get_intent_model_tokenizer()
intent_model = get_local_intent_model()

View File

@ -20,7 +20,7 @@ WARM_UP_STRING = "Danswer is amazing"
router = APIRouter(prefix="/encoder")
@log_function_time()
@log_function_time(print_only=True)
def embed_text(
texts: list[str],
normalize_embeddings: bool = NORMALIZE_EMBEDDINGS,
@ -34,7 +34,7 @@ def embed_text(
return embeddings
@log_function_time()
@log_function_time(print_only=True)
def calc_sim_scores(query: str, docs: list[str]) -> list[list[float]]:
cross_encoders = get_local_reranking_model_ensemble()
sim_scores = [