-
Notifications
You must be signed in to change notification settings - Fork 185
AG-UI support in Agent Framework #4347
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AG-UI support in Agent Framework #4347
Conversation
05dfe19 to
f555403
Compare
.../main/java/org/opensearch/ml/engine/algorithms/remote/streaming/BedrockStreamingHandler.java
Outdated
Show resolved
Hide resolved
f555403 to
4721dc5
Compare
013b69d to
f8f6d12
Compare
| builder.field("message", message); | ||
| if (code != null) { | ||
| builder.field("code", code); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can message be null?
|
|
||
| public RunErrorEvent(String message, String code) { | ||
| super(TYPE, System.currentTimeMillis(), null); | ||
| this.message = message != null ? message : ""; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
similar comment as below, can we just keep this as null? instead of empty and then not write or read if null
| @EqualsAndHashCode(callSuper = true) | ||
| public class RunErrorEvent extends BaseEvent { | ||
|
|
||
| public static final String TYPE = "RUN_ERROR"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: can be enum
common/src/main/java/org/opensearch/ml/common/agui/TextMessageStartEvent.java
Show resolved
Hide resolved
|
|
||
| @Override | ||
| @SuppressWarnings("unchecked") | ||
| public <T> void run(Map<String, String> parameters, ActionListener<T> listener) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can throw an exception instead of error message
| wrappedTools.put(toolName, frontendToolObj); | ||
| } | ||
|
|
||
| return wrappedTools; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might be missing a bracket }
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good catch, not sure how that happened
| } else { | ||
| log.error("AG-UI: Invalid function calling configuration: {}", llmInterface); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this fail in this case? what happens here?
ml-algorithms/src/main/java/org/opensearch/ml/engine/algorithms/agent/MLAGUIAgentRunner.java
Show resolved
Hide resolved
ml-algorithms/src/main/java/org/opensearch/ml/engine/algorithms/agent/MLAGUIAgentRunner.java
Show resolved
Hide resolved
|
|
||
| // Initialize AG-UI message state for this LLM response | ||
| if (isAGUIAgent) { | ||
| messageId = "msg_" + System.currentTimeMillis() + "_" + System.nanoTime(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can just use nano tiime? is this some standard?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or UUID?
plugin/src/main/java/org/opensearch/ml/rest/RestMLExecuteStreamAction.java
Outdated
Show resolved
Hide resolved
plugin/src/main/java/org/opensearch/ml/rest/RestMLExecuteStreamAction.java
Show resolved
Hide resolved
.../main/java/org/opensearch/ml/engine/algorithms/remote/streaming/BedrockStreamingHandler.java
Show resolved
Hide resolved
|
|
||
| assistantMessage.getContent().add(Map.of("toolUse", toolUse)); | ||
| } | ||
| } catch (Exception e) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
log the error?
| String threadId = inputDataSet.getParameters().get(AGUI_PARAM_THREAD_ID); | ||
| return threadId != null ? threadId : "thread_" + System.currentTimeMillis(); | ||
| } | ||
| return "thread_" + System.currentTimeMillis(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
will it cause a problem if the IDs are same in case multiple calls at made at the same time?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no, IDs are just dummy values at the moment. When we integrate this with memory we can start using proper IDs.
24dd435 to
01cfec3
Compare
Signed-off-by: Jiaping Zeng <[email protected]>
Signed-off-by: Jiaping Zeng <[email protected]>
52c36e1 to
3bddf55
Compare
d698896
into
opensearch-project:feature/3.4-release-prep
|
thanks, will address other comments in follow up PR |
Description
Add AG-UI support in Agent Framework
Related Issues
Resolves #4409
Check List
--signoff.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.
Sample setup:
Sample requests:
request:
response:
request:
response: