Skip to content

fix(frameworks): keep full multi-message context in input.value (mistralai, vertexai, langchain) - #248

Open
jjcav84 wants to merge 1 commit into
future-agi:devfrom
jjcav84:fix/input-value-context-remaining
Open

jjcav84 wants to merge 1 commit into
future-agi:devfrom
jjcav84:fix/input-value-context-remaining

Conversation

@jjcav84

@jjcav84 jjcav84 commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?

Completes the INPUT_VALUE first-message-only defect family from #151 across the remaining affected framework handlers:

Package Bug shape Fix
mistralai _process_input_messages eval_input[0] yielded after the joined text drop the last yield
vertexai wrapper query (eval_input[0]) set after eval_input remove the write + the query key from _extract_image_data
langchain _tracer _as_query(query) sat last in the attribute chain remove it + move _as_eval_input last so the joined text wins; drop query from _filter_images

All three now end on the joined multi-message text — the same final value as openai (#245), litellm (#246), anthropic (#247), and the already-correct dspy/groq handlers.

Swept every framework dir for eval_input[0]/"query" last-write patterns — this closes the family; nothing else inverts the order.

Two supporting fixes ride along because the bug can't be observed without them:

  • mistralai dependency bound: mistralai = ">=1.0.2" admitted 3.x, which restructured the package — mistralai.utils.eventstreaming (imported by _chat_wrapper.py) no longer exists, so the wrapper couldn't even be imported. Bounded to >=1.0.2,<2; verified working on 1.12.4. poetry.lock regenerates on a supported Python (uvx poetry lock fails here on a pre-existing python-versions mismatch, unrelated to this bound).
  • Stale assertion repairs so the regression tests are actually observable: llm.* → gen_ai.* emitted names (vertexai), raw.input → input.value (mistralai), instrumentor dependency count after f7c1d4e removed futureagi, and _send_span_data_to_api no-op assertion (langchain — input/output moved to gen_ai.* attributes in the migration).

Why?

Same reported bug as #151: multi-message inputs were reduced to the first message in input.value.

How was it tested?

  • Unit tests added — TestInputValueMultiMessage in each package's test file (joined text preserves all messages; query key absent; langchain _filter_images returns the 3-tuple)
  • pytest tests/test_framework_mistralai.py tests/test_framework_vertexai.py tests/test_framework_langchain.py — 141/141 pass (mistralai run under mistralai==1.12.4, inside the new <2 bound)
  • test_extract_image_data_empty updated — it asserted the removed query key
  • mistralai behavior additionally verified standalone (_utils.py loaded directly): final INPUT_VALUE = 'sys\nq1\na1\nq2' — all messages present

Checklist

  • Branch is off main
  • Conventional Commits (fix(frameworks): …, test(frameworks): …)
  • No TODOs or commented-out code
  • No secrets in the diff

@jjcav84

jjcav84 commented Oct 22, 2026

Copy link
Copy Markdown
Contributor Author

Bump — fixes multi-message context truncation in input.value. Mergeable.

Remaining instances of the future-agi#151 defect family (openai future-agi#245, litellm
eval_input with a first-message-only "query" as the last INPUT_VALUE
write.

- mistralai: drop the trailing eval_input[0] yield so the joined text
  is the last write
- vertexai: remove the query set_attribute and the "query" key from
  _extract_image_data
- langchain: remove _as_query from the span attribute chain and move
  _as_eval_input last so the joined text wins INPUT_VALUE; drop the
  query element from _filter_images and the now-unused _as_query helper

Generated with Devin
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@jjcav84
jjcav84 force-pushed the fix/input-value-context-remaining branch from 149ebb4 to 4e04a90 Compare November 6, 2026 00:33
@jjcav84
jjcav84 changed the base branch from main to dev November 6, 2026 00:33

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant