Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
281 changes: 281 additions & 0 deletions HYPERDRIVE_DEVELOPER_CONTEXT.md

Large diffs are not rendered by default.

377 changes: 377 additions & 0 deletions HYPERDRIVE_ROADMAP.md

Large diffs are not rendered by default.

46 changes: 46 additions & 0 deletions src/main/java/edu/jhuapl/trinity/AppAsyncManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
import edu.jhuapl.trinity.data.messages.xai.FeatureCollection;
import edu.jhuapl.trinity.data.messages.xai.FeatureVector;
import edu.jhuapl.trinity.javafx.components.MatrixOverlay;
import edu.jhuapl.trinity.javafx.components.hyperdrive.JsonExtractionProfile;
import edu.jhuapl.trinity.javafx.components.hyperdrive.JsonSchemaMappingPane;
import edu.jhuapl.trinity.javafx.components.hyperdrive.TopicDiscoveryEngine;
import edu.jhuapl.trinity.javafx.components.hyperdrive.TopicDiscoveryReviewPane;
import edu.jhuapl.trinity.javafx.components.panes.AnalysisLogPane;
import edu.jhuapl.trinity.javafx.components.panes.CocoViewerPane;
import edu.jhuapl.trinity.javafx.components.panes.FeatureVectorManagerPane;
Expand Down Expand Up @@ -43,6 +47,7 @@
import edu.jhuapl.trinity.javafx.events.FeatureVectorEvent;
import edu.jhuapl.trinity.javafx.events.GaussianMixtureEvent;
import edu.jhuapl.trinity.javafx.events.HitEvent;
import edu.jhuapl.trinity.javafx.events.HyperdriveEvent;
import edu.jhuapl.trinity.javafx.events.ManifoldEvent;
import edu.jhuapl.trinity.javafx.events.MissionTimerXEvent;
import edu.jhuapl.trinity.javafx.events.RestEvent;
Expand Down Expand Up @@ -143,6 +148,8 @@ public class AppAsyncManager extends Task<Void> {
PixelSelectionPane pixelSelectionPane;
ImageInspectorPane imageInspectorPane;
HyperdrivePane hyperdrivePane;
JsonSchemaMappingPane jsonSchemaMappingPane;
TopicDiscoveryReviewPane topicDiscoveryReviewPane;
MatrixOverlay matrixOverlay;
RetroWavePane retroWavePane = null;

Expand Down Expand Up @@ -775,6 +782,45 @@ protected Void call() throws Exception {
projectorPane.scanAndAnimate();
}
});
// Hyperdrive editor overlays are independent LitPathPanes on the shared desktop.
// Hyperdrive and each overlay communicate only through HyperdriveEvent.
scene.addEventHandler(HyperdriveEvent.OPEN_JSON_SCHEMA_MAPPING, event -> {
JsonExtractionProfile profile = event.object1 instanceof JsonExtractionProfile p ? p.copy() : null;
if (jsonSchemaMappingPane != null && desktopPane.getChildren().contains(jsonSchemaMappingPane)) {
jsonSchemaMappingPane.toFront();
jsonSchemaMappingPane.show();
return;
}
jsonSchemaMappingPane = new JsonSchemaMappingPane(scene, desktopPane, profile);
desktopPane.getChildren().add(jsonSchemaMappingPane);
jsonSchemaMappingPane.setLayoutX(Math.max(20, (desktopPane.getWidth() - 1120) / 2));
jsonSchemaMappingPane.setLayoutY(Math.max(20, (desktopPane.getHeight() - 710) / 2));
jsonSchemaMappingPane.toFront();
jsonSchemaMappingPane.slideInPane();
});
scene.addEventHandler(HyperdriveEvent.OPEN_TOPIC_REVIEW, event -> {
if (!(event.object1 instanceof java.util.List<?> list)
|| !list.stream().allMatch(TopicDiscoveryEngine.Topic.class::isInstance)) return;
java.util.List<TopicDiscoveryEngine.Topic> topics = new java.util.ArrayList<>();
for (Object candidate : list) topics.add((TopicDiscoveryEngine.Topic) candidate);
if (topicDiscoveryReviewPane != null && desktopPane.getChildren().contains(topicDiscoveryReviewPane)) {
topicDiscoveryReviewPane.toFront();
topicDiscoveryReviewPane.show();
return;
}
topicDiscoveryReviewPane = new TopicDiscoveryReviewPane(scene, desktopPane, topics);
desktopPane.getChildren().add(topicDiscoveryReviewPane);
topicDiscoveryReviewPane.setLayoutX(Math.max(20, (desktopPane.getWidth() - 1000) / 2));
topicDiscoveryReviewPane.setLayoutY(Math.max(20, (desktopPane.getHeight() - 690) / 2));
topicDiscoveryReviewPane.toFront();
topicDiscoveryReviewPane.slideInPane();
});
scene.addEventHandler(HyperdriveEvent.CLOSE_TOPIC_REVIEW, event -> {
if (topicDiscoveryReviewPane != null) {
topicDiscoveryReviewPane.close();
topicDiscoveryReviewPane = null;
}
});
scene.addEventHandler(ApplicationEvent.SHOW_HYPERDRIVE_PANE, e -> {
if (!desktopPane.getChildren().contains(hyperdrivePane)) {
desktopPane.getChildren().add(hyperdrivePane);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,14 @@ public class ChatCompletionsOutput extends MessageData {
//</editor-fold>

//<editor-fold defaultstate="collapsed" desc="Payload Fields">
private String id;
private Long created;
private String object;
private String model;
private String prompt;
private List<ChatCompletionChoice> choices;
private ChatGenerationParameters generation_parameters;
private ChatUsage usage;

//</editor-fold>
//extra helper fields
Expand All @@ -74,6 +77,30 @@ public ChatCompletionsOutput() {

//<editor-fold defaultstate="collapsed" desc="Properties">

public String getId() {
return id;
}

public void setId(String id) {
this.id = id;
}

public Long getCreated() {
return created;
}

public void setCreated(Long created) {
this.created = created;
}

public ChatUsage getUsage() {
return usage;
}

public void setUsage(ChatUsage usage) {
this.usage = usage;
}

/**
* @return the object
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public class ChatGenerationParameters {

*/
private List<String> bad_words;
private String stop;
private Stop stop;
private Integer output_length;
private Integer top_k;
private Integer top_p;
Expand Down Expand Up @@ -65,14 +65,14 @@ public void setBad_words(List<String> bad_words) {
/**
* @return the stop
*/
public String getStop() {
public Stop getStop() {
return stop;
}

/**
* @param stop the stop to set
*/
public void setStop(String stop) {
public void setStop(Stop stop) {
this.stop = stop;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package edu.jhuapl.trinity.data.messages.llm;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;

/**
* Token counts provided by a chat completion response.
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
public class ChatUsage {
private Integer completion_tokens;
private Integer prompt_tokens;
private Integer total_tokens;

public ChatUsage() {
}

public Integer getCompletion_tokens() {
return completion_tokens;
}

public void setCompletion_tokens(Integer completion_tokens) {
this.completion_tokens = completion_tokens;
}

public Integer getPrompt_tokens() {
return prompt_tokens;
}

public void setPrompt_tokens(Integer prompt_tokens) {
this.prompt_tokens = prompt_tokens;
}

public Integer getTotal_tokens() {
return total_tokens;
}

public void setTotal_tokens(Integer total_tokens) {
this.total_tokens = total_tokens;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package edu.jhuapl.trinity.data.messages.llm;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import java.util.List;

/** OpenAI-compatible batch of text inputs (one embedding per input string). */
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
public class EmbeddingsTextBatchInput {
private Object input;
private String model;
private String encoding_format = "float";
private String embedding_type = "all";
private int dimensions = 512;
private String user = "string";

public Object getInput() { return input; }
public void setInput(List<String> input) { this.input = input; }
public void setInput(String input) { this.input = input; }
public String getModel() { return model; }
public void setModel(String model) { this.model = model; }
public String getEncoding_format() { return encoding_format; }
public void setEncoding_format(String value) { encoding_format = value; }
public String getEmbedding_type() { return embedding_type; }
public void setEmbedding_type(String value) { embedding_type = value; }
public int getDimensions() { return dimensions; }
public void setDimensions(int value) { dimensions = value; }
public String getUser() { return user; }
public void setUser(String value) { user = value; }
}
Original file line number Diff line number Diff line change
@@ -1,16 +1,30 @@
package edu.jhuapl.trinity.data.messages.llm;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;

import java.util.ArrayList;
import java.util.List;

/**
* @author Sean Phillips
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties(ignoreUnknown = true)
public class ResponseChatMessage {
private String role;
private String content;
private String reasoning_content;
private List<String> tool_calls;

public String getReasoning_content() {
return reasoning_content;
}

public void setReasoning_content(String reasoning_content) {
this.reasoning_content = reasoning_content;
}

public ResponseChatMessage() {
tool_calls = new ArrayList<>();
}
Expand Down
36 changes: 36 additions & 0 deletions src/main/java/edu/jhuapl/trinity/data/messages/llm/Stop.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package edu.jhuapl.trinity.data.messages.llm;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;

import java.util.ArrayList;
import java.util.List;

/**
* Stop sequences returned in chat generation parameters.
*
* The observed response shape is a nested array, such as [[""]],
* rather than a JSON object. This value object preserves that shape
* with standard Jackson binding annotations.
*/
public class Stop {
private List<List<String>> sequences;

public Stop() {
this.sequences = new ArrayList<>();
}

@JsonCreator(mode = JsonCreator.Mode.DELEGATING)
public Stop(List<List<String>> sequences) {
this.sequences = sequences;
}

@JsonValue
public List<List<String>> getSequences() {
return sequences;
}

public void setSequences(List<List<String>> sequences) {
this.sequences = sequences;
}
}
Loading
Loading