-
Notifications
You must be signed in to change notification settings - Fork 105
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Menu/generation example #107
Conversation
pnpm build | ||
``` | ||
|
||
or if you need to, build everything: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can set this up as a prerequisite step (build the entire repo first) that we note can be skipped if already done. otherwise, how does one answer the question "build if you need to?"
}, | ||
async (subject) => { | ||
const { response, stream } = await generateStream({ | ||
prompt: `Suggest many items for the menu of a ${subject} themed restaurant`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe specify exactly how many, or provide a range?
}, | ||
async (subject) => { | ||
// lets do few-shot examples: generate a few different generations, keep adding the history | ||
// before generating an item for the menu of a themed restaurant |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is actually going to call the model, it's probably not a good example of a "few-shot" prompt, which would typically have hardcoded examples.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks more like a pre-scripted chat exchange, but will still be non-deterministic. We should probably talk through more what you want to be the outcome here.
|
||
for await (let chunk of stream()) { | ||
for (let content of chunk.content) { | ||
console.log(content.text); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider passing the contents of the chunk to the streamingCallback
if it's defined.
} | ||
); | ||
|
||
let historyMap: MessageData[] = sampleMenuHistory; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Drop the Map
since it's an array
Adding in a few flows for developers to try streaming, history, and image input quickly