Skip to content

feat: handle message docs correctly#975

Merged
jakelorocco merged 5 commits intomainfrom
jal/handle-message-docs
Apr 30, 2026
Merged

feat: handle message docs correctly#975
jakelorocco merged 5 commits intomainfrom
jal/handle-message-docs

Conversation

@jakelorocco
Copy link
Copy Markdown
Contributor

@jakelorocco jakelorocco commented Apr 30, 2026

Misc PR

Type of PR

  • Bug Fix
  • New Feature
  • Documentation
  • Other

Description

Adds support for printing Messages with documents attached. Adds support for attaching documents to Messages and chat interfaces. Modifies document format_for_llm to print something more in line with how intrinsics print the document.

Will need to create new issues to clean up message serialization post this change.

Testing

  • Tests added to the respective file if code was changed
  • New code has 100% coverage if code as added
  • Ensure existing tests and github automation passes (a maintainer will kick off the github automation when the rest of the PR is populated)

Attribution

  • AI coding assistants used

@jakelorocco jakelorocco changed the title Jal/handle message docs feat: handle message docs correctly Apr 30, 2026
@github-actions
Copy link
Copy Markdown
Contributor

The PR description has been updated. Please fill out the template for your PR to be reviewed.

@github-actions github-actions Bot added the enhancement New feature or request label Apr 30, 2026
Signed-off-by: Jake LoRocco <jake.lorocco@ibm.com>
Assisted-by: CLAUDE:OPUS
Signed-off-by: Jake LoRocco <jake.lorocco@ibm.com>
Assisted-by: CLAUDE:OPUS
Signed-off-by: Jake LoRocco <jake.lorocco@ibm.com>
Assisted-by: CLAUDE:OPUS
@jakelorocco jakelorocco force-pushed the jal/handle-message-docs branch 2 times, most recently from 9368e97 to b544de2 Compare April 30, 2026 16:34
Signed-off-by: Jake LoRocco <jake.lorocco@ibm.com>
Assisted-by: CLAUDE:OPUS
@jakelorocco jakelorocco force-pushed the jal/handle-message-docs branch from b544de2 to 23c3833 Compare April 30, 2026 16:55
@nrfulton nrfulton self-requested a review April 30, 2026 17:11
Comment thread mellea/formatters/template_formatter.py Outdated
Comment thread mellea/backends/ollama.py
conversation.extend(
[
{"role": m.role, "content": m.content, "images": m.images}
{"role": m.role, "content": self.formatter.print(m), "images": m.images}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

at some point we should allow components to specify roles and then remove this special case handling. Create an issue for this and reference this commend in that issue. Then go ahead with this PR.

Comment thread mellea/stdlib/components/docs/document.py Outdated
Comment thread mellea/stdlib/components/docs/document.py Outdated
Comment thread mellea/stdlib/components/docs/document.py Outdated
Comment thread mellea/templates/prompts/default/Message.jinja2
… _coerce_documents

Signed-off-by: Jake LoRocco <jake.lorocco@ibm.com>
Assisted-by: CLAUDE:OPUS
@nrfulton nrfulton self-requested a review April 30, 2026 20:52
@jakelorocco jakelorocco marked this pull request as ready for review April 30, 2026 20:53
@jakelorocco jakelorocco requested a review from a team as a code owner April 30, 2026 20:53
@jakelorocco jakelorocco enabled auto-merge April 30, 2026 20:53
@jakelorocco jakelorocco added this pull request to the merge queue Apr 30, 2026
Merged via the queue into main with commit d6fe698 Apr 30, 2026
8 checks passed
@jakelorocco jakelorocco deleted the jal/handle-message-docs branch April 30, 2026 21:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Clean up Context and Component Formatting Documents dropped in standard chat context path (generate_from_chat_context)

2 participants