Repository navigation
Send a chat message's participant name to the provider - #358
Merged
Merged
Conversation
Imp.Clients.ReqLLM copies a message's name (atom or string key) onto the ReqLLM message, which OpenAI-compatible providers serialize. The Chat adapter names a history turn's messages from :user_name and :assistant_name, and the request message from the inputs' :user_name.
deepfates
added a commit
that referenced
this pull request
Oct 18, 2026
* Warn about user_name unless the adapter names messages; note where name is not shown Imp.Predict exempts :user_name from the extra-input warning only for the adapters that build messages with Chat's assembly (Chat, JSON, XML, PlanFirst); any other adapter ignores it, so the warning stays. The Chat docs note that many upstreams accept name without showing it to the model. * Prepare Imp 0.16.2 release Version 0.16.2 with tag links for v0.16.2; install lines stay ~> 0.16.0, as for earlier patch releases. The changelog's Unreleased section goes under 0.16.2, and the release notes describe #358 and the follow-up. * Make the release Imp 0.17.0 The new :user_name and :assistant_name input keys are public API a caller can rely on, so under Imp's versioning rule this is a minor release: version 0.17.0, install lines ~> 0.17.0, tag links for v0.17.0, the changelog heading 0.17.0, and release notes for upgrading from 0.16.1. * Rewrap the 0.17.0 release notes' rollback paragraph
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.
What
A chat message's optional participant
name(OpenAI chat format) now reaches the provider. Before, Imp dropped it in two places.Imp.Clients.ReqLLMread only role, content and tool calls when it built ReqLLM messages, soImp.LM.generate(lm, [%{role: "user", content: "hi", name: "alice"}])went out with noname. It now copiesname(atom or string key) onto theReqLLM.Message, whose OpenAI-compatible encoder writes it to the body. It only sets the name when the message has a non-empty one, so an unnamed message goes out exactly as before. Anthropic's encoder has no such field and ignores it. Generate, stream and batch all build their messages through the sameto_req_messages/2, so this one change covers all three.Imp.Adapter.Chatbuilt every history turn and the final request as%{role:, content:}only, so a host had no way to name a message.API for hosts
History turns are signature-shaped field maps, and they already carry recorded keys besides the fields (
tool_calls,next_thought,reasoning_details). Naming follows the same pattern::user_nameon a turn names that turn's user message.:assistant_namenames its assistant message, including a native tool turn's assistant message. Tool results and notes are never named.:user_namein the request inputs names the final user message.Imp.Predictno longer warns about it as an extra input.user_nameorassistant_name, that field stays an ordinary field, so a key never means two things.The keys are not bare
namebecause a signature field callednameis common, and reusing it would turn an input value into a participant name.Documented under "Naming messages" in
Imp.Adapter.Chat, with a pointer fromImp.History. CHANGELOG has an Unreleased "Added" entry.Not changed
roleandcontent(its protocol checks keys exactly), so it still ignores names.Tests
user_namethrough tostream_text.user_namethat stays a field, andImp.Predictwith no extra-input warning.mix check,quality.checkanddialyzer.checkall pass.