-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from phillip-kruger/javadoc
Javadoc
- Loading branch information
Showing
5 changed files
with
61 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package org.chappiebot.doc; | ||
|
||
import dev.langchain4j.service.SystemMessage; | ||
import dev.langchain4j.service.UserMessage; | ||
import io.quarkiverse.langchain4j.RegisterAiService; | ||
|
||
@RegisterAiService | ||
@SystemMessage(""" | ||
You are an AI assistant helping to add or modify {doc} in {programmingLanguage} code from a {product} {version} application. | ||
You will receive the code that needs the {doc}. Please use that as input when considering the response. | ||
Approach this task step-by-step, take your time and do not skip steps. | ||
Respond with the original input source code, but now enhance with the {doc} on class and method levels. | ||
This response must be valid {programmingLanguage}. Only include the {programmingLanguage} code, no explanation or other text. | ||
You must not wrap {programmingLanguage} response in backticks, markdown, or in any other way, but return it as plain text. | ||
""") | ||
public interface DocAssistant { | ||
|
||
@UserMessage(""" | ||
I have the following {programmingLanguage} class: | ||
``` | ||
{source} | ||
``` | ||
{extraContext} | ||
Please add or modify the {doc} to reflect the code. | ||
""") | ||
public String addDoc(String programmingLanguage, String product, String version, String extraContext, String doc, String source); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package org.chappiebot.doc; | ||
|
||
import io.quarkiverse.jsonrpc.runtime.api.JsonRPCApi; | ||
import jakarta.inject.Inject; | ||
|
||
/** | ||
* The JsonRPC Endpoint for doc creation | ||
* @author Phillip Kruger (phillip.kruger@gmail.com) | ||
*/ | ||
@JsonRPCApi("doc") | ||
public class DocEndpoint { | ||
|
||
@Inject DocAssistant docAssistant; | ||
|
||
public String addDoc(String programmingLanguage, | ||
String product, | ||
String version, | ||
String extraContext, | ||
String doc, | ||
String source) { | ||
|
||
return docAssistant.addDoc(programmingLanguage, product, version, extraContext, doc, source); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters