Skip to content

Commit 9e01517

Browse files
authored
Merge pull request #50517 from phillip-kruger/assistant-remove-exception
Assistant: Remove unused exception method
2 parents ca55528 + 943128d commit 9e01517

File tree

1 file changed

+1
-59
lines changed
  • extensions/assistant/runtime-dev/src/main/java/io/quarkus/assistant/runtime/dev

1 file changed

+1
-59
lines changed

extensions/assistant/runtime-dev/src/main/java/io/quarkus/assistant/runtime/dev/Assistant.java

Lines changed: 1 addition & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,10 @@ public interface Assistant {
1616
/**
1717
* Check if the assistant is available
1818
*
19-
* @return true id there is an implementation that is configured and connected
19+
* @return true if there is an implementation that is configured and connected
2020
*/
2121
public boolean isAvailable();
2222

23-
/**
24-
* Explain and suggest a fix for an exception in the user code
25-
*
26-
* @param <T>
27-
* @param systemMessage System wide context
28-
* @param userMessage User specific context
29-
* @param stacktrace The exception stacktrace
30-
* @param path The path to the effective class causing this exception
31-
* @return
32-
*/
33-
<T> CompletionStage<T> exception(Optional<String> systemMessage, String userMessage, String stacktrace,
34-
Path path);
35-
3623
/**
3724
* Assist the developer with something
3825
*
@@ -47,10 +34,6 @@ <T> CompletionStage<T> assist(Optional<String> systemMessageTemplate,
4734
String userMessageTemplate,
4835
Map<String, String> variables, List<Path> paths, Class<?> responseType);
4936

50-
default ExceptionBuilder exceptionBuilder() {
51-
return new ExceptionBuilder(this);
52-
}
53-
5437
default AssistBuilder assistBuilder() {
5538
return new AssistBuilder(this);
5639
}
@@ -122,45 +105,4 @@ public <T> CompletionStage<T> assist() {
122105
}
123106
}
124107

125-
class ExceptionBuilder {
126-
private final Assistant assistant;
127-
128-
private Optional<String> systemMessage = Optional.empty();
129-
private String userMessage;
130-
private String stacktrace;
131-
private Path path;
132-
133-
ExceptionBuilder(Assistant assistant) {
134-
this.assistant = assistant;
135-
}
136-
137-
public ExceptionBuilder systemMessage(String systemMessage) {
138-
this.systemMessage = Optional.ofNullable(systemMessage);
139-
return this;
140-
}
141-
142-
public ExceptionBuilder userMessage(String userMessage) {
143-
this.userMessage = userMessage;
144-
return this;
145-
}
146-
147-
public ExceptionBuilder stacktrace(String stacktrace) {
148-
this.stacktrace = stacktrace;
149-
return this;
150-
}
151-
152-
public ExceptionBuilder path(Path path) {
153-
this.path = path;
154-
return this;
155-
}
156-
157-
@SuppressWarnings("unchecked")
158-
public <T> CompletionStage<T> explain() {
159-
if (userMessage == null || stacktrace == null || path == null) {
160-
throw new IllegalStateException("userMessage, stacktrace, and path must be provided");
161-
}
162-
return (CompletionStage<T>) assistant.exception(systemMessage, userMessage, stacktrace, path);
163-
}
164-
}
165-
166108
}

0 commit comments

Comments
 (0)