Skip to content
This repository was archived by the owner on Jul 16, 2025. It is now read-only.

Conversation

@OskarStark
Copy link
Contributor

@OskarStark OskarStark commented Jan 4, 2025

Closes

Leverage

If I am correct, it is not needed to register it also as an OutputProcessor, right?

@OskarStark OskarStark self-assigned this Jan 4, 2025
@OskarStark OskarStark requested a review from chr-hertel January 4, 2025 21:34
@OskarStark
Copy link
Contributor Author

OskarStark commented Jan 4, 2025

The processor is used and the system_prompt is added to the request, so it works.

But lets say we have this flow:

  1. Empty MessageBag
  2. Add UserMessage to MessageBag
  3. Call the chain with MessageBag with 1 User message
  4. Internally the chain adds the system prompt message from the config
  5. In our call() method we now have a MessageBag with System + User message
  6. We get the response, but our Bag does not have access to the system message anymore

In my world, I would like to end up somehow with a MessageBag (System, User, Assistant) - 3 messages, but in this case I would need access to the system prompt 🤔

@OskarStark OskarStark added the enhancement New feature or request label Jan 4, 2025
@OskarStark
Copy link
Contributor Author

I mean technically if I add another user message and call the chain again the system prompt would be prepended again, yes.

I would like to a) persist the correct version, because the user could chat again in my thread in a few weeks, so the system prompt could change in the meantime and b) also have it somewhere for debugging.

@chr-hertel
Copy link
Member

If I am correct, it is not needed to register it also as an OutputProcessor, right?

correct 👍

@chr-hertel
Copy link
Member

but you are right. the MessageBag from lib user land is never changed, it is cloned while changed.

debugging with the bundle features would show the extended MessageBag with the system prompt tho.

currently it's default behavior that the lib's user has to manage all messages themselves - the processor just adds it on the fly and it is intransparent. same with all the tool call messages. they also don't appear in the user's MessageBag - which is by design

@chr-hertel
Copy link
Member

PR looks good to me 👍 would test it later

@chr-hertel chr-hertel force-pushed the feature/system-prompt branch from bcff720 to 66fe617 Compare January 5, 2025 15:52
@chr-hertel chr-hertel merged commit 3406794 into main Jan 5, 2025
7 checks passed
@chr-hertel chr-hertel deleted the feature/system-prompt branch January 5, 2025 16:00
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants