Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions backend/onyx/auth/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@
from onyx.utils.telemetry import create_milestone_and_report
from onyx.utils.telemetry import optional_telemetry
from onyx.utils.telemetry import RecordType
from onyx.utils.timing import log_function_time
from onyx.utils.url import add_url_params
from onyx.utils.variable_functionality import fetch_ee_implementation_or_noop
from onyx.utils.variable_functionality import fetch_versioned_implementation
Expand Down Expand Up @@ -363,6 +364,7 @@ async def validate_password(self, password: str, _: schemas.UC | models.UP) -> N
)
return

@log_function_time(print_only=True)
async def oauth_callback(
self,
oauth_name: str,
Expand Down Expand Up @@ -609,6 +611,7 @@ async def on_after_request_verify(
user.email, token, new_organization=user_count == 1
)

@log_function_time(print_only=True)
async def authenticate(
self, credentials: OAuth2PasswordRequestForm
) -> Optional[User]:
Expand Down Expand Up @@ -1235,6 +1238,7 @@ async def authorize(

return OAuth2AuthorizeResponse(authorization_url=authorization_url)

@log_function_time(print_only=True)
@router.get(
"/callback",
name=callback_route_name,
Expand Down
6 changes: 1 addition & 5 deletions backend/onyx/chat/process_message.py
Original file line number Diff line number Diff line change
Expand Up @@ -914,6 +914,7 @@ def stream_chat_message_objects(
retrieval_options.filters.user_folder_ids = user_folder_ids

# Create override kwargs for the search tool

override_kwargs = SearchToolOverrideKwargs(
force_no_rerank=search_for_ordering_only, # Skip reranking for ordering-only
alternate_db_session=None,
Expand Down Expand Up @@ -1113,9 +1114,6 @@ def stream_chat_message_objects(
logger.info(
f"ORDERING: Processing search results for ordering {len(user_files)} user files"
)
import time

ordering_start = time.time()

# Extract document order from search results
doc_order = []
Expand Down Expand Up @@ -1151,8 +1149,6 @@ def stream_chat_message_objects(
if f_id in file_id_to_user_file
]

time.time() - ordering_start

yield UserKnowledgeFilePacket(
user_files=[
FileDescriptor(
Expand Down
5 changes: 5 additions & 0 deletions backend/onyx/server/query_and_chat/chat_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,7 @@ def handle_new_chat_message(
"""
tenant_id = get_current_tenant_id()
logger.debug(f"Received new chat message: {chat_message_req.message}")
start_time = time.time()

if (
not chat_message_req.message
Expand Down Expand Up @@ -448,6 +449,10 @@ def stream_generator() -> Generator[str, None, None]:
),
is_connected=is_connected_func,
):
if isinstance(packet, dict) and "top_documents" in packet:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this seems problematic, no? stream_chat_message yields strs not dicts?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it does!

document_retrieval_latency = time.time() - start_time
logger.debug(f"First doc time: {document_retrieval_latency}")

yield json.dumps(packet) if isinstance(packet, dict) else packet

except Exception as e:
Expand Down