Skip to content
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
2 changes: 1 addition & 1 deletion charts/azimuth-chat/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"type": "string",
"title": "Instruction",
"description": "The initial system prompt (i.e. the hidden instruction) to use when generating responses.",
"default": "You are a helpful AI assistant. Please respond appropriately."
"default": "You are a helpful AI assistant. Please respond appropriately. Today's date is {date}."
},
"page_title": {
"type": "string",
Expand Down
6 changes: 4 additions & 2 deletions web-apps/chat/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import utils
import gradio as gr

from datetime import date
from urllib.parse import urljoin
from langchain.schema import HumanMessage, AIMessage, SystemMessage
from langchain_openai import ChatOpenAI
Expand Down Expand Up @@ -68,11 +69,12 @@ def inference(latest_message, history):

try:
context = []
model_instruction = settings.model_instruction.replace("{date}", f"{date.today()}")
if INCLUDE_SYSTEM_PROMPT:
context.append(SystemMessage(content=settings.model_instruction))
context.append(SystemMessage(content=model_instruction))
elif history and len(history) > 0:
# Mimic system prompt by prepending it to first human message
history[0]['content'] = f"{settings.model_instruction}\n\n{history[0]['content']}"
history[0]['content'] = f"{model_instruction}\n\n{history[0]['content']}"

for message in history:
role = message['role']
Expand Down
3 changes: 2 additions & 1 deletion web-apps/chat/defaults.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ backend_url: http://localhost:11434

host_address: 0.0.0.0

model_instruction: "You are a helpful and cheerful AI assistant. Please respond appropriately."
# Model instruction allows substituting in current date
model_instruction: "You are a helpful and cheerful AI assistant. Please respond appropriately. Today's date is {date}."

page_title: Large Language Model

Expand Down