Skip to content

Commit

Permalink
Merge branch 'main' into add-android-manifest
Browse files Browse the repository at this point in the history
  • Loading branch information
nsarrazin authored Jul 31, 2024
2 parents 1c8b2cb + 05b181d commit 0cf63a6
Show file tree
Hide file tree
Showing 43 changed files with 1,470 additions and 412 deletions.
3 changes: 3 additions & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -164,3 +164,6 @@ METRICS_ENABLED=false
METRICS_PORT=5565
LOG_LEVEL=info
BODY_SIZE_LIMIT=15728640

HF_ORG_ADMIN=
HF_ORG_EARLY_ACCESS=
16 changes: 5 additions & 11 deletions .github/workflows/deploy-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,31 +10,25 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Tailscale
uses: huggingface/tailscale-action@main
- name: Login to Registry
uses: docker/login-action@v3
with:
authkey: ${{ secrets.TAILSCALE_AUTHKEY }}
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}

- name: Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: |
registry.internal.huggingface.tech/chat-ui/chat-ui
huggingface/chat-ui
tags: |
type=raw,value=latest,enable={{is_default_branch}}
type=sha,enable={{is_default_branch}}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to Registry
uses: docker/login-action@v2
with:
registry: registry.internal.huggingface.tech
username: ${{ secrets.DOCKER_INTERNAL_USERNAME }}
password: ${{ secrets.DOCKER_INTERNAL_PASSWORD }}

- name: Build and Publish HuggingChat image
uses: docker/build-push-action@v5
with:
Expand Down
4 changes: 4 additions & 0 deletions .husky/lint-stage-config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export default {
"*.{js,jsx,ts,tsx}": ["prettier --write", "eslint --fix", "eslint"],
"*.json": ["prettier --write"],
};
2 changes: 2 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
set -e
npx lint-staged --config ./.husky/lint-stage-config.js
12 changes: 6 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
ARG INCLUDE_DB=false

# stage that install the dependencies
FROM node:20 as builder-production
FROM node:20 AS builder-production

WORKDIR /app

Expand All @@ -13,7 +13,7 @@ RUN --mount=type=cache,target=/app/.npm \
npm set cache /app/.npm && \
npm ci --omit=dev

FROM builder-production as builder
FROM builder-production AS builder

ARG APP_BASE=
ARG PUBLIC_APP_COLOR=blue
Expand All @@ -28,13 +28,13 @@ COPY --link --chown=1000 . .
RUN npm run build

# mongo image
FROM mongo:latest as mongo
FROM mongo:latest AS mongo

# image to be used if INCLUDE_DB is false
FROM node:20-slim as local_db_false
FROM node:20-slim AS local_db_false

# image to be used if INCLUDE_DB is true
FROM node:20-slim as local_db_true
FROM node:20-slim AS local_db_true

RUN apt-get update
RUN apt-get install gnupg curl -y
Expand All @@ -46,7 +46,7 @@ RUN mkdir -p /data/db
RUN chown -R 1000:1000 /data/db

# final image
FROM local_db_${INCLUDE_DB} as final
FROM local_db_${INCLUDE_DB} AS final

# build arg to determine if the database should be included
ARG INCLUDE_DB=false
Expand Down
135 changes: 86 additions & 49 deletions chart/env/prod.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
image:
repository: registry.internal.huggingface.tech/chat-ui
repository: huggingface
name: chat-ui

