-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Adding LISA documentation deployment stack
- Loading branch information
Showing
48 changed files
with
4,098 additions
and
70 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,57 @@ | ||
|
||
name: Deploy VitePress site to Github Pages | ||
on: | ||
push: | ||
branches: [main] | ||
workflow_dispatch: | ||
|
||
permissions: | ||
contents: read | ||
pages: write | ||
id-token: write | ||
|
||
concurrency: | ||
group: pages | ||
cancel-in-progress: false | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Setup Node | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20 | ||
cache: npm | ||
- name: Setup Pages | ||
uses: actions/configure-pages@v4 | ||
- name: Install dependencies | ||
working-directory: ./lib/docs | ||
run: npm install | ||
env: | ||
CI: "" | ||
- name: Build with VitePress | ||
working-directory: ./lib/docs | ||
run: npm run docs:build | ||
env: | ||
CI: "" | ||
DOCS_BASE_PATH: '/lisa/' | ||
- name: Upload artifact | ||
uses: actions/upload-pages-artifact@v3 | ||
with: | ||
path: ./lib/docs/dist | ||
deploy: | ||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
needs: build | ||
runs-on: ubuntu-latest | ||
name: Deploy | ||
steps: | ||
- name: Deploy to GitHub Pages | ||
id: deployment | ||
uses: actions/deploy-pages@v4 |
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,2 @@ | ||
dist/ | ||
.vitepress/cache/ |
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,86 @@ | ||
/** | ||
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
Licensed under the Apache License, Version 2.0 (the "License"). | ||
You may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
import { defineConfig } from 'vitepress'; | ||
|
||
const navLinks = [ | ||
{ | ||
text: 'System Administrator Guide', | ||
items: [ | ||
{ text: 'Architecture Overview', link: '/admin/architecture' }, | ||
{ text: 'LISA Components', link: '/admin/components' }, | ||
{ text: 'Getting Started', link: '/admin/getting-started' }, | ||
{ text: 'Configure IdP: Cognito & Keycloak Examples', link: '/admin/idp' }, | ||
{ text: 'Deployment', link: '/admin/deploy' }, | ||
{ text: 'Setting Model Management Admin Group', link: '/admin/model-management' }, | ||
{ text: 'LiteLLM', link: '/admin/lite-llm' }, | ||
{ text: 'API Overview', link: '/admin/api' }, | ||
{ text: 'API Request Error Handling', link: '/admin/error' }, | ||
{ text: 'Security', link: '/admin/security' }, | ||
], | ||
}, | ||
{ | ||
text: 'Advanced Configuration', | ||
items: [ | ||
{ text: 'Programmatic API Tokens', link: '/config/api-tokens' }, | ||
{ text: 'Model Compatibility', link: '/config/model-compatibility' }, | ||
{ text: 'Model Management API', link: '/config/model-management-api' }, | ||
{ text: 'Model Management UI', link: '/config/model-management-ui' }, | ||
{ text: 'Rag Vector Stores', link: '/config/vector-stores' }, | ||
{ text: 'Usage & Features', link: '/config/features' }, | ||
{ text: 'Branding', link: '/config/branding' }, | ||
{ text: 'Hiding Advanced Chat UI Components', link: '/config/hiding-chat-components' }, | ||
], | ||
}, | ||
{ | ||
text: 'User Guide', | ||
items: [ | ||
{ text: 'LISA Chat UI', link: '/user/chat' }, | ||
{ text: 'RAG', link: '/user/rag' }, | ||
{ text: 'Context Windows', link: '/user/context-windows' }, | ||
{ text: 'Model KWARGS', link: '/user/model-kwargs' }, | ||
{ text: 'Non-RAG in Context File Management', link: '/user/nonrag-management' }, | ||
{ text: 'Prompt Engineering', link: '/user/prompt-engineering' }, | ||
{ text: 'Session History', link: '/user/history' }, | ||
], | ||
}]; | ||
|
||
// https://vitepress.dev/reference/site-config | ||
export default defineConfig({ | ||
lang: 'en-US', | ||
title: 'LISA Documentation', | ||
description: 'LLM Inference Solution for Amazon Dedicated Cloud (LISA)', | ||
outDir: 'dist', | ||
base: '/lisa/', | ||
head: [['link', { rel: 'icon', href: '/lisa/favicon.ico' }]], | ||
// https://vitepress.dev/reference/default-theme-config | ||
themeConfig: { | ||
logo: '/logo.png', | ||
nav: [ | ||
{ text: 'Home', link: '/' }, | ||
...navLinks, | ||
], | ||
|
||
sidebar: navLinks, | ||
|
||
socialLinks: [ | ||
{ icon: 'github', link: 'https://github.com/awslabs/lisa' }, | ||
], | ||
search: { | ||
provider: 'local', | ||
}, | ||
}, | ||
}); |
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,77 @@ | ||
## Programmatic API Tokens | ||
|
||
The LISA Serve ALB can be used for programmatic access outside the example Chat application. | ||
An example use case would be for allowing LISA to serve LLM requests that originate from the [Continue VSCode Plugin](https://www.continue.dev/). | ||
To facilitate communication directly with the LISA Serve ALB, a user with sufficient DynamoDB PutItem permissions may add | ||
API keys to the APITokenTable, and once created, a user may make requests by including the `Authorization: Bearer ${token}` | ||
header or the `Api-Key: ${token}` header with that token. If using any OpenAI-compatible library, the `api_key` fields | ||
will use the `Authorization: Bearer ${token}` format automatically, so there is no need to include additional headers | ||
when using those libraries. | ||
|
||
### Adding a Token | ||
|
||
An account owner may create a long-lived API Token using the following AWS CLI command. | ||
|
||
```bash | ||
AWS_REGION="us-east-1" # change to your deployment region | ||
token_string="YOUR_STRING_HERE" # change to a unique string for a user | ||
aws --region $AWS_REGION dynamodb put-item --table-name $DEPLOYMENT_NAME-LISAApiTokenTable \ | ||
--item '{"token": {"S": "'${token_string}'"}}' | ||
``` | ||
|
||
If an account owner wants the API Token to be temporary and expire after a specific date, LISA will allow for this too. | ||
In addition to the `token` field, the owner may specify the `tokenExpiration` field, which accepts a UNIX timestamp, | ||
in seconds. The following command shows an example of how to do this. | ||
|
||
```bash | ||
AWS_REGION="us-east-1" # change to your deployment region | ||
token_string="YOUR_STRING_HERE" | ||
token_expiration=$(echo $(date +%s) + 3600 | bc) # token that expires in one hour, 3600 seconds | ||
aws --region $AWS_REGION dynamodb put-item --table-name $DEPLOYMENT_NAME-LISAApiTokenTable \ | ||
--item '{ | ||
"token": {"S": "'${token_string}'"}, | ||
"tokenExpiration": {"N": "'${token_expiration}'"} | ||
}' | ||
``` | ||
|
||
Once the token is inserted into the DynamoDB Table, a user may use the token in the `Authorization` request header like | ||
in the following snippet. | ||
|
||
```bash | ||
lisa_serve_rest_url="https://<rest-url-from-cdk-output>" | ||
token_string="YOUR_STRING_HERE" | ||
curl ${lisa_serve_rest_url}/v2/serve/models \ | ||
-H 'accept: application/json' \ | ||
-H 'Content-Type: application/json' \ | ||
-H "Authorization: Bearer ${token_string}" | ||
``` | ||
|
||
### Updating a Token | ||
|
||
In the case that an owner wishes to change an existing expiration time or add one to a key that did not previously have | ||
an expiration, this can be accomplished by editing the existing item. The following commands can be used as an example | ||
for updating an existing token. Setting the expiration time to a time in the past will effectively remove access for | ||
that key. | ||
|
||
```bash | ||
AWS_REGION="us-east-1" # change to your deployment region | ||
token_string="YOUR_STRING_HERE" | ||
token_expiration=$(echo $(date +%s) + 600 | bc) # token that expires in 10 minutes from now | ||
aws --region $AWS_REGION dynamodb update-item --table-name $DEPLOYMENT_NAME-LISAApiTokenTable \ | ||
--key '{"token": {"S": "'${token_string}'"}}' \ | ||
--update-expression 'SET tokenExpiration=:t' \ | ||
--expression-attribute-values '{":t": {"N": "'${token_expiration}'"}}' | ||
``` | ||
|
||
### Removing a Token | ||
|
||
Tokens will not be automatically removed even if they are no longer valid. An owner may remove an key, expired or not, | ||
from the database to fully revoke the key, by deleting the item. As an example, the following commands can be used to | ||
remove a token. | ||
|
||
```bash | ||
AWS_REGION="us-east-1" # change to your deployment region | ||
token_string="YOUR_STRING_HERE" # change to the token to remove | ||
aws --region $AWS_REGION dynamodb delete-item --table-name $DEPLOYMENT_NAME-LISAApiTokenTable \ | ||
--key '{"token": {"S": "'${token_string}'"}}' | ||
``` |
Oops, something went wrong.