Skip to content
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 6 commits into from
Oct 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added docs/assets/images/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/assets/images/panel-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 16 additions & 9 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

# Examples
# Panel Chat Examples
Copy link
Collaborator Author

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.


To run all of these examples locally:

Expand All @@ -10,9 +10,11 @@ pip install hatch
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
Copy link
Collaborator Author

Choose a reason for hiding this comment

The 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

Expand Down Expand Up @@ -56,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.
"""


Expand Down Expand Up @@ -466,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>
"""

Expand Down
14 changes: 8 additions & 6 deletions mkdocs.yml
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
Copy link
Collaborator Author

Choose a reason for hiding this comment

The 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
Expand All @@ -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
Expand All @@ -37,6 +38,7 @@ markdown_extensions:
- pymdownx.inlinehilite
- pymdownx.snippets
- pymdownx.superfences
- admonition

plugins:
- search
Expand All @@ -53,4 +55,4 @@ watch:
- panel_chat_examples

nav:
- Examples: index.md
- Panel Chat Examples: index.md
11 changes: 6 additions & 5 deletions scripts/generate_gallery.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def run():

text = dedent(
"""
# Examples
# Panel Chat Examples

To run all of these examples locally:

Expand All @@ -33,10 +33,11 @@ def run():
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
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.
"""
)
for folder in sorted(EXAMPLES_PATH.glob("**/"), key=lambda folder: folder.name):
Expand Down
Loading