Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
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
6 changes: 5 additions & 1 deletion backend/onyx/llm/chat_llm.py
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,11 @@ def _completion(
# streaming choice
stream=stream,
# model params
temperature=self._temperature,
temperature=(
1
if self.config.model_name in ["gpt-5", "gpt-5-mini", "gpt-5-nano"]
else self._temperature
),
Comment on lines +400 to +404
Copy link
Contributor

Choose a reason for hiding this comment

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

style: Consider extracting the GPT-5 model list into a constant to avoid duplication and improve maintainability. This list appears in multiple files.

timeout=timeout_override or self._timeout,
# For now, we don't support parallel tool calls
# NOTE: we can't pass this in if tools are not specified
Expand Down
5 changes: 4 additions & 1 deletion backend/onyx/llm/llm_provider_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ class WellKnownLLMProviderDescriptor(BaseModel):

OPENAI_PROVIDER_NAME = "openai"
OPEN_AI_MODEL_NAMES = [
"gpt-5",
"gpt-5-mini",
"gpt-5-nano",
"o4-mini",
"o3-mini",
"o1-mini",
Expand All @@ -73,7 +76,7 @@ class WellKnownLLMProviderDescriptor(BaseModel):
"gpt-3.5-turbo-16k-0613",
"gpt-3.5-turbo-0301",
]
OPEN_AI_VISIBLE_MODEL_NAMES = ["o1", "o3-mini", "gpt-4o", "gpt-4o-mini"]
OPEN_AI_VISIBLE_MODEL_NAMES = ["gpt-5", "o1", "o3-mini", "gpt-4o", "gpt-4o-mini"]

BEDROCK_PROVIDER_NAME = "bedrock"
# need to remove all the weird "bedrock/eu-central-1/anthropic.claude-v1" named
Expand Down
18 changes: 15 additions & 3 deletions backend/onyx/onyxbot/slack/listener.py
Original file line number Diff line number Diff line change
Expand Up @@ -570,6 +570,16 @@ def shutdown(self, signum: int | None, frame: FrameType | None) -> None:
sys.exit(0)


def sanitize_slack_payload(payload: dict) -> dict:
"""Remove message content from Slack payload for logging"""
sanitized = {k: v for k, v in payload.items() if k not in {"text", "blocks"}}
Copy link
Contributor

Choose a reason for hiding this comment

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

sanitize_slack_payload fails to strip message text from nested structures, so sensitive content may still be logged (Based on your team’s feedback about avoiding personal data in logs).

Prompt for AI agents
Address the following comment on backend/onyx/onyxbot/slack/listener.py at line 575:

<comment>sanitize_slack_payload fails to strip message text from nested structures, so sensitive content may still be logged (Based on your team’s feedback about avoiding personal data in logs).</comment>

<file context>
@@ -570,6 +570,16 @@ def shutdown(self, signum: int | None, frame: FrameType | None) -&gt; None:
         sys.exit(0)
 
 
+def sanitize_slack_payload(payload: dict) -&gt; dict:
+    &quot;&quot;&quot;Remove message content from Slack payload for logging&quot;&quot;&quot;
+    sanitized = {k: v for k, v in payload.items() if k not in {&quot;text&quot;, &quot;blocks&quot;}}
+    if &quot;event&quot; in sanitized and isinstance(sanitized[&quot;event&quot;], dict):
+        sanitized[&quot;event&quot;] = {
</file context>

if "event" in sanitized and isinstance(sanitized["event"], dict):
sanitized["event"] = {
k: v for k, v in sanitized["event"].items() if k not in {"text", "blocks"}
}
return sanitized


def prefilter_requests(req: SocketModeRequest, client: TenantSocketModeClient) -> bool:
"""True to keep going, False to ignore this Slack request"""

Expand Down Expand Up @@ -762,7 +772,10 @@ def prefilter_requests(req: SocketModeRequest, client: TenantSocketModeClient) -
if not check_message_limit():
return False

logger.debug(f"Handling Slack request: {client.bot_name=} '{req.payload=}'")
# Don't log Slack message content
logger.debug(
f"Handling Slack request: {client.bot_name=} '{sanitize_slack_payload(req.payload)=}'"
)
return True


Expand Down Expand Up @@ -929,10 +942,9 @@ def process_message(
if req.type == "events_api":
event = cast(dict[str, Any], req.payload["event"])
event_type = event.get("type")
msg = cast(str, event.get("text", ""))
logger.info(
f"process_message start: {tenant_id=} {req.type=} {req.envelope_id=} "
f"{event_type=} {msg=}"
f"{event_type=}"
)
else:
logger.info(
Expand Down
Loading