-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
283 additions
and
10 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
name: Release | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
prerelease: | ||
default: true | ||
push: | ||
branches: | ||
- master | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
tests: | ||
name: "Run tests" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.11' | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install ruff pytest | ||
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | ||
- name: Test with pytest | ||
run: | | ||
pytest --ignore=tests/example.py --doctest-modules --junitxml=junit/test-results.xml | ||
version: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
version: ${{ steps.changelog.outputs.version }} | ||
tag: ${{ steps.changelog.outputs.tag }} | ||
changelog: ${{ steps.changelog.outputs.changelog }} | ||
clean_changelog: ${{ steps.changelog.outputs.clean_changelog }} | ||
skipped: ${{ steps.changelog.outputs.skipped }} | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Conventional Changelog Action | ||
id: changelog | ||
uses: TriPSs/conventional-changelog-action@v5 | ||
with: | ||
release-count: '1' | ||
skip-version-file: 'true' | ||
skip-commit: 'true' | ||
skip-git-pull: 'true' | ||
git-push: 'false' | ||
fallback-version: '0.1.0' | ||
release: | ||
name: "Release and publish the version" | ||
needs: [ tests, version ] | ||
runs-on: ubuntu-latest | ||
permissions: | ||
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing | ||
contents: write | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- name: Login to GitHub Container Registry | ||
uses: docker/login-action@v2 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Extract repository name | ||
|
||
- name: Build and push Docker image | ||
uses: docker/build-push-action@v3 | ||
with: | ||
context: . | ||
file: ./Dockerfile | ||
push: true | ||
tags: ghcr.io/${{ github.repository }}/${{github.repository}}:${{ needs.version.outputs.version }} | ||
|
||
- name: Update changelog | ||
shell: bash | ||
run: | | ||
git config user.name github-actions | ||
git config user.email [email protected] | ||
touch CHANGELOG.md | ||
echo -e "${{ needs.version.outputs.changelog }}\n\n$(cat CHANGELOG.md)" > CHANGELOG.md | ||
git add CHANGELOG.md | ||
git add docs/reference.md | ||
git commit -m "chore(release): ${{ needs.version.outputs.version }}" CHANGELOG.md | ||
git push | ||
- name: Tag | ||
uses: actions/github-script@v7 | ||
with: | ||
script: | | ||
github.rest.git.createRef({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
ref: 'refs/tags/${{ needs.version.outputs.tag }}', | ||
sha: context.sha | ||
}) | ||
- name: Release on GitHub | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
tag_name: ${{ needs.version.outputs.tag }} | ||
files: dist/* | ||
body: | | ||
Released to ghcr.io/${{ github.repository }}/${{github.repository}}:${{ needs.version.outputs.version }} | ||
--- | ||
${{ needs.version.outputs.clean_changelog }} | ||
prerelease: ${{ inputs.prerelease }} | ||
name: Version ${{ needs.version.outputs.version }} | ||
generate_release_notes: false |
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 |
---|---|---|
@@ -1,4 +1,89 @@ | ||
# ![Logo](./public/sandbox.svg) | ||
# LLM Playground | ||
|
||
This playground can help you quickly experiment with the LLM model. | ||
LLM Playground is a versatile environment for experimenting with different large language models (LLMs). It facilitates basic evaluation and comparisons directly in your browser, without the need to set up projects or write code in Jupyter notebooks. This tool supports a variety of LLMs, including OpenAI models, through configurable endpoints. | ||
|
||
<picture> | ||
<source media="(prefers-color-scheme: dark)" srcset="./screenshot-dark.png"> | ||
<img alt="LLM Playground screenshot" src="./screenshot.png"> | ||
</picture> | ||
|
||
## Features | ||
|
||
- **Flexible Configuration**: Use environmental variables, a settings YAML file, or a `.env` file. | ||
- **Support for Multiple Vendors**: Compatible with OpenAI and other LLM providers through the [LiteLLM Proxy](https://docs.litellm.ai/docs/simple_proxy). | ||
- **Easy to Use**: Designed for straightforward setup and minimal overhead. | ||
|
||
## Getting Started | ||
|
||
### Prerequisites | ||
|
||
- Docker installed on your machine. | ||
|
||
### Installation | ||
|
||
To get started with LLM Playground, you can use Docker to pull and run the container: | ||
|
||
```bash | ||
docker pull ghcr.io/almogbaku/llm-playground | ||
docker run -p 8080:8080 ghcr.io/almogbaku/llm-playground | ||
``` | ||
|
||
This will start the LLM Playground on port 8080. | ||
|
||
## Configuration | ||
|
||
LLM Playground allows various configuration methods including environment variables, a `.env` file, or a `settings.yml` file. | ||
|
||
### Configuration Options | ||
|
||
- `openai_api_key`: Your OpenAI API key. | ||
- `openai_organization`: Your OpenAI organization ID. | ||
- `openai_base_url`: Base URL for the OpenAI API. | ||
- `models`: Configuration for the models and endpoints. | ||
|
||
### Models Configuration | ||
|
||
Configure your models using one of the following methods: | ||
|
||
1. **Direct Configuration**: Specify models directly in the `models.models` parameter. | ||
2. **API Provider URLs**: Set `models.urls` to fetch models from an LLM-Playground compatible API((need to return an array of Model)[server/src/types.py]). | ||
3. **OpenAI API URLs**: Set `models.oai_urls` to fetch models from an OpenAI compatible API. | ||
|
||
Each model can be configured with a `base_url` if it does not utilize OpenAI or is not fetched from `models.oai_urls`. | ||
|
||
### Example Configuration | ||
|
||
Here is a more detailed example using an environment variable setup: | ||
|
||
```bash | ||
export OPENAI_API_KEY="your-openai-api-key" | ||
|
||
export MODELS_MODELS_0_NAME="LLama3" | ||
export MODELS_MODELS_0_DESCRIPTION="Facebook's Llama3 Model" | ||
export MODELS_MODELS_0_TYPE="chat" | ||
export MODELS_MODELS_0_MAX_TOKENS="32000" | ||
export MODELS_MODELS_0_VENDOR="Facebook" | ||
``` | ||
|
||
For multiple models, repeat the pattern adjusting the `MODEL_#_` prefix. | ||
|
||
### YAML Configuration Example | ||
|
||
```yaml | ||
openai_api_key: "your-openai-api-key" | ||
models: | ||
urls: ["http://example.com/api/models"] # Fetch models from an LLM-Playground compatible API | ||
oai_urls: ["http://example.com/api/openai-models"] # Fetch models from an OpenAI compatible API | ||
models: | ||
- name: "llama3" | ||
description: "Facebook's Llama3 Model" | ||
type: "chat" | ||
base_url: "https://api.example.com" | ||
max_tokens: 32000 | ||
vendor: "Facebook" | ||
``` | ||
## Usage | ||
Once deployed, access LLM Playground by visiting `http://localhost:8080`. Choose from the available models to start your experiments and comparisons. |
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
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,46 @@ | ||
annotated-types==0.6.0 | ||
anyio==4.3.0 | ||
certifi==2024.2.2 | ||
charset-normalizer==3.3.2 | ||
click==8.1.7 | ||
distro==1.9.0 | ||
dnspython==2.6.1 | ||
email_validator==2.1.1 | ||
fastapi==0.111.0 | ||
fastapi-cli==0.0.2 | ||
h11==0.14.0 | ||
httpcore==1.0.5 | ||
httptools==0.6.1 | ||
httpx==0.27.0 | ||
idna==3.7 | ||
itsdangerous==2.2.0 | ||
Jinja2==3.1.4 | ||
markdown-it-py==3.0.0 | ||
MarkupSafe==2.1.5 | ||
mdurl==0.1.2 | ||
openai==1.25.2 | ||
orjson==3.10.3 | ||
pydantic==2.7.1 | ||
pydantic-extra-types==2.7.0 | ||
pydantic-settings==2.2.1 | ||
pydantic_core==2.18.2 | ||
Pygments==2.18.0 | ||
python-dotenv==1.0.1 | ||
python-multipart==0.0.9 | ||
PyYAML==6.0.1 | ||
regex==2024.4.28 | ||
requests==2.31.0 | ||
rich==13.7.1 | ||
shellingham==1.5.4 | ||
sniffio==1.3.1 | ||
starlette==0.37.2 | ||
tiktoken==0.6.0 | ||
tqdm==4.66.4 | ||
typer==0.12.3 | ||
typing_extensions==4.11.0 | ||
ujson==5.9.0 | ||
urllib3==2.2.1 | ||
uvicorn==0.29.0 | ||
uvloop==0.19.0 | ||
watchfiles==0.21.0 | ||
websockets==12.0 |
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