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.
- π 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 4
- Anthropic
- Claude Instant 1 (100k)
- Claude 2 (100k)
- Google PaLM 2
- Chat Bison (Bard)
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 next_auth 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 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.
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 | AZURE_DEPLOYMENT_ID | Only applicable for Azure OpenAI | |
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 | 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_MODEL | gpt-3.5-turbo |
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 | 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) |
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
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.