Skip to content
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

Closed
wants to merge 9 commits into from
Closed

Conversation

MaesterChestnut
Copy link
Contributor

Adding in a few flows for developers to try streaming, history, and image input quickly

image

pnpm build
```

or if you need to, build everything:
Copy link
Member

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?"

js/samples/docs-menu-generation/src/index.ts Outdated Show resolved Hide resolved
js/samples/docs-menu-generation/src/index.ts Outdated Show resolved Hide resolved
},
async (subject) => {
const { response, stream } = await generateStream({
prompt: `Suggest many items for the menu of a ${subject} themed restaurant`,
Copy link
Member

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
Copy link
Member

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.

Copy link
Member

@MichaelDoyle MichaelDoyle May 10, 2024

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);
Copy link
Contributor

@tagboola tagboola May 10, 2024

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;
Copy link
Contributor

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

@MaesterChestnut MaesterChestnut marked this pull request as draft May 13, 2024 14:45
@MaesterChestnut MaesterChestnut deleted the menu/generationExample branch July 8, 2024 19:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants