Quick Start

Chat Completions

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 import requests import json url = "https://api.awanllm.com/v1/chat/completions" payload = json.dumps({ "model": "{MODEL_NAME}t", "messages": [ {"role": "system", "content": "You are a helpful assistant."}, {"role": "user", "content": "Hello!"}, {"role": "assistant", "content": "Hi!, how can I help you today?"} ], "repetition_penalty": 1.1, "temperature": 0.7, "top_p": 0.9, "top_k": 40, "max_tokens": 1024, "stream": True }) headers = { 'Content-Type': 'application/json', 'Authorization': f"Bearer {AWANLLM_API_KEY}" } response = requests.request("POST", url, headers=headers, data=payload)
NOTE: Some models might not accept system prompts.

Completions

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 import requests import json url = "https://api.awanllm.com/v1/completions" payload = json.dumps({ "model": "Meta-Llama-3-8B-Instruct", "prompt": "<|begin_of_text|><|start_header_id|>system<|end_header_id|>\n\nYou are an assistant AI.<|eot_id|><|start_header_id|>user<|end_header_id|>\n\nHello there!<|eot_id|><|start_header_id|>assistant<|end_header_id|>\n\n", "repetition_penalty": 1.1, "temperature": 0.7, "top_p": 0.9, "top_k": 40, "max_tokens": 1024, "stream": True }) headers = { 'Content-Type': 'application/json', 'Authorization': f"Bearer {AWANLLM_API_KEY}" } response = requests.request("POST", url, headers=headers, data=payload)
NOTE: Make sure to use the suggested prompt format for each model when using completions. Example shown is Llama 3 Instruct format.

Huggingface Chat-UI

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 MONGODB_URL=mongodb://localhost:27017 PUBLIC_APP_NAME=ChatUI PUBLIC_APP_ASSETS=chatui PUBLIC_APP_COLOR=cyan MODELS=`[ { "name": "Awanllm-Llama-3-8B-Dolfin", "displayName": "Awanllm-Llama-3-8B-Dolfin", "id": "Awanllm-Llama-3-8B-Dolfin", "preprompt": "", "parameters": { "temperature": 0.7, "top_p": 0.9, "repetition_penalty": 1.1, "top_k": 40, "truncate": 8192, "max_new_tokens": 1024, "stop": ["<|eot_id|>"] }, "endpoints": [{ "type" : "openai", "baseURL": "https://api.awanllm.com/v1", "apiKey": "${AWANLLM_API_KEY}" }] } ]`

SillyTavern

- Text Completion

SillyTavern Image

- Chat Completion

SillyTavern Image