fix: query generation

This commit is contained in:
Timothy Jaeryang Baek 2024-11-22 12:31:06 -08:00
parent 3cfd4f8993
commit 429fa2befa

View File

@ -515,6 +515,7 @@ async def chat_completion_files_handler(
) -> tuple[dict, dict[str, list]]: ) -> tuple[dict, dict[str, list]]:
sources = [] sources = []
if files := body.get("metadata", {}).get("files", None):
try: try:
queries_response = await generate_queries( queries_response = await generate_queries(
{ {
@ -540,7 +541,6 @@ async def chat_completion_files_handler(
print(f"{queries=}") print(f"{queries=}")
if files := body.get("metadata", {}).get("files", None):
sources = get_sources_from_files( sources = get_sources_from_files(
files=files, files=files,
queries=queries, queries=queries,
@ -691,6 +691,7 @@ class ChatCompletionMiddleware(BaseHTTPMiddleware):
# If context is not empty, insert it into the messages # If context is not empty, insert it into the messages
if len(sources) > 0: if len(sources) > 0:
print("\n\n\n\n\n\n\nHI\n\n\n\n\n\n")
context_string = "" context_string = ""
for source_idx, source in enumerate(sources): for source_idx, source in enumerate(sources):
source_id = source.get("source", {}).get("name", "") source_id = source.get("source", {}).get("name", "")