Compare commits

...

3 Commits

Author SHA1 Message Date
Wenxi
4468766ec9 fix unpaused user files (#5205) 2025-08-18 11:11:54 -07:00
Dominic Feliton
0d942590f9 fix(connector): user file helm start cmd + legacy file connector incompatibility (#5195)
* Fix user file helm start cmd + legacy file connector incompatibility

* typo

* remove unnecessary logic

* undo

* make recommended changes

* keep comment

* cleanup

* format

---------

Co-authored-by: Dominic Feliton <37809476+dominicfeliton@users.noreply.github.com>
2025-08-18 11:11:54 -07:00
Evan Lohn
bf668b5063 fix: max tokens param (#5174)
* max tokens param

* fix unit test

* fix unit test
2025-08-11 12:28:06 -07:00
9 changed files with 63 additions and 13 deletions

View File

@@ -0,0 +1,33 @@
"""Pause finished user file connectors
Revision ID: b558f51620b4
Revises: 90e3b9af7da4
Create Date: 2025-08-15 17:17:02.456704
"""
from alembic import op
# revision identifiers, used by Alembic.
revision = "b558f51620b4"
down_revision = "90e3b9af7da4"
branch_labels = None
depends_on = None
def upgrade() -> None:
# Set all user file connector credential pairs with ACTIVE status to PAUSED
# This ensures user files don't continue to run indexing tasks after processing
op.execute(
"""
UPDATE connector_credential_pair
SET status = 'PAUSED'
WHERE is_user_file = true
AND status = 'ACTIVE'
"""
)
def downgrade() -> None:
pass

View File

@@ -496,7 +496,14 @@ def check_indexing_completion(
ConnectorCredentialPairStatus.SCHEDULED,
ConnectorCredentialPairStatus.INITIAL_INDEXING,
]:
cc_pair.status = ConnectorCredentialPairStatus.ACTIVE
# User file connectors must be paused on success
# NOTE: _run_indexing doesn't update connectors if the index attempt is the future embedding model
# TODO: figure out why this doesn't pause connectors during swap
cc_pair.status = (
ConnectorCredentialPairStatus.PAUSED
if cc_pair.is_user_file
else ConnectorCredentialPairStatus.ACTIVE
)
db_session.commit()
# Clear repeated error state on success

View File

@@ -271,7 +271,7 @@ def _check_failure_threshold(
# NOTE: this is the old run_indexing function that the new decoupled approach
# is based on. Leaving this for comparison purposes, but if you see this comment
# has been here for >1 month, please delete this function.
# has been here for >2 month, please delete this function.
def _run_indexing(
db_session: Session,
index_attempt_id: int,

View File

@@ -24,6 +24,7 @@ from onyx.file_processing.image_utils import store_image_and_create_section
from onyx.file_store.file_store import get_default_file_store
from onyx.utils.logger import setup_logger
logger = setup_logger()
@@ -229,21 +230,18 @@ class LocalFileConnector(LoadConnector):
# Note: file_names is a required parameter, but should not break backwards compatibility.
# If add_file_names migration is not run, old file connector configs will not have file_names.
# This is fine because the configs are not re-used to instantiate the connector.
# file_names is only used for display purposes in the UI and file_locations is used as a fallback.
def __init__(
self,
file_locations: list[Path | str],
file_names: list[
str
], # Must accept this parameter as connector_specific_config is unpacked as args
zip_metadata: dict[str, Any],
file_names: list[str] | None = None,
zip_metadata: dict[str, Any] | None = None,
batch_size: int = INDEX_BATCH_SIZE,
) -> None:
self.file_locations = [str(loc) for loc in file_locations]
self.batch_size = batch_size
self.pdf_pass: str | None = None
self.zip_metadata = zip_metadata
self.zip_metadata = zip_metadata or {}
def load_credentials(self, credentials: dict[str, Any]) -> dict[str, Any] | None:
self.pdf_pass = credentials.get("pdf_password")

View File

@@ -24,6 +24,7 @@ from langchain_core.messages import SystemMessageChunk
from langchain_core.messages.tool import ToolCallChunk
from langchain_core.messages.tool import ToolMessage
from langchain_core.prompt_values import PromptValue
from litellm.utils import get_supported_openai_params
from onyx.configs.app_configs import LOG_DANSWER_MODEL_INTERACTIONS
from onyx.configs.app_configs import MOCK_LLM_RESPONSE
@@ -52,6 +53,8 @@ litellm.telemetry = False
_LLM_PROMPT_LONG_TERM_LOG_CATEGORY = "llm_prompt"
VERTEX_CREDENTIALS_FILE_KWARG = "vertex_credentials"
VERTEX_LOCATION_KWARG = "vertex_location"
LEGACY_MAX_TOKENS_KWARG = "max_tokens"
STANDARD_MAX_TOKENS_KWARG = "max_completion_tokens"
class LLMTimeoutError(Exception):
@@ -313,6 +316,14 @@ class DefaultMultiLLM(LLM):
self._model_kwargs = model_kwargs
self._max_token_param = LEGACY_MAX_TOKENS_KWARG
try:
params = get_supported_openai_params(model_name, model_provider)
if STANDARD_MAX_TOKENS_KWARG in (params or []):
self._max_token_param = STANDARD_MAX_TOKENS_KWARG
except Exception as e:
logger.warning(f"Error getting supported openai params: {e}")
def _safe_model_config(self) -> dict:
dump = self.config.model_dump()
dump["api_key"] = mask_string(dump.get("api_key", ""))
@@ -393,7 +404,6 @@ class DefaultMultiLLM(LLM):
messages=processed_prompt,
tools=tools,
tool_choice=tool_choice if tools else None,
max_tokens=max_tokens,
# streaming choice
stream=stream,
# model params
@@ -426,6 +436,7 @@ class DefaultMultiLLM(LLM):
if structured_response_format
else {}
),
**({self._max_token_param: max_tokens} if max_tokens else {}),
**self._model_kwargs,
)
except Exception as e:

View File

@@ -148,7 +148,6 @@ def test_multiple_tool_calls(default_multi_llm: DefaultMultiLLM) -> None:
],
tools=tools,
tool_choice=None,
max_tokens=None,
stream=False,
temperature=0.0, # Default value from GEN_AI_TEMPERATURE
timeout=30,
@@ -294,7 +293,6 @@ def test_multiple_tool_calls_streaming(default_multi_llm: DefaultMultiLLM) -> No
],
tools=tools,
tool_choice=None,
max_tokens=None,
stream=True,
temperature=0.0, # Default value from GEN_AI_TEMPERATURE
timeout=30,

View File

@@ -5,7 +5,7 @@ home: https://www.onyx.app/
sources:
- "https://github.com/onyx-dot-app/onyx"
type: application
version: 0.2.5
version: 0.2.6
appVersion: latest
annotations:
category: Productivity

View File

@@ -43,7 +43,7 @@ spec:
[
"celery",
"-A",
"onyx.background.celery.versioned_apps.docprocessing",
"onyx.background.celery.versioned_apps.docfetching",
"worker",
"--loglevel=INFO",
"--hostname=user-files-indexing@%n",

View File

@@ -154,6 +154,9 @@ export default function UpgradingPage({
re-indexed successfully, the new model will be used for all
search queries. Until then, we will use the old model so
that no downtime is necessary during this transition.
<br />
Note: User file re-indexing progress is not shown. You will
see this page until all user files are re-indexed!
</Text>
{sortedReindexingProgress ? (