OvidijusParsiunas / deep-chat

Fully customizable AI chatbot component for your website
https://deepchat.dev
MIT License
1.42k stars 212 forks source link

Vercel AI SDK examples #242

Open techpeace opened 1 month ago

techpeace commented 1 month ago

I made a start at adding some Vercel AI SDK examples for Express: https://github.com/OvidijusParsiunas/deep-chat/compare/main...techpeace:vercel-ai-sdk?expand=1

Vercel AI SDK is a nice addition since it abstracts calls to several LLM providers.

Anything else I should add? Off the top of my head, I guess we could also use:

image
OvidijusParsiunas commented 1 month ago

Hi @techpeace. I really appreciate you going out of the way to provide code examples on other tools. There are a couple of small notes to consider in the code:

Deep Chat has been adapted by a huge variety of community/commercial projects and I have been thinking about creating a special section in the repo to showcase them. Hence, to minimize the work needed of tailoring your solution to the above requirements, it would probably be best to have your example there. Please let me know if this works for you.

Thanks!

techpeace commented 1 month ago

Is there perhaps a way to hit the Vercel SDK via raw JavaScript code instead of an NPM package?

The Vercel AI SDK is an NPM package, so I'm not familiar with any way of using it beyond including it as a dependency or copying in the full code of the package, which wouldn't fit with the goal of keeping the example server "lightweight." It has no servers of its own to make direct requests to–it's an abstraction over other LLM provider API's.

It's likely a worthwhile example, because many folks building new JS backends are likely going to be using the AI SDK, as it's quickly emerging as a popular choice. If not, they'll potentially be using one of the providers' official Node client libraries rather than making direct API calls.

I do think it would be useful to have examples that align to real-world usage patterns (and thus include dependencies from the relevant ecosystems), so I'd be happy to house this code elsewhere.