Skip to content

Commit 9227230

Browse files
Saghenmishig25
andauthored
Hosted Documentation (#1155)
* docs: switch to dedicated docs * ci: docs PR preview * feat: move docs to docs/source and format * docs: switch to using <Tip> * docs: misc * ci: build documentation for prod workflow * docs: simplify readme * style: format markdown * docs: minor clarifications * push main as well * DD UPLOAD ACTION * test trigger * format * update doc trigger paths * follow transformers release branch naming --------- Co-authored-by: Mishig Davaadorj <dmishig@gmail.com>
1 parent d0f7c72 commit 9227230

31 files changed

+1308
-13
lines changed

.github/workflows/build-docs.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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-pr-docs.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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 }}

README.md

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,15 @@ load_balancing_strategy: random
1616

1717
![Chat UI repository thumbnail](https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/chatui-websearch.png)
1818

19-
A chat interface using open source models, eg OpenAssistant or Llama. It is a SvelteKit app and it powers the [HuggingChat app on hf.co/chat](https://huggingface.co/chat).
19+
Open source chat interface with support for tools, web search, multimodal and many API providers. The app uses MongoDB and SvelteKit behind the scenes. Try the live version of the app called [HuggingChat on hf.co/chat](https://huggingface.co/chat) or [setup your own instance](https://huggingface.co/docs/chat-ui/installation/spaces).
2020

21-
0. [No Setup Deploy](#no-setup-deploy)
22-
1. [Setup](#setup)
23-
2. [Launch](#launch)
24-
3. [Web Search](#web-search)
25-
4. [Text Embedding Models](#text-embedding-models)
26-
5. [Extra parameters](#extra-parameters)
27-
6. [Common issues](#common-issues)
28-
7. [Deploying to a HF Space](#deploying-to-a-hf-space)
29-
8. [Building](#building)
21+
🔧 **Tools**: Function calling with custom tools and support for [Zero GPU spaces](https://huggingface.co/spaces/enzostvs/zero-gpu-spaces)
3022

31-
## No Setup Deploy
23+
🔍 **Web Search**: Automated web search, scraping and RAG for all models
3224

33-
If you don't want to configure, setup, and launch your own Chat UI yourself, you can use this option as a fast deploy alternative.
25+
🐙 **Multimodal**: Accepts image file uploads on supported providers
3426

35-
You can deploy your own customized Chat UI instance with any supported [LLM](https://huggingface.co/models?pipeline_tag=text-generation&sort=trending) of your choice on [Hugging Face Spaces](https://huggingface.co/spaces). To do so, use the chat-ui template [available here](https://huggingface.co/new-space?template=huggingchat/chat-ui-template).
27+
👤 **OpenID**: Optionally setup OpenID for user authentication
3628

3729
Set `HF_TOKEN` in [Space secrets](https://huggingface.co/docs/hub/spaces-overview#managing-secrets-and-environment-variables) to deploy a model with gated access or a model in a private repository. It's also compatible with [Inference for PROs](https://huggingface.co/blog/inference-pro) curated list of powerful models with higher rate limits. Make sure to create your personal token first in your [User Access Tokens settings](https://huggingface.co/settings/tokens).
3830

docs/source/_toctree.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
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/embeddings
24+
title: Text Embedding Models
25+
- title: Models
26+
sections:
27+
- local: configuration/models/overview
28+
title: Overview
29+
- local: configuration/models/multimodal
30+
title: Multimodal
31+
- local: configuration/models/tools
32+
title: Tools
33+
- title: Providers
34+
sections:
35+
- local: configuration/models/providers/anthropic
36+
title: Anthropic
37+
- local: configuration/models/providers/aws
38+
title: AWS
39+
- local: configuration/models/providers/cloudflare
40+
title: Cloudflare
41+
- local: configuration/models/providers/cohere
42+
title: Cohere
43+
- local: configuration/models/providers/google
44+
title: Google
45+
- local: configuration/models/providers/langserve
46+
title: Langserve
47+
- local: configuration/models/providers/llamacpp
48+
title: Llama.cpp
49+
- local: configuration/models/providers/ollama
50+
title: Ollama
51+
- local: configuration/models/providers/openai
52+
title: OpenAI
53+
- local: configuration/models/providers/tgi
54+
title: TGI
55+
- local: configuration/common-issues
56+
title: Common Issues
57+
- title: Developing
58+
sections:
59+
- local: developing/architecture
60+
title: Architecture
61+
- local: developing/copy-huggingchat
62+
title: Copy HuggingChat
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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.
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
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+
Please contribute an example!
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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+
```

0 commit comments

Comments
 (0)