create proof of concept for flowy.stream #48
Reference in New Issue
Block a user
Delete Branch "stream-proof-of-concept"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Pull Request Overview
This PR adds a proof-of-concept CLI application (
stream_app) that integrates llama.cpp to generate intent-based suggestions in a conversational loop.main.cwhich loads a Phi model via llama.cpp, tokenizes a prompt, and streams generated tokens.Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 6 comments.
Show a summary per file
stream_app, including include paths and libraries@@ -0,0 +4,4 @@## Todo- [x] Integrate llama.cpp with local inference. This will set us up for building many parts of experience.- [ ] Disect what llama is doing and what the Phi model is doing.Typo in the list: 'Disect' should be spelled 'Dissect'.
@@ -0,0 +1,176 @@#include "thirdparty/llama.cpp/ggml/include/ggml-backend.h"[nitpick] The include path is overly verbose and ties the code to repository layout. Since your Makefile adds
-Ithirdparty/llama.cpp/ggml/include, using#include <ggml-backend.h>improves readability.@@ -0,0 +16,4 @@int main(int argc, char *argv[]) {printf("Hello world\n");[nitpick] Remove this leftover debugging print; the generic greeting is unnecessary in the production proof-of-concept.
@@ -0,0 +25,4 @@snprintf(prompt, sizeof(prompt), "<|system|>You are a helpful assistant. Your goal is to take in what the user is doing and return 3 predictive actions/3 suggestions based on what the user is trying to do: e.g. change page title when in google sheets, or calculate sum, create chart.<|end|>\n<|user|>%s<|end|>\n<|assistant|>", user_input);// number of layers to offload to the GPUint ngl = 99;[nitpick] Using a magic number for GPU layer count reduces clarity. Consider defining a named constant or making this a runtime parameter.
@@ -0,0 +30,4 @@int n_predict = 1000;// load dynamic backends[nitpick] The hard-coded token prediction limit (
1000) should be extracted into a constant or exposed as a command-line option for easier tuning.@@ -0,0 +51,4 @@// find the number of tokens in the promptconst int n_prompt =-llama_tokenize(vocab, prompt, strlen(prompt), NULL, 0, true, true);The leading '-' negates the return value of
llama_tokenize, resulting in a negative token count. Remove the '-' to correctly capture the number of tokens.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.