final examples and logging

This commit is contained in:
joachim-danswer 2025-03-16 13:06:19 -07:00
parent ab11bf6552
commit 625936306f
2 changed files with 35 additions and 19 deletions

View File

@ -358,24 +358,37 @@ def stream_chat_message_objects(
llm: LLM llm: LLM
test_questions = [ test_questions = [
"weather in Munich", "big bang vs steady state theory",
"weather in New York", "astronomy",
# "what is the overlap between finance and economics", "trace energy momentum tensor conformal field theory",
# "effects taking vitamin c pills vs eating veggies health outcomes", "evidence Big Bang",
# "professions people good math", "Neil Armstrong play tennis moon",
# "biomedical engineers design cutting-edge medical equipment important skill set", "current temperature Hawaii New York Munich",
# "How do biomedical engineers design cutting-edge medical equipment? And what is the most important skill set?", "win quadradoodle",
# "average power output US nuclear power plant", "best practices coding Java",
# "typical power range small modular reactors", "classes related software engineering",
# "SMRs power industry", "current temperature Munich",
# "best use case Onyx AI company", "what is the most important concept in biology",
# "techniques calculate square root", "subfields of finance",
# "daily vitamin C requirement adult women", "what is the overlap between finance and economics",
# "boil ocean", "effects taking vitamin c pills vs eating veggies health outcomes",
# "best soccer player ever" "professions people good math",
"biomedical engineers design cutting-edge medical equipment important skill set",
"How do biomedical engineers design cutting-edge medical equipment? And what is the most important skill set?",
"average power output US nuclear power plant",
"typical power range small modular reactors",
"SMRs power industry",
"best use case Onyx AI company",
"techniques calculate square root",
"daily vitamin C requirement adult women",
"boil ocean",
"best soccer player ever",
] ]
for test_question in test_questions: for test_question_num, test_question in enumerate(test_questions):
logger.info(
f"------- Running test question {test_question_num + 1} of {len(test_questions)}"
)
try: try:
user_id = user.id if user is not None else None user_id = user.id if user is not None else None

View File

@ -333,7 +333,8 @@ def query_vespa(
search_time = 0.0 search_time = 0.0
for query_alpha in [0.4, 0.7, 1.0]: alphas: list[float] = [0.4, 0.7, 1.0]
for query_alpha in alphas:
date_time_start = datetime.now() date_time_start = datetime.now()
# Create a mutable copy of the query_params # Create a mutable copy of the query_params
@ -408,14 +409,15 @@ def query_vespa(
date_time_end = datetime.now() date_time_end = datetime.now()
search_time += (date_time_end - date_time_start).microseconds / 1000000 search_time += (date_time_end - date_time_start).microseconds / 1000000
avg_search_time = search_time / len(alphas)
ranking_stats.append( ranking_stats.append(
( (
"Timing", "Timing",
query_alpha, query_alpha,
cast(str, query_params["query"]).strip(), cast(str, query_params["query"]).strip(),
"", "",
"", "Avg:",
search_time, avg_search_time,
) )
) )
@ -426,6 +428,7 @@ def query_vespa(
inference_chunks = [_vespa_hit_to_inference_chunk(hit) for hit in filtered_hits] inference_chunks = [_vespa_hit_to_inference_chunk(hit) for hit in filtered_hits]
# Good Debugging Spot # Good Debugging Spot
logger.info(f"Search done for all alphs - avg timing: {avg_search_time}")
return inference_chunks return inference_chunks