Repository navigation
fix(memory): preserve text parts after multimodal user prompts - #300
Open
Cookie0103 wants to merge 1 commit into
Open
Cookie0103 wants to merge 1 commit into
Cookie0103 wants to merge 1 commit into
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When
ContextManager.add_user_prompt()receives multimodal content followed by a string, it applieslist += string. The follow-up text becomes one array entry per character, so the conversation contains invalid content parts instead of a text block. For example, adding an image and then"Describe this image."corrupts the user message sent to the model.Append a structured
{"type": "text", "text": ...}part when the existing user content is a list. Preserve the current text/text, text/list and list/list behavior. The parameterized regression covers all four combinations in native and prompt-based tool-calling modes and checks that caller-owned input lists are not changed.Validation (Python 3.12, repository requirements installed):
pytest tests/ -q --maxfail=3: 277 passed, 8 warnings.LITELLM_LOCAL_MODEL_COST_MAP=Trueand an emptyOPENAI_API_KEYwere used; no live model request was used. The first sandboxed attempt could not download the public GSM8K fixture or create multiprocessing sockets; the authorized rerun passed.git diff --checkpasses. Repository-wide Ruff currently reports existing violations. The changed production module has the same eight annotation-modernization diagnostics on the unmodified base and this branch; this PR does not reformat unrelated code.AI assistance: Codex investigated, implemented and ran these checks on behalf of the account owner. The account owner has not independently reviewed or tested the contribution.