replicate / llama-chat

A boilerplate for creating a Llama 3 chat app
https://llama3.replicate.dev
Apache License 2.0
768 stars 290 forks source link

Use Vercel AI SDK and Next.js App Directory #19

Closed MaxLeiter closed 11 months ago

MaxLeiter commented 11 months ago

I haven't completely tested this but it should be a good PoC if anyone wants to pick it up.

  1. I noticed there's both a yarn.lock and package-lock, so I went with a 3rd choice and used pnpm. Happy to change it to whatever you prefer
  2. Migrated to the Next.js App Directory
  3. Use the Vercel AI SDK and it's ReplicateStream and useCompletion utilities. 3a. It'd be nice to use the useChat hook instead but that would be a more invasive change.
vercel[bot] commented 11 months ago

@MaxLeiter is attempting to deploy a commit to the Replicate Team on Vercel.

A member of the Team first needs to authorize it.

vercel[bot] commented 11 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
llama-chat ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 8, 2023 4:50pm
MaxLeiter commented 11 months ago

Switched to npm and resolved the conflict 👍

zeke commented 11 months ago

Now the build is failing with Missing required parameter: auth from the Replicate JavaScript client constructor.

That's because process.env.REPLICATE_API_TOKEN is not present in the build environment.

I can reproduce this locally with:

REPLICATE_API_TOKEN="" npm t

And I was able to get around it like this:

 REPLICATE_API_TOKEN="r8_fake_token" npm t

We could update scripts.test to have that env assignment as a prefix, but it feels a bit unsavory. 🤔

@mattt any thoughts on what would be the best way to handle this?

mattt commented 11 months ago

@zeke This is now fixed in v0.15.1. See https://github.com/replicate/replicate-javascript/pull/120

zeke commented 11 months ago

@MaxLeiter you wanna npm install replicate@latest and give this another go?