diff --git a/llm_server/config.py b/llm_server/config.py
index 8dd6748..95850eb 100644
--- a/llm_server/config.py
+++ b/llm_server/config.py
@@ -18,7 +18,8 @@ config_default_vars = {
'max_new_tokens': 500,
'manual_model_name': False,
'enable_openi_compatible_backend': True,
- 'openai_system_prompt': """You are an AI assistant chatbot. Your main function is to provide accurate and helpful responses to the user's queries. You should always be polite, respectful, and patient. You should not provide any personal opinions or advice unless specifically asked by the user. You should not make any assumptions about the user's knowledge or abilities. You should always strive to provide clear and concise answers. If you do not understand a user's query, ask for clarification. If you cannot provide an answer, apologize and suggest the user seek help elsewhere.\nYou are the assistant and answer to the `### RESPONSE` prompt. Lines that start with `### ASSISTANT` were messages you sent previously.\nLines that start with `### USER` were messages sent by the user you are chatting with.\nYou will respond to the "### RESPONSE:" prompts and follow the instructions given by the user.\n\n""",
+ 'expose_openai_system_prompt': True,
+ 'openai_system_prompt': """You are an assistant chatbot. Your main function is to provide accurate and helpful responses to the user's queries. You should always be polite, respectful, and patient. You should not provide any personal opinions or advice unless specifically asked by the user. You should not make any assumptions about the user's knowledge or abilities. You should always strive to provide clear and concise answers. If you do not understand a user's query, ask for clarification. If you cannot provide an answer, apologize and suggest the user seek help elsewhere.\nLines that start with "### ASSISTANT" were messages you sent previously.\nLines that start with "### USER" were messages sent by the user you are chatting with.\nYou will respond to the "### RESPONSE:" prompt as the assistant and follow the instructions given by the user.\n\n""",
}
config_required_vars = ['token_limit', 'concurrent_gens', 'mode', 'llm_middleware_name']
diff --git a/llm_server/opts.py b/llm_server/opts.py
index 97638a1..ece8555 100644
--- a/llm_server/opts.py
+++ b/llm_server/opts.py
@@ -25,4 +25,5 @@ show_backend_info = True
manual_model_name = None
llm_middleware_name = ''
enable_openi_compatible_backend = True
-openai_system_prompt = """You are an AI assistant chatbot. Your main function is to provide accurate and helpful responses to the user's queries. You should always be polite, respectful, and patient. You should not provide any personal opinions or advice unless specifically asked by the user. You should not make any assumptions about the user's knowledge or abilities. You should always strive to provide clear and concise answers. If you do not understand a user's query, ask for clarification. If you cannot provide an answer, apologize and suggest the user seek help elsewhere.\nYou are the assistant and answer to the `### RESPONSE` prompt. Lines that start with `### ASSISTANT` were messages you sent previously.\nLines that start with `### USER` were messages sent by the user you are chatting with.\nYou will respond to the "### RESPONSE:" prompts and follow the instructions given by the user.\n\n"""
+openai_system_prompt = """You are an assistant chatbot. Your main function is to provide accurate and helpful responses to the user's queries. You should always be polite, respectful, and patient. You should not provide any personal opinions or advice unless specifically asked by the user. You should not make any assumptions about the user's knowledge or abilities. You should always strive to provide clear and concise answers. If you do not understand a user's query, ask for clarification. If you cannot provide an answer, apologize and suggest the user seek help elsewhere.\nLines that start with "### ASSISTANT" were messages you sent previously.\nLines that start with "### USER" were messages sent by the user you are chatting with.\nYou will respond to the "### RESPONSE:" prompt as the assistant and follow the instructions given by the user.\n\n"""
+expose_openai_system_prompt = True
diff --git a/llm_server/routes/openai/__init__.py b/llm_server/routes/openai/__init__.py
index 3b21ecf..bd76e4e 100644
--- a/llm_server/routes/openai/__init__.py
+++ b/llm_server/routes/openai/__init__.py
@@ -30,3 +30,4 @@ def handle_error(e):
from .models import openai_list_models
from .chat_completions import openai_chat_completions
+from .info import get_openai_info
diff --git a/llm_server/routes/openai/info.py b/llm_server/routes/openai/info.py
new file mode 100644
index 0000000..3e98e2f
--- /dev/null
+++ b/llm_server/routes/openai/info.py
@@ -0,0 +1,14 @@
+from flask import Response
+
+from . import openai_bp
+from ... import opts
+
+
+@openai_bp.route('/prompt', methods=['GET'])
+def get_openai_info():
+ if opts.expose_openai_system_prompt:
+ resp = Response(opts.openai_system_prompt)
+ resp.headers['Content-Type'] = 'text/plain'
+ return resp, 200
+ else:
+ return '', 403
diff --git a/llm_server/routes/v1/info.py b/llm_server/routes/v1/info.py
index 883878e..027ca5a 100644
--- a/llm_server/routes/v1/info.py
+++ b/llm_server/routes/v1/info.py
@@ -8,9 +8,6 @@ from ... import opts
from ...llm.info import get_running_model
-# cache = Cache(bp, config={'CACHE_TYPE': 'simple'})
-
-
# @bp.route('/info', methods=['GET'])
# # @cache.cached(timeout=3600, query_string=True)
# def get_info():
diff --git a/other/vllm/vllm_api_server.py b/other/vllm/vllm_api_server.py
old mode 100755
new mode 100644
diff --git a/server.py b/server.py
index a455ef0..6311edb 100644
--- a/server.py
+++ b/server.py
@@ -72,6 +72,7 @@ opts.manual_model_name = config['manual_model_name']
opts.llm_middleware_name = config['llm_middleware_name']
opts.enable_openi_compatible_backend = config['enable_openi_compatible_backend']
opts.openai_system_prompt = config['openai_system_prompt']
+opts.expose_openai_system_prompt = config['expose_openai_system_prompt']
opts.verify_ssl = config['verify_ssl']
if not opts.verify_ssl:
@@ -164,6 +165,7 @@ def home():
stats_json=json.dumps(stats, indent=4, ensure_ascii=False),
extra_info=mode_info,
openai_client_api=f'https://{opts.base_client_api}/openai/v1' if opts.enable_openi_compatible_backend else 'disabled',
+ expose_openai_system_prompt=opts.expose_openai_system_prompt
)
diff --git a/templates/home.html b/templates/home.html
index 4ebd9ac..1f843f0 100644
--- a/templates/home.html
+++ b/templates/home.html
@@ -101,6 +101,14 @@
+ {% if openai_client_api != 'disabled' and expose_openai_system_prompt %}
+
+
The OpenAI-Compatible API adds a system prompt to set the AI's behavior to a "helpful assistant". You can view this prompt here.
+