nodeSelector:
Expand Down Expand Up @@ -38,10 +38,70 @@ envVars:
METRICS_ENABLED: "true"
MODELS: >
[
{
"name" : "meta-llama/Meta-Llama-3.1-70B-Instruct",
"id": "meta-llama/Meta-Llama-3.1-70B-Instruct",
"tokenizer": {"tokenizerUrl": "https://huggingface.co/nsarrazin/llama3.1-tokenizer/resolve/main/tokenizer.json", "tokenizerConfigUrl": "https://huggingface.co/nsarrazin/llama3.1-tokenizer/raw/main/tokenizer_config.json"},
"description": "Ideal for everyday use. A fast and extremely capable model matching closed source models' capabilities.",
"modelUrl": "https://huggingface.co/meta-llama/Meta-Llama-3.1-70B-Instruct",
"websiteUrl": "https://llama.meta.com/",
"logoUrl": "https://huggingface.co/datasets/huggingchat/models-logo/resolve/main/meta-logo.png",
"tools": true,
"preprompt" : "",
"parameters": {
"temperature": 0.6,
"top_p": 0.9,
"stop": ["<|endoftext|>", "<|eot_id|>"],
"max_new_tokens": 1024,
"truncate": 7167
},
"promptExamples": [
{
"title": "Write an email from bullet list",
"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)"
}, {
"title": "Code a snake game",
"prompt": "Code a basic snake game in python, give explanations for each step."
}, {
"title": "Assist in a task",
"prompt": "How do I make a delicious lemon cheesecake?"
}
]
},
{
"name" : "meta-llama/Meta-Llama-3.1-405B-Instruct-FP8",
"id": "meta-llama/Meta-Llama-3.1-405B-Instruct-FP8",
"tokenizer": {"tokenizerUrl": "https://huggingface.co/nsarrazin/llama3.1-tokenizer/resolve/main/tokenizer.json", "tokenizerConfigUrl": "https://huggingface.co/nsarrazin/llama3.1-tokenizer/raw/main/tokenizer_config.json"},
"description": "The most intelligent open-source model, showing exceptional capabilities for complex tasks.",
"modelUrl": "https://huggingface.co/meta-llama/Meta-Llama-3.1-405B-Instruct-FP8",
"websiteUrl": "https://llama.meta.com/",
"logoUrl": "https://huggingface.co/datasets/huggingchat/models-logo/resolve/main/meta-logo.png",
"tools": true,
"preprompt" : "",
"parameters": {
"temperature": 0.6,
"top_p": 0.9,
"stop": ["<|endoftext|>", "<|eot_id|>"],
"max_new_tokens": 2048,
"truncate": 14337
},
"promptExamples": [
{
"title": "Write an email from bullet list",
"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)"
}, {
"title": "Code a snake game",
"prompt": "Code a basic snake game in python, give explanations for each step."
}, {
"title": "Assist in a task",
"prompt": "How do I make a delicious lemon cheesecake?"
}
]
},
{
"name" : "CohereForAI/c4ai-command-r-plus",
"tokenizer": "nsarrazin/c4ai-command-r-v01-tokenizer",
"description": "Command R+ is Cohere's latest LLM and is the first open weight model to beat GPT4 in the Chatbot Arena!",
"tokenizer": {"tokenizerUrl": "https://huggingface.co/nsarrazin/c4ai-command-r-v01-tokenizer/resolve/main/tokenizer.json", "tokenizerConfigUrl": "https://huggingface.co/nsarrazin/c4ai-command-r-v01-tokenizer/raw/main/tokenizer_config.json"},
"description": "Cohere's largest language model, optimized for conversational interaction and tool use.",
"modelUrl": "https://huggingface.co/CohereForAI/c4ai-command-r-plus",
"websiteUrl": "https://docs.cohere.com/docs/command-r-plus",
"logoUrl": "https://huggingface.co/datasets/huggingchat/models-logo/resolve/main/cohere-logo.png",
Expand All @@ -65,36 +125,9 @@ envVars:
}
]
},
{
"name" : "meta-llama/Meta-Llama-3-70B-Instruct",
"description": "Meta Llama 3 delivers top performance on various benchmarks and introduces new features like better reasoning.",
"logoUrl": "https://huggingface.co/datasets/huggingchat/models-logo/resolve/main/meta-logo.png",
"modelUrl": "https://huggingface.co/meta-llama/Meta-Llama-3-70B-Instruct",
"websiteUrl": "https://llama.meta.com/llama3/",
"tokenizer" : "philschmid/meta-llama-3-tokenizer",
"promptExamples" : [
{
"title": "Write an email from bullet list",
"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)"
}, {
"title": "Code a snake game",
"prompt": "Code a basic snake game in python, give explanations for each step."
}, {
"title": "Assist in a task",
"prompt": "How do I make a delicious lemon cheesecake?"
}
],
"parameters": {
"stop": ["<|eot_id|>"],
"truncate": 6144,
"max_new_tokens": 2047,
"temperature": 0.6,
"top_p" : 0.9
}
},
{
"name" : "mistralai/Mixtral-8x7B-Instruct-v0.1",
"description" : "The latest MoE model from Mistral AI! 8x7B and outperforms Llama 2 70B in most benchmarks.",
"description" : "A high-quality sparse mixture of experts model with open weights.",
"logoUrl": "https://huggingface.co/datasets/huggingchat/models-logo/resolve/main/mistral-logo.png",
"websiteUrl" : "https://mistral.ai/news/mixtral-of-experts/",
"modelUrl": "https://huggingface.co/mistralai/Mixtral-8x7B-Instruct-v0.1",
Expand Down Expand Up @@ -125,7 +158,7 @@ envVars:
},
{
"name" : "NousResearch/Nous-Hermes-2-Mixtral-8x7B-DPO",
"description" : "Nous Hermes 2 Mixtral 8x7B DPO is the new flagship Nous Research model trained over the Mixtral 8x7B MoE LLM.",
"description" : "Nous Hermes' strong flagship model trained on the Mixtral 8x7B.",
"logoUrl": "https://huggingface.co/datasets/huggingchat/models-logo/resolve/main/nous-logo.png",
"websiteUrl" : "https://nousresearch.com/",
"modelUrl": "https://huggingface.co/NousResearch/Nous-Hermes-2-Mixtral-8x7B-DPO",
Expand Down Expand Up @@ -156,7 +189,7 @@ envVars:
{
"name": "01-ai/Yi-1.5-34B-Chat",
"tokenizer": "01-ai/Yi-1.5-34B-Chat",
"description" : "Yi-1.5 is an upgraded version of Yi. It is continuously pre-trained on Yi with a high-quality corpus of 500B tokens and fine-tuned on 3M diverse fine-tuning samples.",
"description" : "Strong performance in reasoning while maintaining excellent capabilities in language understanding.",
"logoUrl": "https://huggingface.co/datasets/huggingchat/models-logo/resolve/main/01-ai-logo.png",
"modelUrl": "https://huggingface.co/01-ai/Yi-1.5-34B-Chat",
"websiteUrl": "https://www.01.ai",
Expand All @@ -182,13 +215,13 @@ envVars:
]
},
{
"name": "mistralai/Mistral-7B-Instruct-v0.2",
"displayName": "mistralai/Mistral-7B-Instruct-v0.2",
"description": "Mistral 7B is a new Apache 2.0 model, released by Mistral AI that outperforms Llama2 13B in benchmarks.",
"name": "mistralai/Mistral-7B-Instruct-v0.3",
"displayName": "mistralai/Mistral-7B-Instruct-v0.3",
"description": "A small model with good capabilities in language understanding and commonsense reasoning.",
"logoUrl": "https://huggingface.co/datasets/huggingchat/models-logo/resolve/main/mistral-logo.png",
"websiteUrl": "https://mistral.ai/news/announcing-mistral-7b/",
"modelUrl": "https://huggingface.co/mistralai/Mistral-7B-Instruct-v0.2",
"tokenizer": "mistralai/Mistral-7B-Instruct-v0.2",
"modelUrl": "https://huggingface.co/mistralai/Mistral-7B-Instruct-v0.3",
"tokenizer": "mistralai/Mistral-7B-Instruct-v0.3",
"preprompt": "",
"chatPromptTemplate" : "<s>{{#each messages}}{{#ifUser}}[INST] {{#if @first}}{{#if @root.preprompt}}{{@root.preprompt}}\n{{/if}}{{/if}}{{content}} [/INST]{{/ifUser}}{{#ifAssistant}}{{content}}</s>{{/ifAssistant}}{{/each}}",
"parameters": {
Expand Down Expand Up @@ -216,7 +249,7 @@ envVars:
{
"name": "microsoft/Phi-3-mini-4k-instruct",
"tokenizer": "microsoft/Phi-3-mini-4k-instruct",
"description" : "Phi-3 Mini-4K-Instruct is a 3.8B parameters, lightweight, state-of-the-art open model built upon datasets used for Phi-2.",
"description" : "One of the best small models (3.8B parameters), super fast for simple tasks.",
"logoUrl": "https://huggingface.co/datasets/huggingchat/models-logo/resolve/main/microsoft-logo.png",
"modelUrl": "https://huggingface.co/microsoft/Phi-3-mini-4k-instruct",
"websiteUrl": "https://azure.microsoft.com/en-us/blog/introducing-phi-3-redefining-whats-possible-with-slms/",
Expand All @@ -242,11 +275,12 @@ envVars:
]
},
{
"name": "meta-llama/Meta-Llama-3-8B-Instruct",
"tokenizer" : "philschmid/meta-llama-3-tokenizer",
"name" : "llhf/Meta-Llama-3.1-8B-Instruct",
"tokenizer": {"tokenizerUrl": "https://huggingface.co/nsarrazin/llama3.1-tokenizer/resolve/main/tokenizer.json", "tokenizerConfigUrl": "https://huggingface.co/nsarrazin/llama3.1-tokenizer/raw/main/tokenizer_config.json"},
"parameters": {
"temperature": 0.1,
"stop": ["<|eot_id|>"],
"temperature": 0.6,
"top_p": 0.9,
"stop": ["<|endoftext|>", "<|eot_id|>"],
},
"unlisted": true
}
Expand All @@ -265,7 +299,8 @@ envVars:
{ "name": "google/gemma-7b-it" },
{ "name": "meta-llama/Llama-2-70b-chat-hf" },
{ "name": "codellama/CodeLlama-70b-Instruct-hf" },
{ "name": "openchat/openchat-3.5-0106" }
{ "name": "openchat/openchat-3.5-0106" },
{ "name": "meta-llama/Meta-Llama-3-70B-Instruct"}
]
PUBLIC_ORIGIN: "https://huggingface.co"
PUBLIC_SHARE_PREFIX: "https://hf.co/chat"
Expand All @@ -280,35 +315,37 @@ envVars:
PUBLIC_PLAUSIBLE_SCRIPT_URL: "/js/script.js"
PUBLIC_APPLE_APP_ID: "6476778843"
REQUIRE_FEATURED_ASSISTANTS: "true"
TASK_MODEL: "meta-llama/Meta-Llama-3-8B-Instruct"
TASK_MODEL: "llhf/Meta-Llama-3.1-8B-Instruct"
TEXT_EMBEDDING_MODELS: >
[{
"name": "bge-base-en-v1-5-sxa",
"displayName": "bge-base-en-v1-5-sxa",
"chunkCharLength": 512,
"endpoints": [{
"endpoints": [{
"type": "tei",
"url": "https://huggingchat-tei.hf.space/"
}]
}]
WEBSEARCH_BLOCKLIST: '["youtube.com", "twitter.com"]'
XFF_DEPTH: '2'
HF_ORG_ADMIN: '644171cfbd0c97265298aa99'
HF_ORG_EARLY_ACCESS: '5e67bd5b1009063689407478'

infisical:
enabled: true
env: "prod-us-east-1"

autoscaling:
enabled: true
minReplicas: 6
minReplicas: 12
maxReplicas: 30
targetMemoryUtilizationPercentage: "50"
targetCPUUtilizationPercentage: "50"

resources:
requests:
cpu: 4
memory: 8Gi
cpu: 2
memory: 4Gi
limits:
cpu: 4
memory: 8Gi
Expand Down
36 changes: 36 additions & 0 deletions docs/source/configuration/models/providers/google.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,42 @@ MODELS=`[
}
}]
}]
}
]`
```

## GenAI

Or use the Gemini API API provider [from](https://github.com/google-gemini/generative-ai-js#readme):

> Make sure that you have an API key from Google Cloud Platform. To get an API key, follow the instructions [here](https://cloud.google.com/docs/authentication/api-keys).
```ini
MODELS=`[
{
"name": "gemini-1.5-flash",
"displayName": "Gemini Flash 1.5",
"multimodal": true,
"endpoints": [
{
"type": "genai",
"apiKey": "abc...xyz"
}
]

// Optional
"safetyThreshold": "BLOCK_MEDIUM_AND_ABOVE",
},
{
"name": "gemini-1.5-pro",
"displayName": "Gemini Pro 1.5",
"multimodal": false,
"endpoints": [
{
"type": "genai",
"apiKey": "abc...xyz"
}
]
}
]`
```
Loading

0 comments on commit 0cf63a6

Please sign in to comment.