Skip to content

feat: [OpenAI] Sample code for Agentic Workflow tutorial #466

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

Merged
merged 9 commits into from
Aug 7, 2025

Conversation

Jonas-Isr
Copy link
Member

Context

AI/ai-sdk-java-backlog#266

This PR adds sample code for the Java agentic workflow tutorial (link to docs PR is below).

Feature scope:

  • add sample code

Definition of Done

  • Functionality scope stated & covered
  • Tests cover the scope above
  • Error handling created / updated & covered by the tests above
  • Aligned changes with the JavaScript SDK
  • Documentation updated: PR
  • Release notes updated

@Jonas-Isr Jonas-Isr self-assigned this Jun 17, 2025
@Jonas-Isr Jonas-Isr added the please-review Request to review a pull-request label Jun 17, 2025
for (final String systemPrompt : systemPrompts) {

// Combine the pre-defined prompt with the previous answer to get the new input
val input = String.format("{%s}\n {%s}", systemPrompt, responseText);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Preference)

Looks like here we are mixing system prompt with user prompt, which should not be encouraged. I am assuming this is a simplification for the sake of demonstration. But, I would prefer if we distinguish the usage of user and system message correctly.

That said, SpringAi docs also seems to simply concatenate the messages, which is sus to me. Let me know if I missed something.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would agree with you initially. But then I realized "responseText" reference is updated with the LLM response from previous step in line 71. Meaning there is no classic distinction user/system/assistant, they get mixed when the second iteration starts.

@Jonas-Isr Jonas-Isr removed the please-review Request to review a pull-request label Jul 22, 2025
newtork
newtork previously approved these changes Aug 7, 2025
@newtork newtork enabled auto-merge (squash) August 7, 2025 15:43
newtork
newtork previously approved these changes Aug 7, 2025
@newtork newtork merged commit 6b40faf into main Aug 7, 2025
7 checks passed
@newtork newtork deleted the agent-workflow-examples branch August 7, 2025 15:52
@newtork newtork added the please-review Request to review a pull-request label Aug 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
please-review Request to review a pull-request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants