supabase-community / chatgpt-your-files

Production-ready MVP for securely chatting with your documents using pgvector
https://youtu.be/ibzlEQmgPPY
365 stars 126 forks source link

Switch form open AI to Anthropic #41

Open sgruhier opened 5 months ago

sgruhier commented 5 months ago

Feature request

Is your feature request related to a problem? Please describe.

I tried many ways to switch to Anthropic Sonnet 3.5 but without any luck Any hints, code snippets would be much appreciated.

gregnr commented 4 months ago

Hey @sgruhier! What ways have to you tried switching to Anthropic and what didn't work?

Since Anthropic uses a different API/SDK there will definitely need to be a couple tweaks to get it working (I have not yet tried myself). Your options are most likely either:

  1. Use Anthropic's @anthropic-ai/sdk TypeScript lib and adjust the OpenAI code to use their equivalent APIs accordingly
  2. Upgrade to the latest Vercel AI SDK which offers a unified API across all providers (OpenAI, Anthropic, etc)

My recommendation would probably be 2 for greatest flexibility/future proofing. This repo currently uses an older version of Vercel's AI SDK (v2) while the latest version is v3. I would actually love to see a PR that upgrades to this latest version.