Skip to content

fix replicate.stream example #196

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

Closed
zeke opened this issue Jan 22, 2024 · 1 comment · Fixed by #197
Closed

fix replicate.stream example #196

zeke opened this issue Jan 22, 2024 · 1 comment · Fixed by #197

Comments

@zeke
Copy link
Member

zeke commented Jan 22, 2024

The docs for replicate.stream() don't have any input:

for await (const event of replicate.stream("meta/llama-2-70b-chat")) {
    process.stdout.write(`${event}`);
}

See https://github.com/replicate/replicate-javascript/tree/6dd5b21884e5dab8d137818e3c43ab14f4335f30#replicatestream

Let's update this to a working example.

@zeke
Copy link
Member Author

zeke commented Jan 22, 2024

Like this:

const input = {
  prompt: "Can you write a poem about open source machine learning?",
}

for await (const event of replicate.stream("meta/llama-2-70b-chat", { input })) {
  process.stdout.write(event.toString());
};

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 a pull request may close this issue.

1 participant