DevLLM commited on
Commit
3baea8e
·
1 Parent(s): b02e431

Add application file

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .dockerignore +12 -0
  2. .env +197 -0
  3. .env.ci +1 -0
  4. .eslintignore +13 -0
  5. .eslintrc.cjs +44 -0
  6. .github/ISSUE_TEMPLATE/bug-report--chat-ui-.md +43 -0
  7. .github/ISSUE_TEMPLATE/config-support.md +9 -0
  8. .github/ISSUE_TEMPLATE/feature-request--chat-ui-.md +17 -0
  9. .github/ISSUE_TEMPLATE/huggingchat.md +11 -0
  10. .github/release.yml +16 -0
  11. .github/workflows/build-docs.yml +18 -0
  12. .github/workflows/build-image.yml +140 -0
  13. .github/workflows/build-pr-docs.yml +20 -0
  14. .github/workflows/deploy-prod.yml +79 -0
  15. .github/workflows/lint-and-test.yml +52 -0
  16. .github/workflows/trufflehog.yml +17 -0
  17. .github/workflows/upload-pr-documentation.yml +16 -0
  18. .gitignore +15 -0
  19. .husky/lint-stage-config.js +4 -0
  20. .husky/pre-commit +2 -0
  21. .npmrc +1 -0
  22. .prettierignore +14 -0
  23. .prettierrc +7 -0
  24. .vscode/launch.json +11 -0
  25. .vscode/settings.json +11 -0
  26. Dockerfile +95 -0
  27. LICENSE +203 -0
  28. PRIVACY.md +35 -0
  29. PROMPTS.md +72 -0
  30. chart/Chart.yaml +5 -0
  31. chart/env/prod.yaml +677 -0
  32. chart/templates/_helpers.tpl +22 -0
  33. chart/templates/config.yaml +10 -0
  34. chart/templates/deployment.yaml +81 -0
  35. chart/templates/hpa.yaml +45 -0
  36. chart/templates/infisical.yaml +24 -0
  37. chart/templates/ingress.yaml +32 -0
  38. chart/templates/network-policy.yaml +36 -0
  39. chart/templates/service-account.yaml +13 -0
  40. chart/templates/service-monitor.yaml +15 -0
  41. chart/templates/service.yaml +21 -0
  42. chart/values.yaml +67 -0
  43. docs/source/_toctree.yml +64 -0
  44. docs/source/configuration/common-issues.md +7 -0
  45. docs/source/configuration/embeddings.md +105 -0
  46. docs/source/configuration/metrics.md +9 -0
  47. docs/source/configuration/models/multimodal.md +24 -0
  48. docs/source/configuration/models/overview.md +147 -0
  49. docs/source/configuration/models/providers/anthropic.md +117 -0
  50. docs/source/configuration/models/providers/aws.md +35 -0
