unSAGED is a cutting-edge chat kit engineered for seamless interaction with AI models. It allows you to easily have conversations with different AI models from a variety of providers, all in one place. It also allows you to manage multiple users and conversations, and synchronize them across different devices. Leveraging the power of Next.js and Supabase, it offers a user-friendly and robust interface for engaging with AI models from a variety of providers.
You can use it live at unsaged.com. Just make sure not to put in personal information as your conversations will be stored in Postgres (Supabase) until you delete them.
- 🎉 Welcome to unSAGED
- Multi-Model Support: Switch between different AI models from a variety of providers with ease.
- Multi-User Support: Easily switch between users and manage their respective conversations.
- Cloud Sync: Synchronize your conversations across different devices seamlessly with Supabase.
- System Prompts: Personalize your conversation context and the AI's personality with system prompts.
- Message Templates: Speed up message generation with support for variable templates.
- OpenAI
- GPT-3.5-Turbo, GPT-3.5-Turbo-16k
- GPT-4, GPT-4-32k, GPT-4-Turbo
- Anthropic
- Claude Instant 1 (100k)
- Claude 2 (100k)
- Google PaLM 2
- Chat Bison (Bard)
- Azure OpenAI
- GPT-3.5-Turbo, GPT-3.5-Turbo-16k
- GPT-4, GPT-4-32k
- Ollama
- Llama2-7b, Llama2-13b, Llama2-70b
- Codellama-7b, Codellama-13b, Codellama-70b
- Wizard-7b, Wizard-13b, Wizard-34b
- Phind-Codellama
- Mistral, Mistral-OpenOrca
git clone https://github.com/jorge-menjivar/unSAGED.git
Run the Generation Script in the Supabase SQL editor.
This will do the following:
- Create the tables required by unSAGED.
- Create the authentication schema and tables required by NextAuth.js.
- Enable Row Level Security for the tables required by unSAGED.
- Apply the Row Level Security policies required by unSAGED.
Expose the NextAuth schema in the API settings by adding next_auth to the "Exposed schemas" list.
More information here.
Create your secret with the following command:
openssl rand -base64 32
copy the output and save it for the next step.
Create a .env.local
file and set the following variable:
NEXTAUTH_SECRET=your_secret_from_step_4
npm i
Run Locally:
npm run dev
Or run with Docker:
docker build -t unsaged . --rm
docker run --env-file=.env.local -p 127.0.0.1:3000:3000 --name unsaged unsaged
To give everyone using your instance of unSAGED access to any API key, create a .env.local
file and set the appropriate environment variables.
If you do not provide an API key in the env file, users will have to provide their own key.
On November 13th, 2023, we released a major update to unSAGED, which required a database table columns update. If you are upgrading from a version of unSAGED released before this date, you will need to run the Upgrade Script in the Supabase SQL editor.
When deploying the application, the following environment variables can be set:
Required | Environment Variable | Default value | Description |
---|---|---|---|
No | NEXT_PUBLIC_DEBUG_MODE | false |
Enables debug mode, which prints env variables to the terminal and console. Useful when debugging docker. |
No | OPENAI_API_KEY | The default API key used for authenticating with OpenAI. Get Key | |
No | OPENAI_API_URL | https://api.openai.com/v1 |
The base url, for Azure use https://<endpoint>.openai.azure.com |
No | OPENAI_API_TYPE | openai |
The API type, options are openai or azure |
No | OPENAI_API_VERSION | 2023-03-15-preview |
Only applicable for Azure OpenAI |
No | OPENAI_ORGANIZATION | Your OpenAI organization ID | |
No | ANTHROPIC_API_URL | https://api.anthropic.com/v1 |
The base url for the Anthropic API. Get Key |
No | ANTHROPIC_API_KEY | The default API key used for authenticating with Anthropic. See Versioning | |
No | ANTHROPIC_API_VERSION | 2023-06-01 |
The version of the Anthropic API |
No | PALM_API_URL | https://generativelanguage.googleapis.com/v1beta2 |
The base url for the PALM 2 API from Google |
No | PALM_API_KEY | The default API key used for authenticating with PaLM 2. Get Key | |
No | OLLAMA_HOST | Example: http://127.0.0.1:11434 . The base url for Ollama. Be aware that Vercel doesn´t allow direct IP access in edge functions so you will need to create some sort of subdomain/domain for your Ollama instance if you want to use it. |
|
No | OLLAMA_BASIC_USER | Can be used if you´re ollama server is protected with HTTP Basic auth. | |
No | OLLAMA_BASIC_PWD | Can be used if you´re ollama server is protected with HTTP Basic auth. | |
No | NEXT_PUBLIC_DEFAULT_OPENAI_SYSTEM_PROMPT | Defined in constants file | The default system prompt to use on new conversations for OpenAI models. |
No | NEXT_PUBLIC_DEFAULT_ANTHROPIC_SYSTEM_PROMPT | Defined in constants file | The default system prompt to use on new conversations for Anthropic models. |
No | NEXT_PUBLIC_DEFAULT_PALM_SYSTEM_PROMPT | Defined in constants file | The default system prompt to use on new conversations for PaLM 2 models. |
No | NEXT_PUBLIC_DEFAULT_OLLAMA_SYSTEM_PROMPT | Defined in constants file | The default system prompt to use on new conversations for Ollama models. |
No | NEXT_PUBLIC_DEFAULT_MODEL | The default model to use on new conversations | |
Yes | NEXT_PUBLIC_SUPABASE_URL | The project URL. | |
Yes | NEXT_PUBLIC_SUPABASE_ANON_KEY | The supabase project anon key. | |
Yes | SUPABASE_SERVICE_ROLE_KEY | The supabase project service role key. | |
Yes | SUPABASE_JWT_SECRET | Warning! Generating a new JWT Secret may invalidate other supabase tokens. | |
No | EDGE_CONFIG | Create a Vercel Edge Config Store, add "NEXTAUTH_EMAIL_PATTERNS": ".+@mydomain.com " this will overried the NEXTAUTH_EMAIL_PATTERN environment variable |
|
No | NEXTAUTH_EMAIL_PATTERN | The email regex pattern granted access to unSAGED. For example .+@mydomain.com |
|
Yes | NEXTAUTH_SECRET | NextAuth Settings. See Documentation | |
In prod. | NEXTAUTH_URL | http://localhost:3000 |
NextAuth Settings. See Documentation |
In docker | NEXTAUTH_URL_INTERNAL | NextAuth Settings. See Documentation. | |
Yes | <PROVIDER>_CLIENT_ID | Provider OAuth Client ID | |
Yes | <PROVIDER>_CLIENT_SECRET | Provider OAuth Client Secret | |
Maybe | <PROVIDER>_ISSUER | Provider Issuer URL (Only some providers need this) | |
No | EMAIL_SERVER | Example: smtp://username:password@smtp.example.com:587 . Email Provider Mail Server |
|
No | EMAIL_FROM | Example: noreply@example.com . Email Provider From address Server |
Where <PROVIDER> is one of the following:
- APPLE
- AUTH0
- COGNITO
- DISCORD
- GITHUB
- GITLAB
- OKTA
- SALESFORCE
- SLACK
- SPOTIFY
- TWITCH
For example, to enable Google and Github authentication, you would add the following to your .env.local
file:
GITHUB_CLIENT_ID=xxxxxxxxxxxxx
GITHUB_CLIENT_SECRET=xxxxxxxxxxxxx
GOOGLE_CLIENT_ID=xxxxxxxxxxxxx
GOOGLE_CLIENT_SECRET=xxxxxxxxxxxx
For Auth0, you would add the following:
AUTH0_CLIENT_ID=xxxxxxxxxxxxx
AUTH0_CLIENT_SECRET=xxxxxxxxxxxxx
AUTH0_ISSUER=https://mydomain.us.auth0.com
To enable the Ollama models running locally (llama2, codellama, wizard, etc.) check https://ollama.ai/
.
unSAGED is licensed under the Apache 2.0 License. For more information, please refer to the LICENSE file in the repository.
We welcome contributions to the unSAGED project! If you're interested in contributing, please take a look at our CONTRIBUTING.md file for guidelines and details on the process.
unSAGED was built using the following technologies:
- Next.js: A React framework for production - it makes building static and dynamic React apps a breeze.
- Supabase: An open-source Firebase alternative. We use it for its awesome database and authentication capabilities.
- Chatbot UI: A customizable and easy-to-use chat UI for web applications.
We are grateful to the developers and communities behind these projects for their work that helped make unSAGED possible.