c56bef871b
CodeQL / Analyze (python) (push) Has been cancelled
Update Platform Components Table / update (push) Has been cancelled
Docker image release / Build base image (push) Has been cancelled
Sync docs with Docusaurus / sync (push) Has been cancelled
Tests / Check if changed (push) Has been cancelled
Tests / format (push) Has been cancelled
Tests / check-imports (push) Has been cancelled
Tests / Unit / macos-latest (push) Has been cancelled
Tests / Unit / ubuntu-latest (push) Has been cancelled
Tests / Unit / windows-latest (push) Has been cancelled
Tests / mypy (push) Has been cancelled
Tests / Integration / ubuntu-latest (push) Has been cancelled
Tests / Integration / macos-latest (push) Has been cancelled
Tests / Integration / windows-latest (push) Has been cancelled
Tests / notify-slack-on-failure (push) Has been cancelled
Tests / Mark tests as completed (push) Has been cancelled
34 lines
1.6 KiB
YAML
34 lines
1.6 KiB
YAML
---
|
|
upgrade:
|
|
- |
|
|
The ``user_prompt`` and ``system_prompt`` parameters have been removed from ``Agent.run`` / ``Agent.run_async``
|
|
and ``LLM.run`` / ``LLM.run_async``. Both prompts must now be set at initialization time on the component; they
|
|
can no longer be overridden per-run, including when the component is used inside a pipeline
|
|
(``Pipeline.run(data={"agent": {"user_prompt": ...}})`` or ``Pipeline.run(data={"llm": {"user_prompt": ...}})``
|
|
is no longer supported).
|
|
|
|
``system_prompt`` and ``user_prompt`` both accept either a plain string template or an explicit Jinja2
|
|
message template. Plain string templates are rendered as a single message with the expected role
|
|
(``system`` for ``system_prompt``, ``user`` for ``user_prompt``). Explicit Jinja2 message templates must
|
|
contain a single message block and render to exactly one message with the matching role.
|
|
|
|
Before:
|
|
|
|
.. code:: python
|
|
|
|
agent = Agent(chat_generator=..., tools=[...], system_prompt="Default system prompt.")
|
|
agent.run(messages=[...], system_prompt="Per-run override.")
|
|
|
|
After:
|
|
|
|
.. code:: python
|
|
|
|
# Construct a new Agent or LLM with the desired prompt.
|
|
agent = Agent(chat_generator=..., tools=[...], system_prompt="Default system prompt.")
|
|
agent.run(messages=[...])
|
|
|
|
# If you need to build prompts at runtime, construct an Agent without
|
|
# init prompts and pass the prompt messages through the messages input.
|
|
agent = Agent(chat_generator=..., tools=[...])
|
|
agent.run(messages=[ChatMessage.from_system("Runtime system prompt."), ChatMessage.from_user("...")])
|