.dockerignore ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Dockerfile
2
+ .vscode/
3
+ .idea
4
+ .gitignore
5
+ LICENSE
6
+ README.md
7
+ node_modules/
8
+ .svelte-kit/
9
+ .env*
10
+ !.env
11
+ .env.local
12
+ db
.env ADDED
@@ -0,0 +1,197 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Use .env.local to change these variables
2
+ # DO NOT EDIT THIS FILE WITH SENSITIVE DATA
3
+
4
+ ### MongoDB ###
5
+ MONGODB_URL=#your mongodb URL here, use chat-ui-db image if you don't want to set this
6
+ MONGODB_DB_NAME=chat-ui
7
+ MONGODB_DIRECT_CONNECTION=false
8
+
9
+
10
+ ### Endpoints config ###
11
+ HF_API_ROOT=https://api-inference.huggingface.co/models
12
+ # HF_TOKEN is used for a lot of things, not only for inference but also fetching tokenizers, etc.
13
+ # We recommend using an HF_TOKEN even if you use a local endpoint.
14
+ HF_TOKEN= #get it from https://huggingface.co/settings/token
15
+ # API Keys for providers, you will need to specify models in the MODELS section but these keys can be kept secret
16
+ OPENAI_API_KEY=#your openai api key here
17
+ ANTHROPIC_API_KEY=#your anthropic api key here
18
+ CLOUDFLARE_ACCOUNT_ID=#your cloudflare account id here
19
+ CLOUDFLARE_API_TOKEN=#your cloudflare api token here
20
+ COHERE_API_TOKEN=#your cohere api token here
21
+ GOOGLE_GENAI_API_KEY=#your google genai api token here
22
+
23
+
24
+ ### Models ###
25
+ ## Models can support many different endpoints, check the documentation for more details
26
+ MODELS=`[
27
+ {
28
+ "name": "NousResearch/Hermes-3-Llama-3.1-8B",
29
+ "description": "Nous Research's latest Hermes 3 release in 8B size.",
30
+ "promptExamples": [
31
+ {
32
+ "title": "Write an email from bullet list",
33
+ "prompt": "As a restaurant owner, write a professional email to the supplier to get these products every week: \n\n- Wine (x10)\n- Eggs (x24)\n- Bread (x12)"
34
+ }, {
35
+ "title": "Code a snake game",
36
+ "prompt": "Code a basic snake game in python, give explanations for each step."
37
+ }, {
38
+ "title": "Assist in a task",
39
+ "prompt": "How do I make a delicious lemon cheesecake?"
40
+ }
41
+ ]
42
+ }
43
+ ]`
44
+ ## Text Embedding Models used for websearch
45
+ # Default is a model that runs locally on CPU.
46
+ TEXT_EMBEDDING_MODELS = `[
47
+ {
48
+ "name": "Xenova/gte-small",
49
+ "displayName": "Xenova/gte-small",
50
+ "description": "Local embedding model running on the server.",
51
+ "chunkCharLength": 512,
52
+ "endpoints": [
53
+ { "type": "transformersjs" }
54
+ ]
55
+ }
56
+ ]`
57
+
58
+ ## Removed models, useful for migrating conversations
59
+ # { name: string, displayName?: string, id?: string, transferTo?: string }`
60
+ OLD_MODELS=`[]`
61
+
62
+ ## Task model
63
+ # name of the model used for tasks such as summarizing title, creating query, etc.
64
+ # if not set, the first model in MODELS will be used
65
+ TASK_MODEL=
66
+
67
+
68
+ ### Authentication ###
69
+ # Parameters to enable open id login
70
+ OPENID_CONFIG=
71
+ MESSAGES_BEFORE_LOGIN=# how many messages a user can send in a conversation before having to login. set to 0 to force login right away
72
+ # if it's defined, only these emails will be allowed to use login
73
+ ALLOWED_USER_EMAILS=`[]`
74
+ # If it's defined, users with emails matching these domains will also be allowed to use login
75
+ ALLOWED_USER_DOMAINS=`[]`
76
+ # valid alternative redirect URLs for OAuth, used for HuggingChat apps
77
+ ALTERNATIVE_REDIRECT_URLS=`[]`
78
+ ### Cookies
79
+ # name of the cookie used to store the session
80
+ COOKIE_NAME=hf-chat
81
+ # specify secure behaviour for cookies
82
+ COOKIE_SAMESITE=# can be "lax", "strict", "none" or left empty
83
+ COOKIE_SECURE=# set to true to only allow cookies over https
84
+
85
+
86
+ ### Websearch ###
87
+ ## API Keys used to activate search with web functionality. websearch is disabled if none are defined. choose one of the following:
88
+ YDC_API_KEY=#your docs.you.com api key here
89
+ SERPER_API_KEY=#your serper.dev api key here
90
+ SERPAPI_KEY=#your serpapi key here
91
+ SERPSTACK_API_KEY=#your serpstack api key here
92
+ SEARCHAPI_KEY=#your searchapi api key here
93
+ USE_LOCAL_WEBSEARCH=#set to true to parse google results yourself, overrides other API keys
94
+ SEARXNG_QUERY_URL=# where '<query>' will be replaced with query keywords see https://docs.searxng.org/dev/search_api.html eg https://searxng.yourdomain.com/search?q=<query>&engines=duckduckgo,google&format=json
95
+ BING_SUBSCRIPTION_KEY=#your key
96
+ ## Websearch configuration
97
+ PLAYWRIGHT_ADBLOCKER=true
98
+ WEBSEARCH_ALLOWLIST=`[]` # if it's defined, allow websites from only this list.
99
+ WEBSEARCH_BLOCKLIST=`[]` # if it's defined, block websites from this list.
100
+ WEBSEARCH_JAVASCRIPT=true # CPU usage reduces by 60% on average by disabling javascript. Enable to improve website compatibility
101
+ WEBSEARCH_TIMEOUT = 3500 # in milliseconds, determines how long to wait to load a page before timing out
102
+ ENABLE_LOCAL_FETCH=false #set to true to allow fetches on the local network. /!\ Only enable this if you have the proper firewall rules to prevent SSRF attacks and understand the implications.
103
+
104
+
105
+ ## Public app configuration ##
106
+ PUBLIC_APP_GUEST_MESSAGE=# a message to the guest user. If not set, no message will be shown. Only used if you have authentication enabled.
107
+ PUBLIC_APP_NAME=Mit # name used as title throughout the app
108
+ PUBLIC_APP_ASSETS=chatui # used to find logos & favicons in static/$PUBLIC_APP_ASSETS
109
+ PUBLIC_APP_DESCRIPTION=# description used throughout the app
110
+ PUBLIC_APP_DATA_SHARING=# Set to 1 to enable an option in the user settings to share conversations with model authors
111
+ PUBLIC_APP_DISCLAIMER=# Set to 1 to show a disclaimer on login page
112
+ PUBLIC_APP_DISCLAIMER_MESSAGE=# Message to show on the login page
113
+ PUBLIC_ANNOUNCEMENT_BANNERS=`[
114
+
115
+ ]`
116
+ PUBLIC_SMOOTH_UPDATES=false # set to true to enable smoothing of messages client-side, can be CPU intensive
117
+ PUBLIC_ORIGIN=#https://huggingface.co
118
+ PUBLIC_SHARE_PREFIX=#https://hf.co/chat
119
+
120
+ # mostly huggingchat specific
121
+ PUBLIC_GOOGLE_ANALYTICS_ID=#G-XXXXXXXX / Leave empty to disable
122
+ PUBLIC_PLAUSIBLE_SCRIPT_URL=#/js/script.js / Leave empty to disable
123
+ PUBLIC_APPLE_APP_ID=#1234567890 / Leave empty to disable
124
+
125
+
126
+ ### Feature Flags ###
127
+ LLM_SUMMARIZATION=true # generate conversation titles with LLMs
128
+ ENABLE_ASSISTANTS=false #set to true to enable assistants feature
129
+ ENABLE_ASSISTANTS_RAG=false # /!\ This will let users specify arbitrary URLs that the server will then request. Make sure you have the proper firewall rules in place.
130
+ REQUIRE_FEATURED_ASSISTANTS=false # require featured assistants to show in the list
131
+ COMMUNITY_TOOLS=false # set to true to enable community tools
132
+ ALLOW_IFRAME=true # Allow the app to be embedded in an iframe
133
+
134
+
135
+ ### Tools ###
136
+ # Check out public config in `chart/env/prod.yaml` for more details
137
+ TOOLS=`[]`
138
+
139
+ ### Rate limits ###
140
+ # See `src/lib/server/usageLimits.ts`
141
+ # {
142
+ # conversations: number, # how many conversations
143
+ # messages: number, # how many messages in a conversation
144
+ # assistants: number, # how many assistants
145
+ # messageLength: number, # how long can a message be before we cut it off
146
+ # messagesPerMinute: number, # how many messages per minute
147
+ # tools: number # how many tools
148
+ # }
149
+ USAGE_LIMITS=`{}`
150
+
151
+
152
+ ### HuggingFace specific ###
153
+ # Let user authenticate with their HF token in the /api routes. This is only useful if you have OAuth configured with huggingface.
154
+ USE_HF_TOKEN_IN_API=false
155
+ ## Feature flag & admin settings
156
+ # Used for setting early access & admin flags to users
157
+ HF_ORG_ADMIN=
158
+ HF_ORG_EARLY_ACCESS=
159
+ WEBHOOK_URL_REPORT_ASSISTANT=#provide slack webhook url to get notified for reports/feature requests
160
+
161
+
162
+
163
+ ### Metrics ###
164
+ METRICS_ENABLED=false
165
+ METRICS_PORT=5565
166
+ LOG_LEVEL=info
167
+
168
+
169
+ ### Parquet export ###
170
+ # Not in use anymore but useful to export conversations to a parquet file as a HuggingFace dataset
171
+ PARQUET_EXPORT_DATASET=
172
+ PARQUET_EXPORT_HF_TOKEN=
173
+ ADMIN_API_SECRET=# secret to admin API calls, like computing usage stats or exporting parquet data
174
+
175
+
176
+ ### Docker build variables ###
177
+ # These values cannot be updated at runtime
178
+ # They need to be passed when building the docker image
179
+ # See https://github.com/huggingface/chat-ui/main/.github/workflows/deploy-prod.yml#L44-L47
180
+ APP_BASE="" # base path of the app, e.g. /chat, left blank as default
181
+ PUBLIC_APP_COLOR=blue # can be any of tailwind colors: https://tailwindcss.com/docs/customizing-colors#default-color-palette
182
+ ### Body size limit for SvelteKit https://svelte.dev/docs/kit/adapter-node#Environment-variables-BODY_SIZE_LIMIT
183
+ BODY_SIZE_LIMIT=15728640
184
+ PUBLIC_COMMIT_SHA=
185
+
186
+ ### LEGACY parameters
187
+ HF_ACCESS_TOKEN=#LEGACY! Use HF_TOKEN instead
188
+ ALLOW_INSECURE_COOKIES=false # LEGACY! Use COOKIE_SECURE and COOKIE_SAMESITE instead
189
+ PARQUET_EXPORT_SECRET=#DEPRECATED, use ADMIN_API_SECRET instead
190
+ RATE_LIMIT= # /!\ DEPRECATED definition of messages per minute. Use USAGE_LIMITS.messagesPerMinute instead
191
+ OPENID_CLIENT_ID=
192
+ OPENID_CLIENT_SECRET=
193
+ OPENID_SCOPES="openid profile" # Add "email" for some providers like Google that do not provide preferred_username
194
+ OPENID_NAME_CLAIM="name" # Change to "username" for some providers that do not provide name
195
+ OPENID_PROVIDER_URL=https://huggingface.co # for Google, use https://accounts.google.com
196
+ OPENID_TOLERANCE=
197
+ OPENID_RESOURCE=
.env.ci ADDED
@@ -0,0 +1 @@
 
 
1
+ MONGODB_URL=mongodb://localhost:27017/
.eslintignore ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .DS_Store
2
+ node_modules
3
+ /build
4
+ /.svelte-kit
5
+ /package
6
+ .env
7
+ .env.*
8
+ !.env.example
9
+
10
+ # Ignore files for PNPM, NPM and YARN
11
+ pnpm-lock.yaml
12
+ package-lock.json
13
+ yarn.lock
.eslintrc.cjs ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ module.exports = {
2
+ root: true,
3
+ parser: "@typescript-eslint/parser",
4
+ extends: [
5
+ "eslint:recommended",
6
+ "plugin:@typescript-eslint/recommended",
7
+ "plugin:svelte/recommended",
8
+ "prettier",
9
+ ],
10
+ plugins: ["@typescript-eslint"],
11
+ ignorePatterns: ["*.cjs"],
12
+ overrides: [
13
+ {
14
+ files: ["*.svelte"],
15
+ parser: "svelte-eslint-parser",
16
+ parserOptions: {
17
+ parser: "@typescript-eslint/parser",
18
+ },
19
+ },
20
+ ],
21
+ parserOptions: {
22
+ sourceType: "module",
23
+ ecmaVersion: 2020,
24
+ extraFileExtensions: [".svelte"],
25
+ },
26
+ rules: {
27
+ "require-yield": "off",
28
+ "@typescript-eslint/no-explicit-any": "error",
29
+ "@typescript-eslint/no-non-null-assertion": "error",
30
+ "@typescript-eslint/no-unused-vars": [
31
+ // prevent variables with a _ prefix from being marked as unused
32
+ "error",
33
+ {
34
+ argsIgnorePattern: "^_",
35
+ },
36
+ ],
37
+ "object-shorthand": ["error", "always"],
38
+ },
39
+ env: {
40
+ browser: true,
41
+ es2017: true,
42
+ node: true,
43
+ },
44
+ };
.github/ISSUE_TEMPLATE/bug-report--chat-ui-.md ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: Bug Report (chat-ui)
3
+ about: Use this for confirmed issues with chat-ui
4
+ title: ""
5
+ labels: bug
6
+ assignees: ""
7
+ ---
8
+
9
+ ## Bug description
10
+
11
+ <!-- A clear and concise description of what the bug is. -->
12
+
13
+ ## Steps to reproduce
14
+
15
+ <!-- Steps to reproduce the issue -->
16
+
17
+ ## Screenshots
18
+
19
+ <!-- If applicable, add screenshots to help explain your problem. -->
20
+
21
+ ## Context
22
+
23
+ ### Logs
24
+
25
+ <!-- Add any logs that are relevant to your issue. Could be browser or server logs. Wrap in code blocks. -->
26
+
27
+ ```
28
+ // logs here if relevant
29
+ ```
30
+
31
+ ### Specs
32
+
33
+ - **OS**:
34
+ - **Browser**:
35
+ - **chat-ui commit**:
36
+
37
+ ### Config
38
+
39
+ <!-- Add the environment variables you've used to setup chat-ui, making sure to redact any secrets. -->
40
+
41
+ ## Notes
42
+
43
+ <!-- Anything else relevant to help the issue get solved -->
.github/ISSUE_TEMPLATE/config-support.md ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: Config Support
3
+ about: Help with setting up chat-ui locally
4
+ title: ""
5
+ labels: support
6
+ assignees: ""
7
+ ---
8
+
9
+ **Please use the discussions on GitHub** for getting help with setting things up instead of opening an issue: https://github.com/huggingface/chat-ui/discussions
.github/ISSUE_TEMPLATE/feature-request--chat-ui-.md ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: Feature Request (chat-ui)
3
+ about: Suggest new features to be added to chat-ui
4
+ title: ""
5
+ labels: enhancement
6
+ assignees: ""
7
+ ---
8
+
9
+ ## Describe your feature request
10
+
11
+ <!-- Short description of what this is about -->
12
+
13
+ ## Screenshots (if relevant)
14
+
15
+ ## Implementation idea
16
+
17
+ <!-- If you know how this should be implemented in the codebase, share your thoughts. Let us know if you feel like implementing it yourself as well! -->
.github/ISSUE_TEMPLATE/huggingchat.md ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: HuggingChat
3
+ about: Requests & reporting outages on HuggingChat, the hosted version of chat-ui.
4
+ title: ""
5
+ labels: huggingchat
6
+ assignees: ""
7
+ ---
8
+
9
+ **Do not use GitHub issues** for requesting models on HuggingChat or reporting issues with HuggingChat being down/overloaded.
10
+
11
+ **Use the discussions page on the hub instead:** https://huggingface.co/spaces/huggingchat/chat-ui/discussions
.github/release.yml ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ changelog:
2
+ exclude:
3
+ labels:
4
+ - huggingchat
5
+ - CI/CD
6
+ - documentation
7
+ categories:
8
+ - title: Features
9
+ labels:
10
+ - enhancement
11
+ - title: Bugfixes
12
+ labels:
13
+ - bug
14
+ - title: Other changes
15
+ labels:
16
+ - "*"
.github/workflows/build-docs.yml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Build documentation
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ - v*-release
8
+
9
+ jobs:
10
+ build:
11
+ uses: huggingface/doc-builder/.github/workflows/build_main_documentation.yml@main
12
+ with:
13
+ commit_sha: ${{ github.sha }}
14
+ package: chat-ui
15
+ additional_args: --not_python_module
16
+ secrets:
17
+ token: ${{ secrets.HUGGINGFACE_PUSH }}
18
+ hf_token: ${{ secrets.HF_DOC_BUILD_PUSH }}
.github/workflows/build-image.yml ADDED
@@ -0,0 +1,140 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Build and Publish Image
2
+
3
+ permissions:
4
+ packages: write
5
+
6
+ on:
7
+ push:
8
+ branches:
9
+ - "main"
10
+ pull_request:
11
+ branches:
12
+ - "*"
13
+ paths:
14
+ - "Dockerfile"
15
+ - "entrypoint.sh"
16
+ workflow_dispatch:
17
+ release:
18
+ types: [published, edited]
19
+
20
+ jobs:
21
+ build-and-publish-image-with-db:
22
+ runs-on: ubuntu-latest
23
+ steps:
24
+ - name: Checkout
25
+ uses: actions/checkout@v4
26
+
27
+ - name: Extract package version
28
+ id: package-version
29
+ run: |
30
+ VERSION=$(jq -r .version package.json)
31
+ echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
32
+ MAJOR=$(echo $VERSION | cut -d '.' -f1)
33
+ echo "MAJOR=$MAJOR" >> $GITHUB_OUTPUT
34
+ MINOR=$(echo $VERSION | cut -d '.' -f1).$(echo $VERSION | cut -d '.' -f2)
35
+ echo "MINOR=$MINOR" >> $GITHUB_OUTPUT
36
+
37
+ - name: Docker metadata
38
+ id: meta
39
+ uses: docker/metadata-action@v5
40
+ with:
41
+ images: |
42
+ ghcr.io/huggingface/chat-ui-db
43
+ tags: |
44
+ type=raw,value=${{ steps.package-version.outputs.VERSION }},enable=${{github.event_name == 'release'}}
45
+ type=raw,value=${{ steps.package-version.outputs.MAJOR }},enable=${{github.event_name == 'release'}}
46
+ type=raw,value=${{ steps.package-version.outputs.MINOR }},enable=${{github.event_name == 'release'}}
47
+ type=raw,value=latest,enable={{is_default_branch}}
48
+ type=sha,enable={{is_default_branch}}
49
+
50
+ - name: Set up QEMU
51
+ uses: docker/setup-qemu-action@v3
52
+
53
+ - name: Set up Docker Buildx
54
+ uses: docker/setup-buildx-action@v3
55
+
56
+ - name: Login to GitHub Container Registry
57
+ if: github.event_name != 'pull_request'
58
+ uses: docker/login-action@v3
59
+ with:
60
+ registry: ghcr.io
61
+ username: ${{ github.repository_owner }}
62
+ password: ${{ secrets.GITHUB_TOKEN }}
63
+
64
+ - name: Inject slug/short variables
65
+ uses: rlespinasse/github-slug-action@v4.5.0
66
+
67
+ - name: Build and Publish Docker Image with DB
68
+ uses: docker/build-push-action@v5
69
+ with:
70
+ context: .
71
+ file: Dockerfile
72
+ push: ${{ github.event_name != 'pull_request' }}
73
+ tags: ${{ steps.meta.outputs.tags }}
74
+ labels: ${{ steps.meta.outputs.labels }}
75
+ platforms: linux/amd64,linux/arm64
76
+ cache-from: type=gha
77
+ cache-to: type=gha,mode=max
78
+ build-args: |
79
+ INCLUDE_DB=true
80
+ PUBLIC_COMMIT_SHA=${{ env.GITHUB_SHA_SHORT }}
81
+ build-and-publish-image-nodb:
82
+ runs-on: ubuntu-latest
83
+ steps:
84
+ - name: Checkout
85
+ uses: actions/checkout@v4
86
+
87
+ - name: Extract package version
88
+ id: package-version
89
+ run: |
90
+ VERSION=$(jq -r .version package.json)
91
+ echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
92
+ MAJOR=$(echo $VERSION | cut -d '.' -f1)
93
+ echo "MAJOR=$MAJOR" >> $GITHUB_OUTPUT
94
+ MINOR=$(echo $VERSION | cut -d '.' -f1).$(echo $VERSION | cut -d '.' -f2)
95
+ echo "MINOR=$MINOR" >> $GITHUB_OUTPUT
96
+
97
+ - name: Docker metadata
98
+ id: meta
99
+ uses: docker/metadata-action@v5
100
+ with:
101
+ images: |
102
+ ghcr.io/huggingface/chat-ui
103
+ tags: |
104
+ type=raw,value=${{ steps.package-version.outputs.VERSION }},enable=${{github.event_name == 'release'}}
105
+ type=raw,value=${{ steps.package-version.outputs.MAJOR }},enable=${{github.event_name == 'release'}}
106
+ type=raw,value=${{ steps.package-version.outputs.MINOR }},enable=${{github.event_name == 'release'}}
107
+ type=raw,value=latest,enable={{is_default_branch}}
108
+ type=sha,enable={{is_default_branch}}
109
+
110
+ - name: Set up QEMU
111
+ uses: docker/setup-qemu-action@v3
112
+
113
+ - name: Set up Docker Buildx
114
+ uses: docker/setup-buildx-action@v3
115
+
116
+ - name: Login to GitHub Container Registry
117
+ if: github.event_name != 'pull_request'
118
+ uses: docker/login-action@v3
119
+ with:
120
+ registry: ghcr.io
121
+ username: ${{ github.repository_owner }}
122
+ password: ${{ secrets.GITHUB_TOKEN }}
123
+
124
+ - name: Inject slug/short variables
125
+ uses: rlespinasse/github-slug-action@v4.5.0
126
+
127
+ - name: Build and Publish Docker Image without DB
128
+ uses: docker/build-push-action@v5
129
+ with:
130
+ context: .
131
+ file: Dockerfile
132
+ push: ${{ github.event_name != 'pull_request' }}
133
+ tags: ${{ steps.meta.outputs.tags }}
134
+ labels: ${{ steps.meta.outputs.labels }}
135
+ platforms: linux/amd64,linux/arm64
136
+ cache-from: type=gha
137
+ cache-to: type=gha,mode=max
138
+ build-args: |
139
+ INCLUDE_DB=false
140
+ PUBLIC_COMMIT_SHA=${{ env.GITHUB_SHA_SHORT }}
.github/workflows/build-pr-docs.yml ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Build PR Documentation
2
+
3
+ on:
4
+ pull_request:
5
+ paths:
6
+ - "docs/source/**"
7
+ - ".github/workflows/build-pr-docs.yml"
8
+
9
+ concurrency:
10
+ group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
11
+ cancel-in-progress: true
12
+
13
+ jobs:
14
+ build:
15
+ uses: huggingface/doc-builder/.github/workflows/build_pr_documentation.yml@main
16
+ with:
17
+ commit_sha: ${{ github.event.pull_request.head.sha }}
18
+ pr_number: ${{ github.event.number }}
19
+ package: chat-ui
20
+ additional_args: --not_python_module
.github/workflows/deploy-prod.yml ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Deploy to k8s
2
+ on:
3
+ # run this workflow manually from the Actions tab
4
+ workflow_dispatch:
5
+
6
+ jobs:
7
+ build-and-publish-huggingchat-image:
8
+ runs-on: ubuntu-latest
9
+ steps:
10
+ - name: Checkout
11
+ uses: actions/checkout@v4
12
+
13
+ - name: Login to Registry
14
+ uses: docker/login-action@v3
15
+ with:
16
+ username: ${{ secrets.DOCKERHUB_USERNAME }}
17
+ password: ${{ secrets.DOCKERHUB_PASSWORD }}
18
+
19
+ - name: Docker metadata
20
+ id: meta
21
+ uses: docker/metadata-action@v5
22
+ with:
23
+ images: |
24
+ huggingface/chat-ui
25
+ tags: |
26
+ type=raw,value=latest,enable={{is_default_branch}}
27
+ type=sha,enable={{is_default_branch}}
28
+
29
+ - name: Set up Docker Buildx
30
+ uses: docker/setup-buildx-action@v3
31
+
32
+ - name: Inject slug/short variables
33
+ uses: rlespinasse/github-slug-action@v4.5.0
34
+
35
+ - name: Build and Publish HuggingChat image
36
+ uses: docker/build-push-action@v5
37
+ with:
38
+ context: .
39
+ file: Dockerfile
40
+ push: ${{ github.event_name != 'pull_request' }}
41
+ tags: ${{ steps.meta.outputs.tags }}
42
+ labels: ${{ steps.meta.outputs.labels }}
43
+ platforms: linux/amd64
44
+ cache-to: type=gha,mode=max,scope=amd64
45
+ cache-from: type=gha,scope=amd64
46
+ provenance: false
47
+ build-args: |
48
+ INCLUDE_DB=false
49
+ APP_BASE=/chat
50
+ PUBLIC_APP_COLOR=yellow
51
+ PUBLIC_COMMIT_SHA=${{ env.GITHUB_SHA_SHORT }}
52
+ deploy:
53
+ name: Deploy on prod
54
+ runs-on: ubuntu-latest
55
+ needs: ["build-and-publish-huggingchat-image"]
56
+ steps:
57
+ - name: Inject slug/short variables
58
+ uses: rlespinasse/github-slug-action@v4.5.0
59
+
60
+ - name: Gen values
61
+ run: |
62
+ VALUES=$(cat <<-END
63
+ image:
64
+ tag: "sha-${{ env.GITHUB_SHA_SHORT }}"
65
+ END
66
+ )
67
+ echo "VALUES=$(echo "$VALUES" | yq -o=json | jq tostring)" >> $GITHUB_ENV
68
+
69
+ - name: Deploy on infra-deployments
70
+ uses: aurelien-baudet/workflow-dispatch@v2
71
+ with:
72
+ workflow: Update application single value
73
+ repo: huggingface/infra-deployments
74
+ wait-for-completion: true
75
+ wait-for-completion-interval: 10s
76
+ display-workflow-run-url-interval: 10s
77
+ ref: refs/heads/main
78
+ token: ${{ secrets.GIT_TOKEN_INFRA_DEPLOYMENT }}
79
+ inputs: '{"path": "hub/chat-ui/chat-ui.yaml", "value": ${{ env.VALUES }}, "url": "${{ github.event.head_commit.url }}"}'
.github/workflows/lint-and-test.yml ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Lint and test
2
+
3
+ on:
4
+ pull_request:
5
+ push:
6
+ branches:
7
+ - main
8
+
9
+ jobs:
10
+ lint:
11
+ runs-on: ubuntu-latest
12
+ timeout-minutes: 10
13
+
14
+ steps:
15
+ - uses: actions/checkout@v3
16
+
17
+ - uses: actions/setup-node@v3
18
+ with:
19
+ node-version: "20"
20
+ cache: "npm"
21
+ - run: |
22
+ npm install ci
23
+ - name: "Checking lint/format errors"
24
+ run: |
25
+ npm run lint
26
+ - name: "Checking type errors"
27
+ run: |
28
+ npm run check
29
+
30
+ test:
31
+ runs-on: ubuntu-latest
32
+ timeout-minutes: 10
33
+
34
+ steps:
35
+ - uses: actions/checkout@v3
36
+ - uses: actions/setup-node@v3
37
+ with:
38
+ node-version: "20"
39
+ cache: "npm"
40
+ - run: |
41
+ npm ci
42
+ - name: "Tests"
43
+ run: |
44
+ npm run test
45
+
46
+ build-check:
47
+ runs-on: ubuntu-latest
48
+ timeout-minutes: 10
49
+ steps:
50
+ - uses: actions/checkout@v3
51
+ - name: Build Docker image
52
+ run: docker build --secret id=DOTENV_LOCAL,src=.env.ci -t chat-ui:latest .
.github/workflows/trufflehog.yml ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ on:
2
+ push:
3
+
4
+ name: Secret Leaks
5
+
6
+ jobs:
7
+ trufflehog:
8
+ runs-on: ubuntu-latest
9
+ steps:
10
+ - name: Checkout code
11
+ uses: actions/checkout@v4
12
+ with:
13
+ fetch-depth: 0
14
+ - name: Secret Scanning
15
+ uses: trufflesecurity/trufflehog@main
16
+ with:
17
+ extra_args: --results=verified,unknown
.github/workflows/upload-pr-documentation.yml ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Upload PR Documentation
2
+
3
+ on:
4
+ workflow_run:
5
+ workflows: ["Build PR Documentation"]
6
+ types:
7
+ - completed
8
+
9
+ jobs:
10
+ build:
11
+ uses: huggingface/doc-builder/.github/workflows/upload_pr_documentation.yml@main
12
+ with:
13
+ package_name: chat-ui
14
+ secrets:
15
+ hf_token: ${{ secrets.HF_DOC_BUILD_PUSH }}
16
+ comment_bot_token: ${{ secrets.COMMENT_BOT_TOKEN }}
.gitignore ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .DS_Store
2
+ node_modules
3
+ /build
4
+ /.svelte-kit
5
+ /package
6
+ .env
7
+ .env.*
8
+ vite.config.js.timestamp-*
9
+ vite.config.ts.timestamp-*
10
+ SECRET_CONFIG
11
+ .idea
12
+ !.env.ci
13
+ !.env
14
+ gcp-*.json
15
+ db
.husky/lint-stage-config.js ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ export default {
2
+ "*.{js,jsx,ts,tsx}": ["prettier --write", "eslint --fix", "eslint"],
3
+ "*.json": ["prettier --write"],
4
+ };
.husky/pre-commit ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ set -e
2
+ npx lint-staged --config ./.husky/lint-stage-config.js
.npmrc ADDED
@@ -0,0 +1 @@
 
 
1
+ engine-strict=true
.prettierignore ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .DS_Store
2
+ node_modules
3
+ /build
4
+ /.svelte-kit
5
+ /package
6
+ /chart
7
+ .env
8
+ .env.*
9
+ !.env.example
10
+
11
+ # Ignore files for PNPM, NPM and YARN
12
+ pnpm-lock.yaml
13
+ package-lock.json
14
+ yarn.lock
.prettierrc ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {
2
+ "useTabs": true,
3
+ "trailingComma": "es5",
4
+ "printWidth": 100,
5
+ "plugins": ["prettier-plugin-svelte", "prettier-plugin-tailwindcss"],
6
+ "overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }]
7
+ }
.vscode/launch.json ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "version": "0.2.0",
3
+ "configurations": [
4
+ {
5
+ "command": "npm run dev",
6
+ "name": "Run development server",
7
+ "request": "launch",
8
+ "type": "node-terminal"
9
+ }
10
+ ]
11
+ }
.vscode/settings.json ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "editor.formatOnSave": true,
3
+ "editor.defaultFormatter": "esbenp.prettier-vscode",
4
+ "editor.codeActionsOnSave": {
5
+ "source.fixAll": "explicit"
6
+ },
7
+ "eslint.validate": ["javascript", "svelte"],
8
+ "[svelte]": {
9
+ "editor.defaultFormatter": "esbenp.prettier-vscode"
10
+ }
11
+ }
Dockerfile ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # syntax=docker/dockerfile:1
2
+ ARG INCLUDE_DB=false
3
+
4
+ FROM node:20-slim AS base
5
+ ENV PLAYWRIGHT_SKIP_BROWSER_GC=1
6
+
7
+ # install dotenv-cli
8
+ RUN npm install -g dotenv-cli
9
+
10
+ # switch to a user that works for spaces
11
+ RUN userdel -r node
12
+ RUN useradd -m -u 1000 user
13
+ USER user
14
+
15
+ ENV HOME=/home/user \
16
+ PATH=/home/user/.local/bin:$PATH
17
+
18
+ WORKDIR /app
19
+
20
+ # add a .env.local if the user doesn't bind a volume to it
21
+ RUN touch /app/.env.local
22
+
23
+
24
+ RUN npm i --no-package-lock --no-save playwright@1.47.0
25
+ USER root
26
+ RUN apt-get update
27
+ RUN apt-get install gnupg curl -y
28
+ RUN npx playwright install --with-deps chromium
29
+ RUN chown -R 1000:1000 /home/user/.npm
30
+ USER user
31
+
32
+ COPY --chown=1000 .env /app/.env
33
+ COPY --chown=1000 entrypoint.sh /app/entrypoint.sh
34
+ COPY --chown=1000 gcp-*.json /app/
35
+ COPY --chown=1000 package.json /app/package.json
36
+ COPY --chown=1000 package-lock.json /app/package-lock.json
37
+
38
+ RUN chmod +x /app/entrypoint.sh
39
+
40
+
41
+ FROM node:20 AS builder
42
+
43
+ WORKDIR /app
44
+
45
+ COPY --link --chown=1000 package-lock.json package.json ./
46
+
47
+ ARG APP_BASE=
48
+ ARG PUBLIC_APP_COLOR=blue
49
+ ENV BODY_SIZE_LIMIT=15728640
50
+
51
+ RUN --mount=type=cache,target=/app/.npm \
52
+ npm set cache /app/.npm && \
53
+ npm ci
54
+
55
+ COPY --link --chown=1000 . .
56
+
57
+ RUN git config --global --add safe.directory /app && \
58
+ npm run build
59
+
60
+ # mongo image
61
+ FROM mongo:7 AS mongo
62
+
63
+ # image to be used if INCLUDE_DB is false
64
+ FROM base AS local_db_false
65
+
66
+ # image to be used if INCLUDE_DB is true
67
+ FROM base AS local_db_true
68
+
69
+ # copy mongo from the other stage
70
+ COPY --from=mongo /usr/bin/mongo* /usr/bin/
71
+
72
+ ENV MONGODB_URL=mongodb://localhost:27017
73
+ USER root
74
+ RUN mkdir -p /data/db
75
+ RUN chown -R 1000:1000 /data/db
76
+ USER user
77
+ # final image
78
+ FROM local_db_${INCLUDE_DB} AS final
79
+
80
+ # build arg to determine if the database should be included
81
+ ARG INCLUDE_DB=false
82
+ ENV INCLUDE_DB=${INCLUDE_DB}
83
+
84
+ # svelte requires APP_BASE at build time so it must be passed as a build arg
85
+ ARG APP_BASE=
86
+ # tailwind requires the primary theme to be known at build time so it must be passed as a build arg
87
+ ARG PUBLIC_APP_COLOR=blue
88
+ ARG PUBLIC_COMMIT_SHA=
89
+ ENV PUBLIC_COMMIT_SHA=${PUBLIC_COMMIT_SHA}
90
+ ENV BODY_SIZE_LIMIT=15728640
91
+ #import the build & dependencies
92
+ COPY --from=builder --chown=1000 /app/build /app/build
93
+ COPY --from=builder --chown=1000 /app/node_modules /app/node_modules
94
+
95
+ CMD ["/bin/bash", "-c", "/app/entrypoint.sh"]
LICENSE ADDED
@@ -0,0 +1,203 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Copyright 2018- The Hugging Face team. All rights reserved.
2
+
3
+ Apache License
4
+ Version 2.0, January 2004
5
+ http://www.apache.org/licenses/
6
+
7
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
8
+
9
+ 1. Definitions.
10
+
11
+ "License" shall mean the terms and conditions for use, reproduction,
12
+ and distribution as defined by Sections 1 through 9 of this document.
13
+
14
+ "Licensor" shall mean the copyright owner or entity authorized by
15
+ the copyright owner that is granting the License.
16
+
17
+ "Legal Entity" shall mean the union of the acting entity and all
18
+ other entities that control, are controlled by, or are under common
19
+ control with that entity. For the purposes of this definition,
20
+ "control" means (i) the power, direct or indirect, to cause the
21
+ direction or management of such entity, whether by contract or
22
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
23
+ outstanding shares, or (iii) beneficial ownership of such entity.
24
+
25
+ "You" (or "Your") shall mean an individual or Legal Entity
26
+ exercising permissions granted by this License.
27
+
28
+ "Source" form shall mean the preferred form for making modifications,
29
+ including but not limited to software source code, documentation
30
+ source, and configuration files.
31
+
32
+ "Object" form shall mean any form resulting from mechanical
33
+ transformation or translation of a Source form, including but
34
+ not limited to compiled object code, generated documentation,
35
+ and conversions to other media types.
36
+
37
+ "Work" shall mean the work of authorship, whether in Source or
38
+ Object form, made available under the License, as indicated by a
39
+ copyright notice that is included in or attached to the work
40
+ (an example is provided in the Appendix below).
41
+
42
+ "Derivative Works" shall mean any work, whether in Source or Object
43
+ form, that is based on (or derived from) the Work and for which the
44
+ editorial revisions, annotations, elaborations, or other modifications
45
+ represent, as a whole, an original work of authorship. For the purposes
46
+ of this License, Derivative Works shall not include works that remain
47
+ separable from, or merely link (or bind by name) to the interfaces of,
48
+ the Work and Derivative Works thereof.
49
+
50
+ "Contribution" shall mean any work of authorship, including
51
+ the original version of the Work and any modifications or additions
52
+ to that Work or Derivative Works thereof, that is intentionally
53
+ submitted to Licensor for inclusion in the Work by the copyright owner
54
+ or by an individual or Legal Entity authorized to submit on behalf of
55
+ the copyright owner. For the purposes of this definition, "submitted"
56
+ means any form of electronic, verbal, or written communication sent
57
+ to the Licensor or its representatives, including but not limited to
58
+ communication on electronic mailing lists, source code control systems,
59
+ and issue tracking systems that are managed by, or on behalf of, the
60
+ Licensor for the purpose of discussing and improving the Work, but
61
+ excluding communication that is conspicuously marked or otherwise
62
+ designated in writing by the copyright owner as "Not a Contribution."
63
+
64
+ "Contributor" shall mean Licensor and any individual or Legal Entity
65
+ on behalf of whom a Contribution has been received by Licensor and
66
+ subsequently incorporated within the Work.
67
+
68
+ 2. Grant of Copyright License. Subject to the terms and conditions of
69
+ this License, each Contributor hereby grants to You a perpetual,
70
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
71
+ copyright license to reproduce, prepare Derivative Works of,
72
+ publicly display, publicly perform, sublicense, and distribute the
73
+ Work and such Derivative Works in Source or Object form.
74
+
75
+ 3. Grant of Patent License. Subject to the terms and conditions of
76
+ this License, each Contributor hereby grants to You a perpetual,
77
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
78
+ (except as stated in this section) patent license to make, have made,
79
+ use, offer to sell, sell, import, and otherwise transfer the Work,
80
+ where such license applies only to those patent claims licensable
81
+ by such Contributor that are necessarily infringed by their
82
+ Contribution(s) alone or by combination of their Contribution(s)
83
+ with the Work to which such Contribution(s) was submitted. If You
84
+ institute patent litigation against any entity (including a
85
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
86
+ or a Contribution incorporated within the Work constitutes direct
87
+ or contributory patent infringement, then any patent licenses
88
+ granted to You under this License for that Work shall terminate
89
+ as of the date such litigation is filed.
90
+
91
+ 4. Redistribution. You may reproduce and distribute copies of the
92
+ Work or Derivative Works thereof in any medium, with or without
93
+ modifications, and in Source or Object form, provided that You
94
+ meet the following conditions:
95
+
96
+ (a) You must give any other recipients of the Work or
97
+ Derivative Works a copy of this License; and
98
+
99
+ (b) You must cause any modified files to carry prominent notices
100
+ stating that You changed the files; and
101
+
102
+ (c) You must retain, in the Source form of any Derivative Works
103
+ that You distribute, all copyright, patent, trademark, and
104
+ attribution notices from the Source form of the Work,
105
+ excluding those notices that do not pertain to any part of
106
+ the Derivative Works; and
107
+
108
+ (d) If the Work includes a "NOTICE" text file as part of its
109
+ distribution, then any Derivative Works that You distribute must
110
+ include a readable copy of the attribution notices contained
111
+ within such NOTICE file, excluding those notices that do not
112
+ pertain to any part of the Derivative Works, in at least one
113
+ of the following places: within a NOTICE text file distributed
114
+ as part of the Derivative Works; within the Source form or
115
+ documentation, if provided along with the Derivative Works; or,
116
+ within a display generated by the Derivative Works, if and
117
+ wherever such third-party notices normally appear. The contents
118
+ of the NOTICE file are for informational purposes only and
119
+ do not modify the License. You may add Your own attribution
120
+ notices within Derivative Works that You distribute, alongside
121
+ or as an addendum to the NOTICE text from the Work, provided
122
+ that such additional attribution notices cannot be construed
123
+ as modifying the License.
124
+
125
+ You may add Your own copyright statement to Your modifications and
126
+ may provide additional or different license terms and conditions
127
+ for use, reproduction, or distribution of Your modifications, or
128
+ for any such Derivative Works as a whole, provided Your use,
129
+ reproduction, and distribution of the Work otherwise complies with
130
+ the conditions stated in this License.
131
+
132
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
133
+ any Contribution intentionally submitted for inclusion in the Work
134
+ by You to the Licensor shall be under the terms and conditions of
135
+ this License, without any additional terms or conditions.
136
+ Notwithstanding the above, nothing herein shall supersede or modify
137
+ the terms of any separate license agreement you may have executed
138
+ with Licensor regarding such Contributions.
139
+
140
+ 6. Trademarks. This License does not grant permission to use the trade
141
+ names, trademarks, service marks, or product names of the Licensor,
142
+ except as required for reasonable and customary use in describing the
143
+ origin of the Work and reproducing the content of the NOTICE file.
144
+
145
+ 7. Disclaimer of Warranty. Unless required by applicable law or
146
+ agreed to in writing, Licensor provides the Work (and each
147
+ Contributor provides its Contributions) on an "AS IS" BASIS,
148
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
149
+ implied, including, without limitation, any warranties or conditions
150
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
151
+ PARTICULAR PURPOSE. You are solely responsible for determining the
152
+ appropriateness of using or redistributing the Work and assume any
153
+ risks associated with Your exercise of permissions under this License.
154
+
155
+ 8. Limitation of Liability. In no event and under no legal theory,
156
+ whether in tort (including negligence), contract, or otherwise,
157
+ unless required by applicable law (such as deliberate and grossly
158
+ negligent acts) or agreed to in writing, shall any Contributor be
159
+ liable to You for damages, including any direct, indirect, special,
160
+ incidental, or consequential damages of any character arising as a
161
+ result of this License or out of the use or inability to use the
162
+ Work (including but not limited to damages for loss of goodwill,
163
+ work stoppage, computer failure or malfunction, or any and all
164
+ other commercial damages or losses), even if such Contributor
165
+ has been advised of the possibility of such damages.
166
+
167
+ 9. Accepting Warranty or Additional Liability. While redistributing
168
+ the Work or Derivative Works thereof, You may choose to offer,
169
+ and charge a fee for, acceptance of support, warranty, indemnity,
170
+ or other liability obligations and/or rights consistent with this
171
+ License. However, in accepting such obligations, You may act only
172
+ on Your own behalf and on Your sole responsibility, not on behalf
173
+ of any other Contributor, and only if You agree to indemnify,
174
+ defend, and hold each Contributor harmless for any liability
175
+ incurred by, or claims asserted against, such Contributor by reason
176
+ of your accepting any such warranty or additional liability.
177
+
178
+ END OF TERMS AND CONDITIONS
179
+
180
+ APPENDIX: How to apply the Apache License to your work.
181
+
182
+ To apply the Apache License to your work, attach the following
183
+ boilerplate notice, with the fields enclosed by brackets "[]"
184
+ replaced with your own identifying information. (Don't include
185
+ the brackets!) The text should be enclosed in the appropriate
186
+ comment syntax for the file format. We also recommend that a
187
+ file or class name and description of purpose be included on the
188
+ same "printed page" as the copyright notice for easier
189
+ identification within third-party archives.
190
+
191
+ Copyright [yyyy] [name of copyright owner]
192
+
193
+ Licensed under the Apache License, Version 2.0 (the "License");
194
+ you may not use this file except in compliance with the License.
195
+ You may obtain a copy of the License at
196
+
197
+ http://www.apache.org/licenses/LICENSE-2.0
198
+
199
+ Unless required by applicable law or agreed to in writing, software
200
+ distributed under the License is distributed on an "AS IS" BASIS,
201
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
202
+ See the License for the specific language governing permissions and
203
+ limitations under the License.
PRIVACY.md ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ## Privacy
2
+
3
+ > Last updated: Feb 14, 2025
4
+
5
+ Users of HuggingChat are authenticated through their HF user account.
6
+
7
+ We endorse Privacy by Design. As such, your conversations are private to you and will not be shared with anyone, including model authors, for any purpose, including for research or model training purposes.
8
+
9
+ You conversation data will only be stored to let you access past conversations. You can click on the Delete icon to delete any past conversation at any moment.
10
+
11
+ 🗓 Please also consult huggingface.co's main privacy policy at <https://huggingface.co/privacy>. To exercise any of your legal privacy rights, please send an email to <privacy@huggingface.co>.
12
+
13
+ ## About available LLMs
14
+
15
+ The goal of this app is to showcase that it is now possible to build an open source alternative to ChatGPT. 💪
16
+
17
+ We aim to always provide a diverse set of state of the art open LLMs, hence we rotate the available models over time. Discuss available models and request new ones on the [models discussion page](https://huggingface.co/spaces/huggingchat/chat-ui/discussions/372).
18
+
19
+ Check the [models](https://huggingface.co/chat/models/) page for an up-to-date list of the best available LLMs.
20
+
21
+ ## Technical details
22
+
23
+ [![chat-ui](https://img.shields.io/github/stars/huggingface/chat-ui)](https://github.com/huggingface/chat-ui)
24
+
25
+ The app is completely open source, and further development takes place on the [huggingface/chat-ui](https://github.com/huggingface/chat-ui) GitHub repo. We're always open to contributions!
26
+
27
+ You can find the production configuration for HuggingChat [here](https://github.com/huggingface/chat-ui/blob/main/chart/env/prod.yaml).
28
+
29
+ The inference backend is running the optimized [text-generation-inference](https://github.com/huggingface/text-generation-inference) on HuggingFace's Inference API infrastructure.
30
+
31
+ It is possible to deploy a copy of this app to a Space and customize it (swap model, add some UI elements, or store user messages according to your own Terms and conditions). You can also 1-click deploy your own instance using the [Chat UI Spaces Docker template](https://huggingface.co/new-space?template=huggingchat/chat-ui-template).
32
+
33
+ We welcome any feedback on this app: please participate to the public discussion at <https://huggingface.co/spaces/huggingchat/chat-ui/discussions>
34
+
35
+ <a target="_blank" href="https://huggingface.co/spaces/huggingchat/chat-ui/discussions"><img src="https://huggingface.co/datasets/huggingface/badges/raw/main/open-a-discussion-xl.svg" title="open a discussion"></a>
PROMPTS.md ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Prompt templates
2
+
3
+ > [!WARNING]
4
+ > We now recommend using the `tokenizer` field to get the chat template directly from the hub. Just set it to your model id on the hub to automatically get the template.
5
+
6
+ These are the templates used to format the conversation history for different models used in HuggingChat. Set them in your `.env.local` [like so](https://github.com/huggingface/chat-ui#chatprompttemplate).
7
+
8
+ ## Llama 2
9
+
10
+ ```env
11
+ <s>[INST] <<SYS>>\n{{preprompt}}\n<</SYS>>\n\n{{#each messages}}{{#ifUser}}{{content}} [/INST] {{/ifUser}}{{#ifAssistant}}{{content}} </s><s>[INST] {{/ifAssistant}}{{/each}}
12
+ ```
13
+
14
+ ## CodeLlama
15
+
16
+ ```env
17
+ <s>[INST] <<SYS>>\n{{preprompt}}\n<</SYS>>\n\n{{#each messages}}{{#ifUser}}{{content}} [/INST] {{/ifUser}}{{#ifAssistant}}{{content}} </s><s>[INST] {{/ifAssistant}}{{/each}}
18
+ ```
19
+
20
+ ## Falcon
21
+
22
+ ```env
23
+ System: {{preprompt}}\nUser:{{#each messages}}{{#ifUser}}{{content}}\nFalcon:{{/ifUser}}{{#ifAssistant}}{{content}}\nUser:{{/ifAssistant}}{{/each}}
24
+ ```
25
+
26
+ ## Mistral
27
+
28
+ ```env
29
+ <s>{{#each messages}}{{#ifUser}}[INST] {{#if @first}}{{#if @root.preprompt}}{{@root.preprompt}}\n{{/if}}{{/if}} {{content}} [/INST]{{/ifUser}}{{#ifAssistant}}{{content}}</s> {{/ifAssistant}}{{/each}}
30
+ ```
31
+
32
+ ## Zephyr
33
+
34
+ ```env
35
+ <|system|>\n{{preprompt}}</s>\n{{#each messages}}{{#ifUser}}<|user|>\n{{content}}</s>\n<|assistant|>\n{{/ifUser}}{{#ifAssistant}}{{content}}</s>\n{{/ifAssistant}}{{/each}}
36
+ ```
37
+
38
+ ## IDEFICS
39
+
40
+ ```env
41
+ {{#each messages}}{{#ifUser}}User: {{content}}{{/ifUser}}<end_of_utterance>\nAssistant: {{#ifAssistant}}{{content}}\n{{/ifAssistant}}{{/each}}
42
+ ```
43
+
44
+ ## OpenChat
45
+
46
+ ```env
47
+ <s>{{#each messages}}{{#ifUser}}GPT4 User: {{#if @first}}{{#if @root.preprompt}}{{@root.preprompt}}\n{{/if}}{{/if}}{{content}}<|end_of_turn|>GPT4 Assistant: {{/ifUser}}{{#ifAssistant}}{{content}}<|end_of_turn|>{{/ifAssistant}}{{/each}}
48
+ ```
49
+
50
+ ## Mixtral
51
+
52
+ ```env
53
+ <s> {{#each messages}}{{#ifUser}}[INST]{{#if @first}}{{#if @root.preprompt}}{{@root.preprompt}}\n{{/if}}{{/if}} {{content}} [/INST]{{/ifUser}}{{#ifAssistant}} {{content}}</s> {{/ifAssistant}}{{/each}}
54
+ ```
55
+
56
+ ## ChatML
57
+
58
+ ```env
59
+ {{#if @root.preprompt}}<|im_start|>system\n{{@root.preprompt}}<|im_end|>\n{{/if}}{{#each messages}}{{#ifUser}}<|im_start|>user\n{{content}}<|im_end|>\n<|im_start|>assistant\n{{/ifUser}}{{#ifAssistant}}{{content}}<|im_end|>\n{{/ifAssistant}}{{/each}}
60
+ ```
61
+
62
+ ## CodeLlama 70B
63
+
64
+ ```env
65
+ <s>{{#if @root.preprompt}}Source: system\n\n {{@root.preprompt}} <step> {{/if}}{{#each messages}}{{#ifUser}}Source: user\n\n {{content}} <step> {{/ifUser}}{{#ifAssistant}}Source: assistant\n\n {{content}} <step> {{/ifAssistant}}{{/each}}Source: assistant\nDestination: user\n\n ``
66
+ ```
67
+
68
+ ## Gemma
69
+
70
+ ```env
71
+ {{#each messages}}{{#ifUser}}<start_of_turn>user\n{{#if @first}}{{#if @root.preprompt}}{{@root.preprompt}}\n{{/if}}{{/if}}{{content}}<end_of_turn>\n<start_of_turn>model\n{{/ifUser}}{{#ifAssistant}}{{content}}<end_of_turn>\n{{/ifAssistant}}{{/each}}
72
+ ```
chart/Chart.yaml ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ apiVersion: v2
2
+ name: chat-ui
3
+ version: 0.0.1-latest
4
+ type: application
5
+ icon: https://huggingface.co/front/assets/huggingface_logo-noborder.svg
chart/env/prod.yaml ADDED
@@ -0,0 +1,677 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ image:
2
+ repository: huggingface
3
+ name: chat-ui
4
+
5
+ nodeSelector:
6
+ role-huggingchat: "true"
7
+
8
+ tolerations:
9
+ - key: "huggingface.co/huggingchat"
10
+ operator: "Equal"
11
+ value: "true"
12
+ effect: "NoSchedule"
13
+
14
+ serviceAccount:
15
+ enabled: true
16
+ create: true
17
+ name: huggingchat-prod
18
+
19
+ ingress:
20
+ path: "/chat"
21
+ annotations:
22
+ alb.ingress.kubernetes.io/healthcheck-path: "/healthcheck"
23
+ alb.ingress.kubernetes.io/listen-ports: "[{\"HTTP\": 80}, {\"HTTPS\": 443}]"
24
+ alb.ingress.kubernetes.io/group.name: "hub-prod"
25
+ alb.ingress.kubernetes.io/scheme: "internet-facing"
26
+ alb.ingress.kubernetes.io/ssl-redirect: "443"
27
+ alb.ingress.kubernetes.io/tags: "Env=prod,Project=hub,Terraform=true"
28
+ alb.ingress.kubernetes.io/target-node-labels: "role-hub-utils=true"
29
+ kubernetes.io/ingress.class: "alb"
30
+
31
+ envVars:
32
+ ADDRESS_HEADER: 'X-Forwarded-For'
33
+ ALTERNATIVE_REDIRECT_URLS: '["huggingchat://login/callback"]'
34
+ APP_BASE: "/chat"
35
+ ALLOW_IFRAME: "false"
36
+ COMMUNITY_TOOLS: "true"
37
+ COOKIE_SAMESITE: "lax"
38
+ COOKIE_SECURE: "true"
39
+ ENABLE_ASSISTANTS: "true"
40
+ ENABLE_ASSISTANTS_RAG: "true"
41
+ METRICS_PORT: 5565
42
+ LOG_LEVEL: "debug"
43
+ METRICS_ENABLED: "true"
44
+ MODELS: >
45
+ [
46
+ {
47
+ "name": "meta-llama/Llama-3.3-70B-Instruct",
48
+ "id": "meta-llama/Llama-3.3-70B-Instruct",
49
+ "description": "Ideal for everyday use. A fast and extremely capable model matching closed source models' capabilities. Now with the latest Llama 3.3 weights!",
50
+ "modelUrl": "https://huggingface.co/meta-llama/Llama-3.3-70B-Instruct",
51
+ "websiteUrl": "https://llama.meta.com/",
52
+ "logoUrl": "https://huggingface.co/datasets/huggingchat/models-logo/resolve/main/meta-logo.png",
53
+ "tools": true,
54
+ "preprompt": "",
55
+ "parameters": {
56
+ "stop": ["<|endoftext|>", "<|eot_id|>"],
57
+ "temperature": 0.6,
58
+ "max_new_tokens": 1024,
59
+ "truncate": 7167
60
+ },
61
+ "promptExamples": [
62
+ {
63
+ "title": "Write an email from bullet list",
64
+ "prompt": "As a restaurant owner, write a professional email to the supplier to get these products every week: \n\n- Wine (x10)\n- Eggs (x24)\n- Bread (x12)"
65
+ },
66
+ {
67
+ "title": "Code a snake game",
68
+ "prompt": "Code a basic snake game in python, give explanations for each step."
69
+ },
70
+ {
71
+ "title": "Assist in a task",
72
+ "prompt": "How do I make a delicious lemon cheesecake?"
73
+ }
74
+ ]
75
+ },
76
+ {
77
+ "name": "Qwen/Qwen2.5-72B-Instruct",
78
+ "description": "The latest Qwen open model with improved role-playing, long text generation and structured data understanding.",
79
+ "modelUrl": "https://huggingface.co/Qwen/Qwen2.5-72B-Instruct",
80
+ "websiteUrl": "https://qwenlm.github.io/blog/qwen2.5/",
81
+ "logoUrl": "https://huggingface.co/datasets/huggingchat/models-logo/resolve/main/qwen-logo.png",
82
+ "preprompt": "You are Qwen, created by Alibaba Cloud. You are a helpful assistant.",
83
+ "parameters": {
84
+ "stop": ["<|endoftext|>", "<|im_end|>"],
85
+ "temperature": 0.6,
86
+ "truncate": 28672,
87
+ "max_new_tokens": 3072
88
+ },
89
+ "tools": true,
90
+ "promptExamples": [
91
+ {
92
+ "title": "Write an email from bullet list",
93
+ "prompt": "As a restaurant owner, write a professional email to the supplier to get these products every week: \n\n- Wine (x10)\n- Eggs (x24)\n- Bread (x12)"
94
+ },
95
+ {
96
+ "title": "Code a snake game",
97
+ "prompt": "Code a basic snake game in python, give explanations for each step."
98
+ },
99
+ {
100
+ "title": "Assist in a task",
101
+ "prompt": "How do I make a delicious lemon cheesecake?"
102
+ }
103
+ ]
104
+ },
105
+ {
106
+ "name": "CohereForAI/c4ai-command-r-plus-08-2024",
107
+ "description": "Cohere's largest language model, optimized for conversational interaction and tool use. Now with the 2024 update!",
108
+ "modelUrl": "https://huggingface.co/CohereForAI/c4ai-command-r-plus-08-2024",
109
+ "websiteUrl": "https://docs.cohere.com/docs/command-r-plus",
110
+ "logoUrl": "https://huggingface.co/datasets/huggingchat/models-logo/resolve/main/cohere-logo.png",
111
+ "tools": true,
112
+ "parameters": {
113
+ "stop": ["<|END_OF_TURN_TOKEN|>", "<|im_end|>"],
114
+ "truncate": 28672,
115
+ "max_new_tokens": 2048,
116
+ "temperature": 0.3
117
+ },
118
+ "promptExamples": [
119
+ {
120
+ "title": "Generate a mouse portrait",
121
+ "prompt": "Generate the portrait of a scientific mouse in its laboratory."
122
+ },
123
+ {
124
+ "title": "Review a pull request",
125
+ "prompt": "Review this pull request: https://github.com/huggingface/chat-ui/pull/1131/files"
126
+ },
127
+ {
128
+ "title": "Code a snake game",
129
+ "prompt": "Code a basic snake game in python, give explanations for each step."
130
+ }
131
+ ]
132
+ },
133
+ {
134
+ "name": "deepseek-ai/DeepSeek-R1-Distill-Qwen-32B",
135
+ "modelUrl": "https://huggingface.co/deepseek-ai/DeepSeek-R1-Distill-Qwen-32B",
136
+ "websiteUrl": "https://deepseek.com/",
137
+ "logoUrl": "https://huggingface.co/datasets/huggingchat/models-logo/resolve/main/deepseek-logo.png",
138
+ "description": "The first reasoning model from DeepSeek, distilled into a 32B dense model. Outperforms o1-mini on multiple benchmarks.",
139
+ "reasoning": {
140
+ "type": "tokens",
141
+ "beginToken": "",
142
+ "endToken": "</think>"
143
+ },
144
+ "promptExamples": [
145
+ {
146
+ "title": "Rs in strawberry",
147
+ "prompt": "how many R in strawberry?"
148
+ },
149
+ {
150
+ "title": "Larger number",
151
+ "prompt": "9.11 or 9.9 which number is larger?"
152
+ },
153
+ {
154
+ "title": "Measuring 6 liters",
155
+ "prompt": "I have a 6- and a 12-liter jug. I want to measure exactly 6 liters."
156
+ }
157
+ ],
158
+ "endpoints": [
159
+ {
160
+ "type": "openai",
161
+ "baseURL": "https://internal.api-inference.huggingface.co/models/deepseek-ai/DeepSeek-R1-Distill-Qwen-32B/v1"
162
+ }
163
+ ]
164
+ },
165
+ {
166
+ "name": "nvidia/Llama-3.1-Nemotron-70B-Instruct-HF",
167
+ "modelUrl": "https://huggingface.co/nvidia/Llama-3.1-Nemotron-70B-Instruct-HF",
168
+ "websiteUrl": "https://www.nvidia.com/",
169
+ "logoUrl": "https://huggingface.co/datasets/huggingchat/models-logo/resolve/main/nvidia-logo.png",
170
+ "description": "Nvidia's latest Llama fine-tune, topping alignment benchmarks and optimized for instruction following.",
171
+ "parameters": {
172
+ "stop": ["<|eot_id|>", "<|im_end|>"],
173
+ "temperature": 0.5,
174
+ "truncate": 28672,
175
+ "max_new_tokens": 2048
176
+ },
177
+ "promptExamples": [
178
+ {
179
+ "title": "Rs in strawberry",
180
+ "prompt": "how many R in strawberry?"
181
+ },
182
+ {
183
+ "title": "Larger number",
184
+ "prompt": "9.11 or 9.9 which number is larger?"
185
+ },
186
+ {
187
+ "title": "Measuring 6 liters",
188
+ "prompt": "I have a 6- and a 12-liter jug. I want to measure exactly 6 liters."
189
+ }
190
+ ],
191
+ "endpoints": [
192
+ {
193
+ "type": "openai",
194
+ "baseURL": "https://internal.api-inference.huggingface.co/models/nvidia/Llama-3.1-Nemotron-70B-Instruct-HF/v1"
195
+ }
196
+ ]
197
+ },
198
+ {
199
+ "name": "Qwen/QwQ-32B",
200
+ "preprompt": "You are a helpful and harmless assistant. You are Qwen developed by Alibaba. You should think step-by-step.",
201
+ "modelUrl": "https://huggingface.co/Qwen/QwQ-32B",
202
+ "websiteUrl": "https://qwenlm.github.io/blog/qwq-32b/",
203
+ "logoUrl": "https://huggingface.co/datasets/huggingchat/models-logo/resolve/main/qwen-logo.png",
204
+ "description": "QwQ is the latest reasoning model released by the Qwen team, approaching the capabilities of R1 in benchmarks.",
205
+ "reasoning": {
206
+ "type": "tokens",
207
+ "beginToken": "",
208
+ "endToken": "</think>"
209
+ },
210
+ "promptExamples": [
211
+ {
212
+ "title": "Rs in strawberry",
213
+ "prompt": "how many R in strawberry?"
214
+ },
215
+ {
216
+ "title": "Larger number",
217
+ "prompt": "9.11 or 9.9 which number is larger?"
218
+ },
219
+ {
220
+ "title": "Measuring 6 liters",
221
+ "prompt": "I have a 6- and a 12-liter jug. I want to measure exactly 6 liters."
222
+ }
223
+ ],
224
+ "endpoints": [
225
+ {
226
+ "type": "openai",
227
+ "baseURL": "https://atv7xs1nxxtx2wl0.us-east-1.aws.endpoints.huggingface.cloud/v1"
228
+ }
229
+ ]
230
+ },
231
+ {
232
+ "name": "Qwen/Qwen2.5-Coder-32B-Instruct",
233
+ "description": "Qwen's latest coding model, in its biggest size yet. SOTA on many coding benchmarks.",
234
+ "modelUrl": "https://huggingface.co/Qwen/Qwen2.5-Coder-32B-Instruct",
235
+ "websiteUrl": "https://qwenlm.github.io/blog/qwen2.5-coder-family/",
236
+ "logoUrl": "https://huggingface.co/datasets/huggingchat/models-logo/resolve/main/qwen-logo.png",
237
+ "preprompt": "You are Qwen, created by Alibaba Cloud. You are a helpful assistant.",
238
+ "parameters": {
239
+ "stop": ["<|im_end|>", "<|endoftext|>"],
240
+ "temperature": 0.6,
241
+ "truncate": 28672,
242
+ "max_new_tokens": 3072
243
+ },
244
+ "promptExamples": [
245
+ {
246
+ "title": "To-do list web app",
247
+ "prompt": "Create a simple to-do list application where users can:\n- Add new tasks.\n- Mark tasks as complete.\n- Delete completed tasks.\nThe tasks should persist in the browser's local storage so that they remain available even after a page reload.\n"
248
+ },
249
+ {
250
+ "title": "Create a REST API",
251
+ "prompt": "Build a simple REST API using Node.js, TypeScript and Express:\n- POST /items: Accepts a JSON body with name and quantity and adds a new item.\n- GET /items: Returns a list of all items.\n- PUT /items/:id: Updates the name or quantity of an item by its id.\n- DELETE /items/:id: Removes an item by its id.\nUse an in-memory array as the data store (no need for a database). Include basic error handling (e.g., item not found)."
252
+ },
253
+ {
254
+ "title": "Simple website",
255
+ "prompt": "Generate a snazzy static landing page for a local coffee shop using HTML and CSS. You can use tailwind using <script src='https://cdn.tailwindcss.com'></script>."
256
+ }
257
+ ],
258
+ "endpoints": [
259
+ {
260
+ "type": "openai",
261
+ "baseURL": "https://internal.api-inference.huggingface.co/models/Qwen/Qwen2.5-Coder-32B-Instruct/v1"
262
+ }
263
+ ]
264
+ },
265
+ {
266
+ "name": "google/gemma-3-27b-it",
267
+ "logoUrl": "https://huggingface.co/datasets/huggingchat/models-logo/resolve/main/google-logo.png",
268
+ "multimodal": true,
269
+ "description": "Google's latest open model with great multilingual performance, supports image inputs natively.",
270
+ "websiteUrl": "https://blog.google/technology/developers/gemma-3/",
271
+ "promptExamples": [
272
+ {
273
+ "title": "Write an email from bullet list",
274
+ "prompt": "As a restaurant owner, write a professional email to the supplier to get these products every week: \n\n- Wine (x10)\n- Eggs (x24)\n- Bread (x12)"
275
+ },
276
+ {
277
+ "title": "Code a snake game",
278
+ "prompt": "Code a basic snake game in python, give explanations for each step."
279
+ },
280
+ {
281
+ "title": "Assist in a task",
282
+ "prompt": "How do I make a delicious lemon cheesecake?"
283
+ }
284
+ ],
285
+ "endpoints": [
286
+ {
287
+ "type": "openai",
288
+ "baseURL": "https://wp0d3hn6s3k8jk22.us-east-1.aws.endpoints.huggingface.cloud/v1",
289
+ "multimodal": {
290
+ "image": {
291
+ "maxSizeInMB": 10,
292
+ "maxWidth": 560,
293
+ "maxHeight": 560,
294
+ "supportedMimeTypes": ["image/jpeg"],
295
+ "preferredMimeType": "image/jpeg"
296
+ }
297
+ }
298
+ }
299
+ ]
300
+ },
301
+ {
302
+ "name": "meta-llama/Llama-3.2-11B-Vision-Instruct",
303
+ "logoUrl": "https://huggingface.co/datasets/huggingchat/models-logo/resolve/main/meta-logo.png",
304
+ "description": "The latest multimodal model from Meta! Supports image inputs natively.",
305
+ "websiteUrl": "https://llama.com/",
306
+ "multimodal": true,
307
+ "parameters": {
308
+ "stop": ["<|eot_id|>", "<|im_end|>"],
309
+ "temperature": 0.6,
310
+ "truncate": 14336,
311
+ "max_new_tokens": 1536
312
+ },
313
+ "promptExamples": [
314
+ {
315
+ "title": "Write an email from bullet list",
316
+ "prompt": "As a restaurant owner, write a professional email to the supplier to get these products every week: \n\n- Wine (x10)\n- Eggs (x24)\n- Bread (x12)"
317
+ },
318
+ {
319
+ "title": "Code a snake game",
320
+ "prompt": "Code a basic snake game in python, give explanations for each step."
321
+ },
322
+ {
323
+ "title": "Assist in a task",
324
+ "prompt": "How do I make a delicious lemon cheesecake?"
325
+ }
326
+ ],
327
+ "endpoints": [
328
+ {
329
+ "type": "openai",
330
+ "baseURL": "https://internal.api-inference.huggingface.co/models/meta-llama/Llama-3.2-11B-Vision-Instruct/v1",
331
+ "multimodal": {
332
+ "image": {
333
+ "maxSizeInMB": 10,
334
+ "maxWidth": 560,
335
+ "maxHeight": 560,
336
+ "supportedMimeTypes": ["image/png", "image/jpeg", "image/webp"],
337
+ "preferredMimeType": "image/webp"
338
+ }
339
+ }
340
+ }
341
+ ]
342
+ },
343
+ {
344
+ "name": "NousResearch/Hermes-3-Llama-3.1-8B",
345
+ "description": "Nous Research's latest Hermes 3 release in 8B size. Follows instruction closely.",
346
+ "logoUrl": "https://huggingface.co/datasets/huggingchat/models-logo/resolve/main/nous-logo.png",
347
+ "websiteUrl": "https://nousresearch.com/",
348
+ "modelUrl": "https://huggingface.co/NousResearch/Hermes-3-Llama-3.1-8B",
349
+ "promptExamples": [
350
+ {
351
+ "title": "Write an email from bullet list",
352
+ "prompt": "As a restaurant owner, write a professional email to the supplier to get these products every week: \n\n- Wine (x10)\n- Eggs (x24)\n- Bread (x12)"
353
+ },
354
+ {
355
+ "title": "Code a snake game",
356
+ "prompt": "Code a basic snake game in python, give explanations for each step."
357
+ },
358
+ {
359
+ "title": "Assist in a task",
360
+ "prompt": "How do I make a delicious lemon cheesecake?"
361
+ }
362
+ ],
363
+ "parameters": {
364
+ "stop": ["<|im_end|>"],
365
+ "temperature": 0.6,
366
+ "truncate": 14336,
367
+ "max_new_tokens": 1536
368
+ }
369
+ },
370
+ {
371
+ "name": "mistralai/Mistral-Nemo-Instruct-2407",
372
+ "displayName": "mistralai/Mistral-Nemo-Instruct-2407",
373
+ "description": "A small model with good capabilities in language understanding and commonsense reasoning.",
374
+ "logoUrl": "https://huggingface.co/datasets/huggingchat/models-logo/resolve/main/mistral-logo.png",
375
+ "websiteUrl": "https://mistral.ai/news/mistral-nemo/",
376
+ "modelUrl": "https://huggingface.co/mistralai/Mistral-Nemo-Instruct-2407",
377
+ "preprompt": "",
378
+ "parameters": {
379
+ "stop": ["</s>"],
380
+ "temperature": 0.6,
381
+ "truncate": 14336,
382
+ "max_new_tokens": 1536
383
+ },
384
+ "promptExamples": [
385
+ {
386
+ "title": "Write an email from bullet list",
387
+ "prompt": "As a restaurant owner, write a professional email to the supplier to get these products every week: \n\n- Wine (x10)\n- Eggs (x24)\n- Bread (x12)"
388
+ },
389
+ {
390
+ "title": "Code a snake game",
391
+ "prompt": "Code a basic snake game in python, give explanations for each step."
392
+ },
393
+ {
394
+ "title": "Assist in a task",
395
+ "prompt": "How do I make a delicious lemon cheesecake?"
396
+ }
397
+ ]
398
+ },
399
+ {
400
+ "name": "microsoft/Phi-3.5-mini-instruct",
401
+ "description": "One of the best small models (3.8B parameters), super fast for simple tasks.",
402
+ "logoUrl": "https://huggingface.co/datasets/huggingchat/models-logo/resolve/main/microsoft-logo.png",
403
+ "modelUrl": "https://huggingface.co/microsoft/Phi-3.5-mini-instruct",
404
+ "websiteUrl": "https://techcommunity.microsoft.com/t5/ai-azure-ai-services-blog/discover-the-new-multi-lingual-high-quality-phi-3-5-slms/ba-p/4225280/",
405
+ "preprompt": "",
406
+ "parameters": {
407
+ "stop": ["<|end|>", "<|endoftext|>", "<|assistant|>"],
408
+ "temperature": 0.6,
409
+ "truncate": 28672,
410
+ "max_new_tokens": 3072
411
+ },
412
+ "promptExamples": [
413
+ {
414
+ "title": "Write an email from bullet list",
415
+ "prompt": "As a restaurant owner, write a professional email to the supplier to get these products every week: \n\n- Wine (x10)\n- Eggs (x24)\n- Bread (x12)"
416
+ },
417
+ {
418
+ "title": "Code a snake game",
419
+ "prompt": "Code a basic snake game in python, give explanations for each step."
420
+ },
421
+ {
422
+ "title": "Assist in a task",
423
+ "prompt": "How do I make a delicious lemon cheesecake?"
424
+ }
425
+ ]
426
+ },
427
+ {
428
+ "name": "internal/task",
429
+ "tokenizer" : "NousResearch/Hermes-3-Llama-3.1-8B",
430
+ "unlisted": true,
431
+ "tools" : true,
432
+ "endpoints": [
433
+ {
434
+ "type": "openai",
435
+ "baseURL": "https://internal.api-inference.huggingface.co/models/NousResearch/Hermes-3-Llama-3.1-8B/v1"
436
+ }
437
+ ],
438
+ "parameters": {
439
+ "temperature": 0.1,
440
+ "max_new_tokens": 256
441
+ },
442
+ }
443
+ ]
444
+
445
+ NODE_ENV: "prod"
446
+ NODE_LOG_STRUCTURED_DATA: true
447
+ OLD_MODELS: >
448
+ [
449
+ { "name": "bigcode/starcoder" },
450
+ { "name": "OpenAssistant/oasst-sft-6-llama-30b-xor" },
451
+ { "name": "HuggingFaceH4/zephyr-7b-alpha" },
452
+ { "name": "openchat/openchat_3.5" },
453
+ { "name": "openchat/openchat-3.5-1210" },
454
+ { "name": "tiiuae/falcon-180B-chat" },
455
+ { "name": "codellama/CodeLlama-34b-Instruct-hf" },
456
+ { "name": "google/gemma-7b-it" },
457
+ { "name": "meta-llama/Llama-2-70b-chat-hf" },
458
+ { "name": "codellama/CodeLlama-70b-Instruct-hf" },
459
+ { "name": "openchat/openchat-3.5-0106" },
460
+ { "name": "meta-llama/Meta-Llama-3-70B-Instruct" },
461
+ { "name": "meta-llama/Meta-Llama-3.1-405B-Instruct-FP8" },
462
+ {
463
+ "name": "CohereForAI/c4ai-command-r-plus",
464
+ "transferTo": "CohereForAI/c4ai-command-r-plus-08-2024"
465
+ },
466
+ {
467
+ "name": "01-ai/Yi-1.5-34B-Chat",
468
+ "transferTo": "CohereForAI/c4ai-command-r-plus-08-2024"
469
+ },
470
+ {
471
+ "name": "mistralai/Mixtral-8x7B-Instruct-v0.1",
472
+ "transferTo": "mistralai/Mistral-Nemo-Instruct-2407"
473
+ },
474
+ {
475
+ "name": "NousResearch/Nous-Hermes-2-Mixtral-8x7B-DPO",
476
+ "transferTo": "NousResearch/Hermes-3-Llama-3.1-8B"
477
+ },
478
+ {
479
+ "name": "mistralai/Mistral-7B-Instruct-v0.3",
480
+ "transferTo": "mistralai/Mistral-Nemo-Instruct-2407"
481
+ },
482
+ {
483
+ "name": "microsoft/Phi-3-mini-4k-instruct",
484
+ "transferTo": "microsoft/Phi-3.5-mini-instruct"
485
+ },
486
+ {
487
+ "name": "meta-llama/Meta-Llama-3.1-70B-Instruct",
488
+ "transferTo": "meta-llama/Llama-3.3-70B-Instruct"
489
+ },
490
+ {
491
+ "name": "Qwen/QwQ-32B-Preview",
492
+ "transferTo": "Qwen/QwQ-32B"
493
+ }
494
+ ]
495
+ PUBLIC_ORIGIN: "https://huggingface.co"
496
+ PUBLIC_SHARE_PREFIX: "https://hf.co/chat"
497
+ PUBLIC_ANNOUNCEMENT_BANNERS: >
498
+ [
499
+ {
500
+ "title": "DeepSeek R1 is now available!",
501
+ "linkTitle": "Try it out!",
502
+ "linkHref": "https://huggingface.co/chat/models/deepseek-ai/DeepSeek-R1-Distill-Qwen-32B"
503
+ }
504
+ ]
505
+ PUBLIC_APP_NAME: "HuggingChat"
506
+ PUBLIC_APP_ASSETS: "huggingchat"
507
+ PUBLIC_APP_COLOR: "yellow"
508
+ PUBLIC_APP_DESCRIPTION: "Making the community's best AI chat models available to everyone."
509
+ PUBLIC_APP_DISCLAIMER_MESSAGE: "Disclaimer: AI is an area of active research with known problems such as biased generation and misinformation. Do not use this application for high-stakes decisions or advice."
510
+ PUBLIC_APP_GUEST_MESSAGE: "Sign in with a free Hugging Face account to continue using HuggingChat."
511
+ PUBLIC_APP_DATA_SHARING: 0
512
+ PUBLIC_APP_DISCLAIMER: 1
513
+ PUBLIC_PLAUSIBLE_SCRIPT_URL: "/js/script.js"
514
+ REQUIRE_FEATURED_ASSISTANTS: "true"
515
+ TASK_MODEL: "internal/task"
516
+ TEXT_EMBEDDING_MODELS: >
517
+ [{
518
+ "name": "bge-base-en-v1-5-sxa",
519
+ "displayName": "bge-base-en-v1-5-sxa",
520
+ "chunkCharLength": 512,
521
+ "endpoints": [{
522
+ "type": "tei",
523
+ "url": "https://huggingchat-tei.hf.space/"
524
+ }]
525
+ }]
526
+ WEBSEARCH_BLOCKLIST: '["youtube.com", "twitter.com"]'
527
+ XFF_DEPTH: '2'
528
+ TOOLS: >
529
+ [
530
+ {
531
+ "_id": "000000000000000000000001",
532
+ "displayName": "Image Generation",
533
+ "description": "Use this tool to generate images based on a prompt.",
534
+ "color": "yellow",
535
+ "icon": "camera",
536
+ "baseUrl": "black-forest-labs/FLUX.1-schnell",
537
+ "name": "image_generation",
538
+ "endpoint": "/infer",
539
+ "inputs": [
540
+ {
541
+ "name": "prompt",
542
+ "description": "A prompt to generate an image from",
543
+ "paramType": "required",
544
+ "type": "str"
545
+ },
546
+ { "name": "seed", "paramType": "fixed", "value": "0", "type": "float" },
547
+ {
548
+ "name": "randomize_seed",
549
+ "paramType": "fixed",
550
+ "value": "true",
551
+ "type": "bool"
552
+ },
553
+ {
554
+ "name": "width",
555
+ "description": "numeric value between 256 and 2048",
556
+ "paramType": "optional",
557
+ "default": 1024,
558
+ "type": "float"
559
+ },
560
+ {
561
+ "name": "height",
562
+ "description": "numeric value between 256 and 2048",
563
+ "paramType": "optional",
564
+ "default": 1024,
565
+ "type": "float"
566
+ },
567
+ {
568
+ "name": "num_inference_steps",
569
+ "paramType": "fixed",
570
+ "value": "4",
571
+ "type": "float"
572
+ }
573
+ ],
574
+ "outputComponent": "image",
575
+ "outputComponentIdx": 0,
576
+ "showOutput": true
577
+ },
578
+ {
579
+ "_id": "000000000000000000000002",
580
+ "displayName": "Document Parser",
581
+ "description": "Use this tool to parse any document and get its content in markdown format.",
582
+ "color": "yellow",
583
+ "icon": "cloud",
584
+ "baseUrl": "huggingchat/document-parser",
585
+ "name": "document_parser",
586
+ "endpoint": "/predict",
587
+ "inputs": [
588
+ {
589
+ "name": "document",
590
+ "description": "Filename of the document to parse",
591
+ "paramType": "required",
592
+ "type": "file",
593
+ "mimeTypes": 'application/*'
594
+ },
595
+ {
596
+ "name": "filename",
597
+ "paramType": "fixed",
598
+ "value": "document.pdf",
599
+ "type": "str"
600
+ }
601
+ ],
602
+ "outputComponent": "textbox",
603
+ "outputComponentIdx": 0,
604
+ "showOutput": false,
605
+ "isHidden": true
606
+ },
607
+ {
608
+ "_id": "000000000000000000000003",
609
+ "name": "edit_image",
610
+ "baseUrl": "multimodalart/cosxl",
611
+ "endpoint": "/run_edit",
612
+ "inputs": [
613
+ {
614
+ "name": "image",
615
+ "description": "The image path to be edited",
616
+ "paramType": "required",
617
+ "type": "file",
618
+ "mimeTypes": 'image/*'
619
+ },
620
+ {
621
+ "name": "prompt",
622
+ "description": "The prompt with which to edit the image",
623
+ "paramType": "required",
624
+ "type": "str"
625
+ },
626
+ {
627
+ "name": "negative_prompt",
628
+ "paramType": "fixed",
629
+ "value": "",
630
+ "type": "str"
631
+ },
632
+ {
633
+ "name": "guidance_scale",
634
+ "paramType": "fixed",
635
+ "value": 6.5,
636
+ "type": "float"
637
+ },
638
+ {
639
+ "name": "steps",
640
+ "paramType": "fixed",
641
+ "value": 30,
642
+ "type": "float"
643
+ }
644
+ ],
645
+ "outputComponent": "image",
646
+ "showOutput": true,
647
+ "displayName": "Image Editor",
648
+ "color": "green",
649
+ "icon": "camera",
650
+ "description": "This tool lets you edit images",
651
+ "outputComponentIdx": 0
652
+ }
653
+ ]
654
+ HF_ORG_ADMIN: '644171cfbd0c97265298aa99'
655
+ HF_ORG_EARLY_ACCESS: '5e67bd5b1009063689407478'
656
+ HF_API_ROOT: 'https://internal.api-inference.huggingface.co/models'
657
+ infisical:
658
+ enabled: true
659
+ env: "prod-us-east-1"
660
+
661
+ autoscaling:
662
+ enabled: true
663
+ minReplicas: 12
664
+ maxReplicas: 30
665
+ targetMemoryUtilizationPercentage: "50"
666
+ targetCPUUtilizationPercentage: "50"
667
+
668
+ resources:
669
+ requests:
670
+ cpu: 2
671
+ memory: 4Gi
672
+ limits:
673
+ cpu: 4
674
+ memory: 8Gi
675
+
676
+ monitoring:
677
+ enabled: true
chart/templates/_helpers.tpl ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {{- define "name" -}}
2
+ {{- default $.Release.Name | trunc 63 | trimSuffix "-" -}}
3
+ {{- end -}}
4
+
5
+ {{- define "app.name" -}}
6
+ chat-ui
7
+ {{- end -}}
8
+
9
+ {{- define "labels.standard" -}}
10
+ release: {{ $.Release.Name | quote }}
11
+ heritage: {{ $.Release.Service | quote }}
12
+ chart: "{{ include "name" . }}"
13
+ app: "{{ include "app.name" . }}"
14
+ {{- end -}}
15
+
16
+ {{- define "labels.resolver" -}}
17
+ release: {{ $.Release.Name | quote }}
18
+ heritage: {{ $.Release.Service | quote }}
19
+ chart: "{{ include "name" . }}"
20
+ app: "{{ include "app.name" . }}-resolver"
21
+ {{- end -}}
22
+
chart/templates/config.yaml ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ apiVersion: v1
2
+ kind: ConfigMap
3
+ metadata:
4
+ labels: {{ include "labels.standard" . | nindent 4 }}
5
+ name: {{ include "name" . }}
6
+ namespace: {{ .Release.Namespace }}
7
+ data:
8
+ {{- range $key, $value := $.Values.envVars }}
9
+ {{ $key }}: {{ $value | quote }}
10
+ {{- end }}
chart/templates/deployment.yaml ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ apiVersion: apps/v1
2
+ kind: Deployment
3
+ metadata:
4
+ labels: {{ include "labels.standard" . | nindent 4 }}
5
+ name: {{ include "name" . }}
6
+ namespace: {{ .Release.Namespace }}
7
+ {{- if .Values.infisical.enabled }}
8
+ annotations:
9
+ secrets.infisical.com/auto-reload: "true"
10
+ {{- end }}
11
+ spec:
12
+ progressDeadlineSeconds: 600
13
+ {{- if not $.Values.autoscaling.enabled }}
14
+ replicas: {{ .Values.replicas }}
15
+ {{- end }}
16
+ revisionHistoryLimit: 10
17
+ selector:
18
+ matchLabels: {{ include "labels.standard" . | nindent 6 }}
19
+ strategy:
20
+ rollingUpdate:
21
+ maxSurge: 25%
22
+ maxUnavailable: 25%
23
+ type: RollingUpdate
24
+ template:
25
+ metadata:
26
+ labels: {{ include "labels.standard" . | nindent 8 }}
27
+ annotations:
28
+ checksum/config: {{ include (print $.Template.BasePath "/config.yaml") . | sha256sum }}
29
+ {{- if $.Values.envVars.NODE_LOG_STRUCTURED_DATA }}
30
+ co.elastic.logs/json.expand_keys: "true"
31
+ {{- end }}
32
+ spec:
33
+ {{- if .Values.serviceAccount.enabled }}
34
+ serviceAccountName: "{{ .Values.serviceAccount.name | default (include "name" .) }}"
35
+ {{- end }}
36
+ containers:
37
+ - name: chat-ui
38
+ image: "{{ .Values.image.repository }}/{{ .Values.image.name }}:{{ .Values.image.tag }}"
39
+ imagePullPolicy: {{ .Values.image.pullPolicy }}
40
+ readinessProbe:
41
+ failureThreshold: 30
42
+ periodSeconds: 10
43
+ httpGet:
44
+ path: {{ $.Values.envVars.APP_BASE | default "" }}/healthcheck
45
+ port: {{ $.Values.envVars.APP_PORT | default 3000 | int }}
46
+ livenessProbe:
47
+ failureThreshold: 30
48
+ periodSeconds: 10
49
+ httpGet:
50
+ path: {{ $.Values.envVars.APP_BASE | default "" }}/healthcheck
51
+ port: {{ $.Values.envVars.APP_PORT | default 3000 | int }}
52
+ ports:
53
+ - containerPort: {{ $.Values.envVars.APP_PORT | default 3000 | int }}
54
+ name: http
55
+ protocol: TCP
56
+ {{- if $.Values.monitoring.enabled }}
57
+ - containerPort: {{ $.Values.envVars.METRICS_PORT | default 5565 | int }}
58
+ name: metrics
59
+ protocol: TCP
60
+ {{- end }}
61
+ resources: {{ toYaml .Values.resources | nindent 12 }}
62
+ {{- with $.Values.extraEnv }}
63
+ env:
64
+ {{- toYaml . | nindent 14 }}
65
+ {{- end }}
66
+ envFrom:
67
+ - configMapRef:
68
+ name: {{ include "name" . }}
69
+ {{- if $.Values.infisical.enabled }}
70
+ - secretRef:
71
+ name: {{ include "name" $ }}-secs
72
+ {{- end }}
73
+ {{- with $.Values.extraEnvFrom }}
74
+ {{- toYaml . | nindent 14 }}
75
+ {{- end }}
76
+ nodeSelector: {{ toYaml .Values.nodeSelector | nindent 8 }}
77
+ tolerations: {{ toYaml .Values.tolerations | nindent 8 }}
78
+ volumes:
79
+ - name: config
80
+ configMap:
81
+ name: {{ include "name" . }}
chart/templates/hpa.yaml ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {{- if $.Values.autoscaling.enabled }}
2
+ apiVersion: autoscaling/v2
3
+ kind: HorizontalPodAutoscaler
4
+ metadata:
5
+ labels: {{ include "labels.standard" . | nindent 4 }}
6
+ name: {{ include "name" . }}
7
+ namespace: {{ .Release.Namespace }}
8
+ spec:
9
+ scaleTargetRef:
10
+ apiVersion: apps/v1
11
+ kind: Deployment
12
+ name: {{ include "name" . }}
13
+ minReplicas: {{ $.Values.autoscaling.minReplicas }}
14
+ maxReplicas: {{ $.Values.autoscaling.maxReplicas }}
15
+ metrics:
16
+ {{- if ne "" $.Values.autoscaling.targetMemoryUtilizationPercentage }}
17
+ - type: Resource
18
+ resource:
19
+ name: memory
20
+ target:
21
+ type: Utilization
22
+ averageUtilization: {{ $.Values.autoscaling.targetMemoryUtilizationPercentage | int }}
23
+ {{- end }}
24
+ {{- if ne "" $.Values.autoscaling.targetCPUUtilizationPercentage }}
25
+ - type: Resource
26
+ resource:
27
+ name: cpu
28
+ target:
29
+ type: Utilization
30
+ averageUtilization: {{ $.Values.autoscaling.targetCPUUtilizationPercentage | int }}
31
+ {{- end }}
32
+ behavior:
33
+ scaleDown:
34
+ stabilizationWindowSeconds: 600
35
+ policies:
36
+ - type: Percent
37
+ value: 10
38
+ periodSeconds: 60
39
+ scaleUp:
40
+ stabilizationWindowSeconds: 0
41
+ policies:
42
+ - type: Pods
43
+ value: 1
44
+ periodSeconds: 30
45
+ {{- end }}
chart/templates/infisical.yaml ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {{- if .Values.infisical.enabled }}
2
+ apiVersion: secrets.infisical.com/v1alpha1
3
+ kind: InfisicalSecret
4
+ metadata:
5
+ name: {{ include "name" $ }}-infisical-secret
6
+ namespace: {{ $.Release.Namespace }}
7
+ spec:
8
+ authentication:
9
+ universalAuth:
10
+ credentialsRef:
11
+ secretName: {{ .Values.infisical.operatorSecretName | quote }}
12
+ secretNamespace: {{ .Values.infisical.operatorSecretNamespace | quote }}
13
+ secretsScope:
14
+ envSlug: {{ .Values.infisical.env | quote }}
15
+ projectSlug: {{ .Values.infisical.project | quote }}
16
+ secretsPath: /
17
+ hostAPI: {{ .Values.infisical.url | quote }}
18
+ managedSecretReference:
19
+ creationPolicy: Owner
20
+ secretName: {{ include "name" $ }}-secs
21
+ secretNamespace: {{ .Release.Namespace | quote }}
22
+ secretType: Opaque
23
+ resyncInterval: {{ .Values.infisical.resyncInterval }}
24
+ {{- end }}
chart/templates/ingress.yaml ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {{- if $.Values.ingress.enabled }}
2
+ apiVersion: networking.k8s.io/v1
3
+ kind: Ingress
4
+ metadata:
5
+ annotations: {{ toYaml .Values.ingress.annotations | nindent 4 }}
6
+ labels: {{ include "labels.standard" . | nindent 4 }}
7
+ name: {{ include "name" . }}
8
+ namespace: {{ .Release.Namespace }}
9
+ spec:
10
+ {{ if $.Values.ingress.className }}
11
+ ingressClassName: {{ .Values.ingress.className }}
12
+ {{ end }}
13
+ {{- with .Values.ingress.tls }}
14
+ tls:
15
+ - hosts:
16
+ - {{ $.Values.domain | quote }}
17
+ {{- with .secretName }}
18
+ secretName: {{ . }}
19
+ {{- end }}
20
+ {{- end }}
21
+ rules:
22
+ - host: {{ .Values.domain }}
23
+ http:
24
+ paths:
25
+ - backend:
26
+ service:
27
+ name: {{ include "name" . }}
28
+ port:
29
+ name: http
30
+ path: {{ $.Values.ingress.path | default "/" }}
31
+ pathType: Prefix
32
+ {{- end }}
chart/templates/network-policy.yaml ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {{- if $.Values.networkPolicy.enabled }}
2
+ apiVersion: networking.k8s.io/v1
3
+ kind: NetworkPolicy
4
+ metadata:
5
+ name: {{ include "name" . }}
6
+ namespace: {{ .Release.Namespace }}
7
+ spec:
8
+ egress:
9
+ - ports:
10
+ - port: 53
11
+ protocol: UDP
12
+ to:
13
+ - namespaceSelector:
14
+ matchLabels:
15
+ kubernetes.io/metadata.name: kube-system
16
+ podSelector:
17
+ matchLabels:
18
+ k8s-app: kube-dns
19
+ - to:
20
+ {{- range $ip := .Values.networkPolicy.allowedBlocks }}
21
+ - ipBlock:
22
+ cidr: {{ $ip | quote }}
23
+ {{- end }}
24
+ - to:
25
+ - ipBlock:
26
+ cidr: 0.0.0.0/0
27
+ except:
28
+ - 10.0.0.0/8
29
+ - 172.16.0.0/12
30
+ - 192.168.0.0/16
31
+ - 169.254.169.254/32
32
+ podSelector:
33
+ matchLabels: {{ include "labels.standard" . | nindent 6 }}
34
+ policyTypes:
35
+ - Egress
36
+ {{- end }}
chart/templates/service-account.yaml ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {{- if and .Values.serviceAccount.enabled .Values.serviceAccount.create }}
2
+ apiVersion: v1
3
+ kind: ServiceAccount
4
+ automountServiceAccountToken: {{ .Values.serviceAccount.automountServiceAccountToken }}
5
+ metadata:
6
+ name: "{{ .Values.serviceAccount.name | default (include "name" .) }}"
7
+ namespace: {{ .Release.Namespace }}
8
+ labels: {{ include "labels.standard" . | nindent 4 }}
9
+ {{- with .Values.serviceAccount.annotations }}
10
+ annotations:
11
+ {{- toYaml . | nindent 4 }}
12
+ {{- end }}
13
+ {{- end }}
chart/templates/service-monitor.yaml ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {{- if $.Values.monitoring.enabled }}
2
+ apiVersion: monitoring.coreos.com/v1
3
+ kind: ServiceMonitor
4
+ metadata:
5
+ labels: {{ include "labels.standard" . | nindent 4 }}
6
+ name: {{ include "name" . }}
7
+ namespace: {{ .Release.Namespace }}
8
+ spec:
9
+ selector:
10
+ matchLabels: {{ include "labels.standard" . | nindent 6 }}
11
+ endpoints:
12
+ - port: metrics
13
+ path: /metrics
14
+ interval: 15s
15
+ {{- end }}
chart/templates/service.yaml ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ apiVersion: v1
2
+ kind: Service
3
+ metadata:
4
+ name: "{{ include "name" . }}"
5
+ annotations: {{ toYaml .Values.service.annotations | nindent 4 }}
6
+ namespace: {{ .Release.Namespace }}
7
+ labels: {{ include "labels.standard" . | nindent 4 }}
8
+ spec:
9
+ ports:
10
+ - name: http
11
+ port: 80
12
+ protocol: TCP
13
+ targetPort: http
14
+ {{- if $.Values.monitoring.enabled }}
15
+ - name: metrics
16
+ port: 5565
17
+ protocol: TCP
18
+ targetPort: metrics
19
+ {{- end }}
20
+ selector: {{ include "labels.standard" . | nindent 4 }}
21
+ type: {{.Values.service.type}}
chart/values.yaml ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ image:
2
+ repository: ghcr.io/huggingface
3
+ name: chat-ui
4
+ tag: 0.0.0-latest
5
+ pullPolicy: IfNotPresent
6
+
7
+ replicas: 3
8
+
9
+ domain: huggingface.co
10
+
11
+ networkPolicy:
12
+ enabled: false
13
+ allowedBlocks: []
14
+
15
+ service:
16
+ type: NodePort
17
+ annotations: { }
18
+
19
+ serviceAccount:
20
+ enabled: false
21
+ create: false
22
+ name: ""
23
+ automountServiceAccountToken: true
24
+ annotations: { }
25
+
26
+ ingress:
27
+ enabled: true
28
+ path: "/"
29
+ annotations: { }
30
+ # className: "nginx"
31
+ tls: { }
32
+ # secretName: XXX
33
+
34
+ resources:
35
+ requests:
36
+ cpu: 2
37
+ memory: 4Gi
38
+ limits:
39
+ cpu: 2
40
+ memory: 4Gi
41
+ nodeSelector: {}
42
+ tolerations: []
43
+
44
+ envVars: { }
45
+
46
+ infisical:
47
+ enabled: false
48
+ env: ""
49
+ project: "huggingchat-v2-a1"
50
+ url: ""
51
+ resyncInterval: 60
52
+ operatorSecretName: "huggingchat-operator-secrets"
53
+ operatorSecretNamespace: "hub-utils"
54
+
55
+ # Allow to environment injections on top or instead of infisical
56
+ extraEnvFrom: []
57
+ extraEnv: []
58
+
59
+ autoscaling:
60
+ enabled: false
61
+ minReplicas: 1
62
+ maxReplicas: 2
63
+ targetMemoryUtilizationPercentage: ""
64
+ targetCPUUtilizationPercentage: ""
65
+
66
+ monitoring:
67
+ enabled: false
docs/source/_toctree.yml ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ - local: index
2
+ title: 🤗 Chat UI
3
+ - title: Installation
4
+ sections:
5
+ - local: installation/local
6
+ title: Local
7
+ - local: installation/spaces
8
+ title: Spaces
9
+ - local: installation/docker
10
+ title: Docker
11
+ - local: installation/helm
12
+ title: Helm
13
+ - title: Configuration
14
+ sections:
15
+ - local: configuration/overview
16
+ title: Overview
17
+ - local: configuration/theming
18
+ title: Theming
19
+ - local: configuration/open-id
20
+ title: OpenID
21
+ - local: configuration/web-search
22
+ title: Web Search
23
+ - local: configuration/metrics
24
+ title: Metrics
25
+ - local: configuration/embeddings
26
+ title: Text Embedding Models
27
+ - title: Models
28
+ sections:
29
+ - local: configuration/models/overview
30
+ title: Overview
31
+ - local: configuration/models/multimodal
32
+ title: Multimodal
33
+ - local: configuration/models/tools
34
+ title: Tools
35
+ - title: Providers
36
+ sections:
37
+ - local: configuration/models/providers/anthropic
38
+ title: Anthropic
39
+ - local: configuration/models/providers/aws
40
+ title: AWS
41
+ - local: configuration/models/providers/cloudflare
42
+ title: Cloudflare
43
+ - local: configuration/models/providers/cohere
44
+ title: Cohere
45
+ - local: configuration/models/providers/google
46
+ title: Google
47
+ - local: configuration/models/providers/langserve
48
+ title: Langserve
49
+ - local: configuration/models/providers/llamacpp
50
+ title: Llama.cpp
51
+ - local: configuration/models/providers/ollama
52
+ title: Ollama
53
+ - local: configuration/models/providers/openai
54
+ title: OpenAI
55
+ - local: configuration/models/providers/tgi
56
+ title: TGI
57
+ - local: configuration/common-issues
58
+ title: Common Issues
59
+ - title: Developing
60
+ sections:
61
+ - local: developing/architecture
62
+ title: Architecture
63
+ - local: developing/copy-huggingchat
64
+ title: Copy HuggingChat
docs/source/configuration/common-issues.md ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ # Common Issues
2
+
3
+ ## 403:You don't have access to this conversation
4
+
5
+ Most likely you are running chat-ui over HTTP. The recommended option is to setup something like NGINX to handle HTTPS and proxy the requests to chat-ui. If you really need to run over HTTP you can add `ALLOW_INSECURE_COOKIES=true` to your `.env.local`.
6
+
7
+ Make sure to set your `PUBLIC_ORIGIN` in your `.env.local` to the correct URL as well.
docs/source/configuration/embeddings.md ADDED
@@ -0,0 +1,105 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Text Embedding Models
2
+
3
+ By default (for backward compatibility), when `TEXT_EMBEDDING_MODELS` environment variable is not defined, [transformers.js](https://huggingface.co/docs/transformers.js) embedding models will be used for embedding tasks, specifically, the [Xenova/gte-small](https://huggingface.co/Xenova/gte-small) model.
4
+
5
+ You can customize the embedding model by setting `TEXT_EMBEDDING_MODELS` in your `.env.local` file where the required fields are `name`, `chunkCharLength` and `endpoints`.
6
+
7
+ Supported text embedding backends are: [`transformers.js`](https://huggingface.co/docs/transformers.js), [`TEI`](https://github.com/huggingface/text-embeddings-inference) and [`OpenAI`](https://platform.openai.com/docs/guides/embeddings). `transformers.js` models run locally as part of `chat-ui`, whereas `TEI` models run in a different environment & accessed through an API endpoint. `openai` models are accessed through the [OpenAI API](https://platform.openai.com/docs/guides/embeddings).
8
+
9
+ When more than one embedding models are supplied in `.env.local` file, the first will be used by default, and the others will only be used on LLM's which configured `embeddingModel` to the name of the model.
10
+
11
+ ## Transformers.js
12
+
13
+ The Transformers.js backend uses local CPU for the embedding which can be quite slow. If possible, consider using TEI or OpenAI embeddings instead if you use web search frequently, as performance will improve significantly.
14
+
15
+ ```ini
16
+ TEXT_EMBEDDING_MODELS = `[
17
+ {
18
+ "name": "Xenova/gte-small",
19
+ "displayName": "Xenova/gte-small",
20
+ "description": "locally running embedding",
21
+ "chunkCharLength": 512,
22
+ "endpoints": [
23
+ { "type": "transformersjs" }
24
+ ]
25
+ }
26
+ ]`
27
+ ```
28
+
29
+ ## Text Embeddings Inference (TEI)
30
+
31
+ > Text Embeddings Inference (TEI) is a comprehensive toolkit designed for efficient deployment and serving of open source text embeddings models. It enables high-performance extraction for the most popular models, including FlagEmbedding, Ember, GTE, and E5.
32
+
33
+ Some recommended models at the time of writing (May 2024) are `Snowflake/snowflake-arctic-embed-m` and `BAAI/bge-large-en-v1.5`. You may run TEI locally with GPU support via Docker:
34
+
35
+ `docker run --gpus all -p 8080:80 -v tei-data:/data --name tei ghcr.io/huggingface/text-embeddings-inference:1.2 --model-id YOUR/HF_MODEL`
36
+
37
+ You can then hook this up to your Chat UI instance with the following configuration.
38
+
39
+ ```ini
40
+ TEXT_EMBEDDING_MODELS=`[
41
+ {
42
+ "name": "YOUR/HF_MODEL",
43
+ "displayName": "YOUR/HF_MODEL",
44
+ "preQuery": "Check the model documentation for the preQuery. Not all models have one",
45
+ "prePassage": "Check the model documentation for the prePassage. Not all models have one",
46
+ "chunkCharLength": 512,
47
+ "endpoints": [{
48
+ "type": "tei",
49
+ "url": "http://127.0.0.1:8080/"
50
+ }]
51
+ }
52
+ ]`
53
+ ```
54
+
55
+ Examples for `Snowflake/snowflake-arctic-embed-m` and `BAAI/bge-large-en-v1.5`:
56
+
57
+ ```ini
58
+ TEXT_EMBEDDING_MODELS=`[
59
+ {
60
+ "name": "Snowflake/snowflake-arctic-embed-m",
61
+ "displayName": "Snowflake/snowflake-arctic-embed-m",
62
+ "preQuery": "Represent this sentence for searching relevant passages: ",
63
+ "chunkCharLength": 512,
64
+ "endpoints": [{
65
+ "type": "tei",
66
+ "url": "http://127.0.0.1:8080/"
67
+ }]
68
+ },{
69
+ "name": "BAAI/bge-large-en-v1.5",
70
+ "displayName": "BAAI/bge-large-en-v1.5",
71
+ "chunkCharLength": 512,
72
+ "endpoints": [{
73
+ "type": "tei",
74
+ "url": "http://127.0.0.1:8080/"
75
+ }]
76
+ }
77
+ ]`
78
+ ```
79
+
80
+ ## OpenAI
81
+
82
+ It's also possible to host your own OpenAI API compatible embedding models. [`Infinity`](https://github.com/michaelfeil/infinity) is one example. You may run it locally with Docker:
83
+
84
+ `docker run -it --gpus all -v infinity-data:/app/.cache -p 7997:7997 michaelf34/infinity:latest v2 --model-id nomic-ai/nomic-embed-text-v1 --port 7997`
85
+
86
+ You can then hook this up to your Chat UI instance with the following configuration.
87
+
88
+ ```ini
89
+ TEXT_EMBEDDING_MODELS=`[
90
+ {
91
+ "name": "nomic-ai/nomic-embed-text-v1",
92
+ "displayName": "nomic-ai/nomic-embed-text-v1",
93
+ "chunkCharLength": 512,
94
+ "model": {
95
+ "name": "nomic-ai/nomic-embed-text-v1"
96
+ },
97
+ "endpoints": [
98
+ {
99
+ "type": "openai",
100
+ "url": "https://127.0.0.1:7997/embeddings"
101
+ }
102
+ ]
103
+ }
104
+ ]`
105
+ ```
docs/source/configuration/metrics.md ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ # Metrics
2
+
3
+ The server can expose prometheus metrics on port `5565` but is off by default. You may enable the metrics server with `METRICS_ENABLED=true` and change the port with `METRICS_PORT=1234`.
4
+
5
+ <Tip>
6
+
7
+ In development with `npm run dev`, the metrics server does not shutdown gracefully due to Sveltekit not providing hooks for restart. It's recommended to disable the metrics server in this case.
8
+
9
+ </Tip>
docs/source/configuration/models/multimodal.md ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Multimodal
2
+
3
+ We currently support [IDEFICS](https://huggingface.co/blog/idefics) (hosted on [TGI](./providers/tgi)), OpenAI and Anthropic Claude 3 as multimodal models. You can enable it by setting `multimodal: true` in your `MODELS` configuration. For IDEFICS, you must have a [PRO HF Api token](https://huggingface.co/settings/tokens). For OpenAI, see the [OpenAI section](./providers/openai). For Anthropic, see the [Anthropic section](./providers/anthropic).
4
+
5
+ ```ini
6
+ MODELS=`[
7
+ {
8
+ "name": "HuggingFaceM4/idefics-80b-instruct",
9
+ "multimodal" : true,
10
+ "description": "IDEFICS is the new multimodal model by Hugging Face.",
11
+ "preprompt": "",
12
+ "chatPromptTemplate" : "{{#each messages}}{{#ifUser}}User: {{content}}{{/ifUser}}<end_of_utterance>\nAssistant: {{#ifAssistant}}{{content}}\n{{/ifAssistant}}{{/each}}",
13
+ "parameters": {
14
+ "temperature": 0.1,
15
+ "top_p": 0.95,
16
+ "repetition_penalty": 1.2,
17
+ "top_k": 12,
18
+ "truncate": 1000,
19
+ "max_new_tokens": 1024,
20
+ "stop": ["<end_of_utterance>", "User:", "\nUser:"]
21
+ }
22
+ }
23
+ ]`
24
+ ```
docs/source/configuration/models/overview.md ADDED
@@ -0,0 +1,147 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Models Overview
2
+
3
+ You can customize the parameters passed to the model or even use a new model by updating the `MODELS` variable in your `.env.local`. The default one can be found in `.env` and looks like this :
4
+
5
+ ```ini
6
+ MODELS=`[
7
+ {
8
+ "name": "mistralai/Mistral-7B-Instruct-v0.2",
9
+ "displayName": "mistralai/Mistral-7B-Instruct-v0.2",
10
+ "description": "Mistral 7B is a new Apache 2.0 model, released by Mistral AI that outperforms Llama2 13B in benchmarks.",
11
+ "websiteUrl": "https://mistral.ai/news/announcing-mistral-7b/",
12
+ "preprompt": "",
13
+ "chatPromptTemplate" : "<s>{{#each messages}}{{#ifUser}}[INST] {{#if @first}}{{#if @root.preprompt}}{{@root.preprompt}}\n{{/if}}{{/if}}{{content}} [/INST]{{/ifUser}}{{#ifAssistant}}{{content}}</s>{{/ifAssistant}}{{/each}}",
14
+ "parameters": {
15
+ "temperature": 0.3,
16
+ "top_p": 0.95,
17
+ "repetition_penalty": 1.2,
18
+ "top_k": 50,
19
+ "truncate": 3072,
20
+ "max_new_tokens": 1024,
21
+ "stop": ["</s>"]
22
+ },
23
+ "promptExamples": [
24
+ {
25
+ "title": "Write an email from bullet list",
26
+ "prompt": "As a restaurant owner, write a professional email to the supplier to get these products every week: \n\n- Wine (x10)\n- Eggs (x24)\n- Bread (x12)"
27
+ }, {
28
+ "title": "Code a snake game",
29
+ "prompt": "Code a basic snake game in python, give explanations for each step."
30
+ }, {
31
+ "title": "Assist in a task",
32
+ "prompt": "How do I make a delicious lemon cheesecake?"
33
+ }
34
+ ]
35
+ }
36
+ ]`
37
+
38
+ ```
39
+
40
+ You can change things like the parameters, or customize the preprompt to better suit your needs. You can also add more models by adding more objects to the array, with different preprompts for example.
41
+
42
+ ## Chat Prompt Template
43
+
44
+ When querying the model for a chat response, the `chatPromptTemplate` template is used. `messages` is an array of chat messages, it has the format `[{ content: string }, ...]`. To identify if a message is a user message or an assistant message the `ifUser` and `ifAssistant` block helpers can be used.
45
+
46
+ The following is the default `chatPromptTemplate`, although newlines and indentiation have been added for readability. You can find the prompts used in production for HuggingChat [here](https://github.com/huggingface/chat-ui/blob/main/PROMPTS.md). The templating language used is [Handlebars](https://www.npmjs.com/package/handlebars).
47
+
48
+ ```handlebars
49
+ {{preprompt}}
50
+ {{#each messages}}
51
+ {{#ifUser}}{{@root.userMessageToken}}{{content}}{{@root.userMessageEndToken}}{{/ifUser}}
52
+ {{#ifAssistant
53
+ }}{{@root.assistantMessageToken}}{{content}}{{@root.assistantMessageEndToken}}{{/ifAssistant}}
54
+ {{/each}}
55
+ {{assistantMessageToken}}
56
+ ```
57
+
58
+ ## Custom endpoint authorization
59
+
60
+ ### Basic and Bearer
61
+
62
+ Custom endpoints may require authorization, depending on how you configure them. Authentication will usually be set either with `Basic` or `Bearer`.
63
+
64
+ For `Basic` we will need to generate a base64 encoding of the username and password.
65
+
66
+ `echo -n "USER:PASS" | base64`
67
+
68
+ > VVNFUjpQQVNT
69
+
70
+ For `Bearer` you can use a token, which can be grabbed from [here](https://huggingface.co/settings/tokens).
71
+
72
+ You can then add the generated information and the `authorization` parameter to your `.env.local`.
73
+
74
+ ```ini
75
+ "endpoints": [
76
+ {
77
+ "url": "https://HOST:PORT",
78
+ "authorization": "Basic VVNFUjpQQVNT",
79
+ }
80
+ ]
81
+ ```
82
+
83
+ Please note that if `HF_TOKEN` is also set or not empty, it will take precedence.
84
+
85
+ ## Models hosted on multiple custom endpoints
86
+
87
+ If the model being hosted will be available on multiple servers/instances add the `weight` parameter to your `.env.local`. The `weight` will be used to determine the probability of requesting a particular endpoint.
88
+
89
+ ```ini
90
+ "endpoints": [
91
+ {
92
+ "url": "https://HOST:PORT",
93
+ "weight": 1
94
+ },
95
+ {
96
+ "url": "https://HOST:PORT",
97
+ "weight": 2
98
+ }
99
+ ...
100
+ ]
101
+ ```
102
+
103
+ ## Client Certificate Authentication (mTLS)
104
+
105
+ Custom endpoints may require client certificate authentication, depending on how you configure them. To enable mTLS between Chat UI and your custom endpoint, you will need to set the `USE_CLIENT_CERTIFICATE` to `true`, and add the `CERT_PATH` and `KEY_PATH` parameters to your `.env.local`. These parameters should point to the location of the certificate and key files on your local machine. The certificate and key files should be in PEM format. The key file can be encrypted with a passphrase, in which case you will also need to add the `CLIENT_KEY_PASSWORD` parameter to your `.env.local`.
106
+
107
+ If you're using a certificate signed by a private CA, you will also need to add the `CA_PATH` parameter to your `.env.local`. This parameter should point to the location of the CA certificate file on your local machine.
108
+
109
+ If you're using a self-signed certificate, e.g. for testing or development purposes, you can set the `REJECT_UNAUTHORIZED` parameter to `false` in your `.env.local`. This will disable certificate validation, and allow Chat UI to connect to your custom endpoint.
110
+
111
+ ## Specific Embedding Model
112
+
113
+ A model can use any of the embedding models defined under `TEXT_EMBEDDING_MODELS`, (currently used when web searching). By default it will use the first embedding model, but it can be changed with the field `embeddingModel`:
114
+
115
+ ```ini
116
+ TEXT_EMBEDDING_MODELS = `[
117
+ {
118
+ "name": "Xenova/gte-small",
119
+ "chunkCharLength": 512,
120
+ "endpoints": [
121
+ {"type": "transformersjs"}
122
+ ]
123
+ },
124
+ {
125
+ "name": "intfloat/e5-base-v2",
126
+ "chunkCharLength": 768,
127
+ "endpoints": [
128
+ {"type": "tei", "url": "http://127.0.0.1:8080/", "authorization": "Basic VVNFUjpQQVNT"},
129
+ {"type": "tei", "url": "http://127.0.0.1:8081/"}
130
+ ]
131
+ }
132
+ ]`
133
+
134
+ MODELS=`[
135
+ {
136
+ "name": "Ollama Mistral",
137
+ "chatPromptTemplate": "...",
138
+ "embeddingModel": "intfloat/e5-base-v2"
139
+ "parameters": {
140
+ ...
141
+ },
142
+ "endpoints": [
143
+ ...
144
+ ]
145
+ }
146
+ ]`
147
+ ```
docs/source/configuration/models/providers/anthropic.md ADDED
@@ -0,0 +1,117 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Anthropic
2
+
3
+ | Feature | Available |
4
+ | --------------------------- | --------- |
5
+ | [Tools](../tools) | No |
6
+ | [Multimodal](../multimodal) | Yes |
7
+
8
+ We also support Anthropic models (including multimodal ones via `multmodal: true`) through the official SDK. You may provide your API key via the `ANTHROPIC_API_KEY` env variable, or alternatively, through the `endpoints.apiKey` as per the following example.
9
+
10
+ ```ini
11
+ MODELS=`[
12
+ {
13
+ "name": "claude-3-haiku-20240307",
14
+ "displayName": "Claude 3 Haiku",
15
+ "description": "Fastest and most compact model for near-instant responsiveness",
16
+ "multimodal": true,
17
+ "parameters": {
18
+ "max_new_tokens": 4096,
19
+ },
20
+ "endpoints": [
21
+ {
22
+ "type": "anthropic",
23
+ // optionals
24
+ "apiKey": "sk-ant-...",
25
+ "baseURL": "https://api.anthropic.com",
26
+ "defaultHeaders": {},
27
+ "defaultQuery": {}
28
+ }
29
+ ]
30
+ },
31
+ {
32
+ "name": "claude-3-sonnet-20240229",
33
+ "displayName": "Claude 3 Sonnet",
34
+ "description": "Ideal balance of intelligence and speed",
35
+ "multimodal": true,
36
+ "parameters": {
37
+ "max_new_tokens": 4096,
38
+ },
39
+ "endpoints": [
40
+ {
41
+ "type": "anthropic",
42
+ // optionals
43
+ "apiKey": "sk-ant-...",
44
+ "baseURL": "https://api.anthropic.com",
45
+ "defaultHeaders": {},
46
+ "defaultQuery": {}
47
+ }
48
+ ]
49
+ },
50
+ {
51
+ "name": "claude-3-opus-20240229",
52
+ "displayName": "Claude 3 Opus",
53
+ "description": "Most powerful model for highly complex tasks",
54
+ "multimodal": true,
55
+ "parameters": {
56
+ "max_new_tokens": 4096
57
+ },
58
+ "endpoints": [
59
+ {
60
+ "type": "anthropic",
61
+ // optionals
62
+ "apiKey": "sk-ant-...",
63
+ "baseURL": "https://api.anthropic.com",
64
+ "defaultHeaders": {},
65
+ "defaultQuery": {}
66
+ }
67
+ ]
68
+ }
69
+ ]`
70
+ ```
71
+
72
+ ## VertexAI
73
+
74
+ We also support using Anthropic models running on Vertex AI. Authentication is done using Google Application Default Credentials. Project ID can be provided through the `endpoints.projectId` as per the following example:
75
+
76
+ ```ini
77
+ MODELS=`[
78
+ {
79
+ "name": "claude-3-haiku@20240307",
80
+ "displayName": "Claude 3 Haiku",
81
+ "description": "Fastest, most compact model for near-instant responsiveness",
82
+ "multimodal": true,
83
+ "parameters": {
84
+ "max_new_tokens": 4096
85
+ },
86
+ "endpoints": [
87
+ {
88
+ "type": "anthropic-vertex",
89
+ "region": "us-central1",
90
+ "projectId": "gcp-project-id",
91
+ // optionals
92
+ "defaultHeaders": {},
93
+ "defaultQuery": {}
94
+ }
95
+ ]
96
+ },
97
+ {
98
+ "name": "claude-3-sonnet@20240229",
99
+ "displayName": "Claude 3 Sonnet",
100
+ "description": "Ideal balance of intelligence and speed",
101
+ "multimodal": true,
102
+ "parameters": {
103
+ "max_new_tokens": 4096,
104
+ },
105
+ "endpoints": [
106
+ {
107
+ "type": "anthropic-vertex",
108
+ "region": "us-central1",
109
+ "projectId": "gcp-project-id",
110
+ // optionals
111
+ "defaultHeaders": {},
112
+ "defaultQuery": {}
113
+ }
114
+ ]
115
+ },
116
+ ]`
117
+ ```
docs/source/configuration/models/providers/aws.md ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Amazon Web Services (AWS)
2
+
3
+ | Feature | Available |
4
+ | --------------------------- | --------- |
5
+ | [Tools](../tools) | No |
6
+ | [Multimodal](../multimodal) | No |
7
+
8
+ You may specify your Amazon SageMaker instance as an endpoint for Chat UI:
9
+
10
+ ```ini
11
+ MODELS=`[{
12
+ "name": "your-model",
13
+ "displayName": "Your Model",
14
+ "description": "Your description",
15
+ "parameters": {
16
+ "max_new_tokens": 4096
17
+ },
18
+ "endpoints": [
19
+ {
20
+ "type" : "aws",
21
+ "service" : "sagemaker"
22
+ "url": "",
23
+ "accessKey": "",
24
+ "secretKey" : "",
25
+ "sessionToken": "",
26
+ "region": "",
27
+ "weight": 1
28
+ }
29
+ ]
30
+ }]`
31
+ ```
32
+
33
+ You can also set `"service": "lambda"` to use a lambda instance.
34
+
35
+ You can get the `accessKey` and `secretKey` from your AWS user, under programmatic access.