sangkyoonnam commented on code in PR #1259:
URL: https://github.com/apache/flink-agents/pull/1259#discussion_r4281824624
##########
docs/content/docs/development/react_agent.md:
##########
@@ -159,15 +164,18 @@ agentsEnv.addResource(
"myTool1",
ResourceType.TOOL,
Tool.fromMethod(MyAgentExample.class.getMethod("myTool1",
String.class)));
+// Register myTool2 the same way.
```
{{< /tab >}}
{{< /tabs >}}
+Registering a Vector Store resource does not make a ReAct Agent retrieve from
it automatically. Implement retrieval explicitly, for example by exposing it as
a tool.
+
### Prompt
-User can provide prompt to instruct agent.
+The prompt is optional. Without one, the agent directly converts a Java
`String` or primitive wrapper, a Python `str`, `bool`, `int`, `float`, or
`None`, or a Java `Map`/Python `dict` whose only key is `input` into a user
message. Other structured inputs require a prompt to map their fields into one
or more user messages; otherwise, the agent rejects the input at runtime.
-A typical prompt contains two messages: a SYSTEM message that tells the agent
what to do (and gives input and output examples), and a USER message that
describes how to convert the input element into a text string. This is a
recommended pattern, not a strict requirement — the agent uses all messages in
the prompt, and the SYSTEM message is optional (if it is omitted, the framework
still prepends the output-schema instruction automatically).
+A typical prompt contains two messages: a SYSTEM message that tells the agent
what to do (and gives input and output examples), and a USER message that
describes how to convert the input element into a text string. This is a
recommended pattern, not a strict requirement — the agent uses all messages in
the prompt, and the SYSTEM message is optional. When an output schema is
configured, the framework still prepends its schema instruction if the prompt
has no SYSTEM message.
Review Comment:
The schema instruction isn't tied to a missing SYSTEM message. When an
output schema is set, `startAction` inserts the instruction right after the
prompt's first SYSTEM message, or at index 0 if there is none
(`ReActAgent.java:377-378`, `react_agent.py:326-327`). On the native path it's
the field instruction that structured-output.md describes. It also comes from
the ReAct Agent, not the framework, which is how structured-output.md puts it.
```suggestion
A typical prompt contains two messages: a SYSTEM message that tells the
agent what to do (and gives input and output examples), and a USER message that
describes how to convert the input element into a text string. This is a
recommended pattern, not a strict requirement — the agent uses all messages in
the prompt, and the SYSTEM message is optional. When an output schema is
configured, the ReAct Agent adds its own schema instruction as a SYSTEM
message, right after the prompt's first SYSTEM message or at the start if there
is none.
```
##########
docs/content/docs/development/react_agent.md:
##########
@@ -333,7 +340,7 @@ RowTypeInfo myRowTypeInfo =
{{< /tabs >}}
### Skills
-User can pass [skills]({{< ref "docs/development/calling-llms/skills" >}}) to
the constructor instead of adding a `skills` argument to the chat model
descriptor. Two forms are accepted: a list of skill names, or a `Skills` object
declaring where the skills are loaded from.
+Skills are optional. You can pass [skills]({{< ref
"docs/development/calling-llms/skills" >}}) to the constructor instead of
adding a `skills` argument to the chat model descriptor. Two forms are
accepted: a list of skill names, or a `Skills` object declaring where the
skills are loaded from.
Review Comment:
Nit on the existing wording: "instead of" reads as if constructor skills
replace the descriptor's `skills`, but the list below this paragraph says
they're combined, which matches `withSkills` / `_with_skills`.
```suggestion
Skills are optional. You can pass [skills]({{< ref
"docs/development/calling-llms/skills" >}}) to the constructor in addition to,
or instead of, a `skills` argument on the chat model descriptor; the agent uses
both. Two forms are accepted: a list of skill names, or a `Skills` object
declaring where the skills are loaded from.
```
##########
docs/content/docs/development/react_agent.md:
##########
@@ -188,9 +196,8 @@ system_prompt_str = """
my_prompt = Prompt.from_messages(
messages=[
ChatMessage.system(system_prompt_str),
- # For react agent, if the input element is not primitive types,
- # framework will deserialize input element to dict and fill the prompt.
- # Note, the input element should be primitive types, BaseModel or Row.
+ # Structured input fields are matched to the prompt placeholders.
+ # The input can be a primitive, dict, BaseModel, or Row.
Review Comment:
Nit: this prompt uses `{id}` and `{review}`, so a primitive input would
leave both unchanged. A primitive only fills `{input}`.
```suggestion
# Structured input fields (dict, BaseModel, or Row) fill the matching
# placeholders. A primitive input only fills {input}.
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]