Look up events in local LLM.#226
Open
MatthewKhouzam wants to merge 3 commits intoeclipse-tracecompass:masterfrom
Open
Look up events in local LLM.#226MatthewKhouzam wants to merge 3 commits intoeclipse-tracecompass:masterfrom
MatthewKhouzam wants to merge 3 commits intoeclipse-tracecompass:masterfrom
Conversation
Addresses bug 211 [Added] Ability to have background markers Change-Id: Ie681f5577b5e9abdb8ebeb75c456f860625af1cb Signed-off-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
The original alpha made it harder to read. [Changed] reduced default alpha on bookmarks Change-Id: I692d19d51bef2fa4bf41b3b763e21547b89e9444 Signed-off-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
[added] TraceGPT Change-Id: I5dc5e397c0034eebb21860d64ffca90906e95a51 Signed-off-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
eeb5b46 to
f46e327
Compare
HishamLadha
reviewed
Mar 18, 2025
HishamLadha
left a comment
There was a problem hiding this comment.
Overall, this is amazing 💯 I just added a couple of comments and potential room for improvement!
| } | ||
| }; | ||
| String ollamaUrl = "http://localhost:11434"; | ||
| final IAction lookupInLLMAction = new Action("Lookup in local LLM", IAction.AS_PUSH_BUTTON) { |
There was a problem hiding this comment.
Could change "Lookup in local LLM" to be "Explain event with local LLM" to make it more descriptive to a user.
| values.put(column.getText(), fTable.getSelection()[0].getText(i)); | ||
| } | ||
| } | ||
| Job jerb = new Job("llm") { |
There was a problem hiding this comment.
Could change "llm" to be "LLM Event Lookup" :)
| JSONObject jsonObj = new JSONObject(response.toString()); | ||
| String data = String.valueOf(jsonObj.get("response")); | ||
| IProject project = fTrace.getResource().getProject(); | ||
| IFile file = project.getFile("event.txt"); |
There was a problem hiding this comment.
- Naming of the file could be more specific as this gets overwritten every time.
- I suggest that the current time could be added to each event text file like this:
IFile file = project.getFile("event_" + System.currentTimeMillis() + ".txt");
| JSONObject jsonPayload = new JSONObject(); | ||
| jsonPayload.put("model", "llama3.2"); // Specify the | ||
| // model | ||
| jsonPayload.put("prompt", "I have an event from a trace of type " + trace.getTraceTypeId() + " in that there is an event content " + values.toString() + " explain it."); // Your |
There was a problem hiding this comment.
- I love this. However, I think this can be improved to make it easier for the LLM to parse particularly because LLMs love a specific format like this:
Explain the following trace event:
Trace Type: org.eclipse.tracecompass.some.type
Event Details:
- Timestamp: 123456789
- Event Name: ThreadStart
- PID: 12
- I think a format similar to the one below could be used and I have drafted up a quick mockup of how this could look. However, I haven't tested the following code:
StringBuilder prompt = new StringBuilder();
prompt.append("Explain the following trace event:\n");
prompt.append("Trace Type: ").append(trace.getTraceTypeId()).append("\n");
prompt.append("Event Details:\n");
for (Map.Entry<String, String> entry : values.entrySet()) {
prompt.append("- ").append(entry.getKey()).append(": ").append(entry.getValue()).append("\n");
}
jsonPayload.put("prompt", prompt.toString());
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What it does
Adds a context menu to the events table if there's a local ollama running.
How to test
Install ollama. Install llama3.2 (ollama pull llama3.2). ollama serve. Then run it and right click on a row.
Follow-ups
Review checklist