-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enhance docs #29
Merged
Merged
Enhance docs #29
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
ced3376
enhance docs
MarcSkovMadsen e31dd1c
Merge branch 'fix/make-project-installable' of https://github.com/Mar…
MarcSkovMadsen 2f94ce7
add playwright installation
MarcSkovMadsen 89a3241
trigger rebuild
MarcSkovMadsen c69afe6
install browser in build pipeline
MarcSkovMadsen 3a6c944
Merge branch 'main' into enhancement/docs
ahuang11 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Developer Guide | ||
|
||
This guide will show you how-to work with the project as a developer. | ||
|
||
## Docs | ||
|
||
For documentation we use [MkDocs](https://www.mkdocs.org/). | ||
|
||
To serve the documentation run | ||
|
||
```batch | ||
hatch run mkdocs serve | ||
``` |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,20 @@ | ||
|
||
# Examples | ||
# Panel Chat Examples | ||
|
||
To run all of these examples locally: | ||
|
||
```bash | ||
git clone https://github.com/holoviz-topics/panel-chat-examples | ||
cd panel-chat-examples | ||
pip install hatch | ||
hatch run panel serve docs/examples/**/*.py --static-dirs thumbnails=docs/assets/thumbnails --autoreload | ||
hatch run panel-serve | ||
``` | ||
|
||
Note the default installation is not optimized for GPU usage. To enable GPU support for local | ||
models (i.e. not OpenAI), install `ctransformers` with the proper backend and modify the | ||
scripts configs' accordingly, e.g. `n_gpu_layers=1` for a single GPU. | ||
!!! note | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add admonition. Looks better. |
||
Note the default installation is not optimized for GPU usage. To **enable | ||
GPU support** for local models (i.e. not OpenAI), install `ctransformers` | ||
with the proper backend and modify the | ||
scripts configs' accordingly, e.g. `n_gpu_layers=1` for a single GPU. | ||
|
||
## Basics | ||
|
||
|
@@ -55,19 +58,23 @@ chat_interface.servable() | |
|
||
### Echo Stream | ||
|
||
Demonstrates how to use the `ChatInterface` and a `callback` function to stream back responses. | ||
Demonstrates how to use the `ChatInterface` and a `callback` function to stream back | ||
responses. | ||
|
||
The chatbot Assistant echoes back the message entered by the User in a *streaming* fashion. | ||
The chatbot Assistant echoes back the message entered by the User in a *streaming* | ||
fashion. | ||
|
||
[<img src="assets/thumbnails/echo_stream.png" alt="Echo Stream" style="max-height: 400px; max-width: 100%;">](examples/basics/echo_stream.py) | ||
|
||
<details> | ||
<summary>Source code for <a href='examples/basics/echo_stream.py' target='_blank'>echo_stream.py</a></summary> | ||
```python | ||
""" | ||
Demonstrates how to use the `ChatInterface` and a `callback` function to stream back responses. | ||
Demonstrates how to use the `ChatInterface` and a `callback` function to stream back | ||
responses. | ||
|
||
The chatbot Assistant echoes back the message entered by the User in a *streaming* fashion. | ||
The chatbot Assistant echoes back the message entered by the User in a *streaming* | ||
fashion. | ||
""" | ||
|
||
|
||
|
@@ -157,7 +164,6 @@ Demonstrates how to delay the display of the placeholder. | |
""" | ||
|
||
from asyncio import sleep | ||
from random import choice | ||
|
||
import panel as pn | ||
|
||
|
@@ -448,7 +454,6 @@ Llama2. | |
""" | ||
|
||
import panel as pn | ||
|
||
from langchain.chains import LLMChain | ||
from langchain.llms import CTransformers | ||
from langchain.prompts import PromptTemplate | ||
|
@@ -467,7 +472,8 @@ MODEL_KWARGS = { | |
} | ||
llm_chains = {} | ||
|
||
TEMPLATE = """<s>[INST] You are a friendly chat bot who's willing to help answer the user: | ||
TEMPLATE = """<s>[INST] You are a friendly chat bot who's willing to help answer the | ||
user: | ||
{user_input} [/INST] </s> | ||
""" | ||
|
||
|
@@ -574,7 +580,7 @@ def add_key_to_env(key): | |
os.environ["OPENAI_API_KEY"] = key | ||
chat_interface.send( | ||
"Your OpenAI key has been set. Feel free to minimize the sidebar.", | ||
**SYSTEM_KWARGS | ||
**SYSTEM_KWARGS, | ||
) | ||
chat_interface.disabled = False | ||
|
||
|
@@ -882,3 +888,4 @@ chat_interface.send( | |
chat_interface.servable() | ||
``` | ||
</details> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,19 @@ | ||
site_name: Panel Chat Examples | ||
site_description: Example recipes for Panel ChatInterface. | ||
site_description: Example recipes for Panel Chat Components | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this site if for Panel Chats in general. Not just Panels ChatInterface components. |
||
|
||
repo_url: https://github.com/holoviz-topics/panel-chat-examples | ||
repo_name: holoviz-topics/panel-chat-examples | ||
|
||
theme: | ||
name: material | ||
icon: | ||
logo: material/library | ||
logo: 'assets/images/panel-logo.png' | ||
features: | ||
- content.copy.code | ||
palette: | ||
# Palette toggle for light mode | ||
- media: "(prefers-color-scheme: light)" | ||
scheme: default | ||
primary: grey | ||
primary: white | ||
accent: blue | ||
toggle: | ||
icon: material/brightness-7 | ||
|
@@ -21,7 +22,7 @@ theme: | |
# Palette toggle for dark mode | ||
- media: "(prefers-color-scheme: dark)" | ||
scheme: slate | ||
primary: grey | ||
primary: black | ||
accent: blue | ||
toggle: | ||
icon: material/brightness-4 | ||
|
@@ -37,6 +38,7 @@ markdown_extensions: | |
- pymdownx.inlinehilite | ||
- pymdownx.snippets | ||
- pymdownx.superfences | ||
- admonition | ||
|
||
plugins: | ||
- search | ||
|
@@ -53,4 +55,4 @@ watch: | |
- panel_chat_examples | ||
|
||
nav: | ||
- Examples: index.md | ||
- Panel Chat Examples: index.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Renaming to Panel Chat Examples will keep the "Panel Chat Examples" when scrolling. This is much better than "Examples" if you want to copy-paste screen shots and share on social media.