Most configuration options can be set either on the command line or in a configuration file, while some are configured using environment variables.
A command line option overrides the same option configured in a configuration file.
The configuration file is a YAML file where each key represents an option.
There is no default configuration file. If you need a configuration file, you can specify it either via the command line or by setting an environment variable.
Use -c or --config with a file name in the argument. Example:
plct-serve -c plct-server-config.yaml
Use the PLCT_SERVER_CONFIG_FILE environment variable.
You don’t need to use the plct-server command line; instead, you can run the PLCT Server like any Python ASGI web application. In this case, you can use the PLCT_SERVER_CONFIG_FILE environment variable along with the appropriate configuration file to set the options. For example, you can run the PLCT Server using the Uvicorn ASGI web server:
Windows Command Prompt
SET PLCT_SERVER_CONFIG_FILE=plct-server-config.yaml
uvicorn plct_server.ui_main:app --host 127.0.0.1 --port 9000
Bash shell
export PLCT_SERVER_CONFIG_FILE=plct-server-config.yaml
uvicorn plct_server.ui_main:app --host 127.0.0.1 --port 9000
You can configure verbose messages, which will effectively set the debug log level.
Use -v or --verbose. Example:
plct-serve -v
Use verbose key with true value. Example:
verbose: trueUse positional command line arguments to specify the folder paths of PLCT projects. Example:
plct-serve ../courses/intro_to_prog ../courses/databases
Relative paths are considered relative to the current folder.
Use the course_paths key. Example:
course_paths:
- ../courses/intro_to_prog
- ../courses/databasesRelative paths are interpreted as follows:
- If
content_urlis not configured, they are considered relative to the folder of the configuration file. - If
content_urlis configured, they are considered relative to thecontent_url. However, ifcontent_urlis itself a relative path, it is considered relative to the folder of the configuration file.
The command line option is not implemented yet.
Use the content_url key. It is intended for use in conjunction with course_paths. Example:
content_url: ../courses
course_paths:
- intro_to_prog
- databasesYou may configure host and port the HTTP service should be bind to.
Use -h or --host option to set the host and -p or --port option to set the port. Example:
plct-serve -h 127.0.0.1 -p 9000
Host and port options cannot be configured in a configuration file. These options are specific to the plct-serve command that embeds an HTTP server.
The AI Assistant uses a preprocessed context dataset that you can create using PLCT AI Context Builder. The context dataset is a file-set that can be accessed either locally or via HTTP(S).
For customized preprocessing, you can use the ContextDatasetBuilder class from the plct_server.ai.context_dataset module directly.
Use -a or --ai-context with a folder URL. Example:
plct-serve --ai-context <ai-contex path>
Relative paths are considered relative to the current folder. Supported URL schemes are http, https and file.
Use the ai_ctx_url key. Example:
ai_ctx_url: <ai-contex path>Relative paths are considered relative to the folder of the configuration file. Supported URL schemes are http, https and file.
PLCT server implements the Retrieval Augmented Generation (RAG) REST API. To enable access to the API, you need to specify an API key.
Use the api_key key. Example:
api_key: 695613bb32c64842bd64aff8f8edc51951a90a183ff3b690697f0247657deb48The API key in the above example is randomly generated SHA-256 hash.
Use the PLCT_API_KEY environment variable to set your api key.
Use the CHATAI_OPENAI_API_KEY environment variable to set the OpenAI API key or use
CHATAI_AZURE_API_KEY to set the Azure OpenAI Service key (and make sure you also set the azure_default_ai_endpoint).
By default, the PLCT server uses the standard OpenAI endpoint, but it can also be configured to use Azure OpenAI Service endpoints. Different Azure OpenAI Service endpoints may be configured for different models.
Use -e, --azure-ai-endpoint to set the endpoint. Example:
plct-serve -e https://my_endpoint1.openai.azure.com/
Use the azure_default_ai_endpoint string for default Azure OpenAI Service. Example:
azure_default_ai_endpoint: https://my_endpoint1.openai.azure.com/Once the Azure OpenAI Service endpoint is provided, ensure that you set up your Azure environment with the correct models. This includes specifying the model names, deployment names, and API versions that you will use. You can modify or reference MODEL_CONFIGS_LIST, located in the PLCT Server configuration module plct_server.ai.model_conf
MODEL_CONFIGS_LIST = [
ModelConfig(
name="gpt-4o-mini",
provider=None, # use default provider
azure_deployment_name="gpt-4o-mini",
azure_api_version="2023-03-15-preview",
type="chat",
context_size=128_000
),
ModelConfig(
name="gpt-4o",
provider=None, # use default provider
azure_deployment_name="gpt-4o",
azure_api_version="2024-02-15-preview",
type="chat",
context_size=128_000
),
ModelConfig(
name="text-embedding-3-large",
provider=None, # use default provider
azure_deployment_name="text-embedding-3-large",
azure_api_version="2023-05-15",
type="embedding",
context_size=8_191
),
]For example, if you already have an Azure OpenAI deployment for the gpt-4o-mini model named my-gpt-4o-mini, ensure that the azure_deployment_name and azure_api_version fields are correctly configured:
azure_deployment_name="my-gpt-4o-mini"
azure_api_version="2023-05-15"PLCT Server can use a vLLM server as a model provider. When configured, the server will query the vLLM endpoint for available models and auto-add any that are not already in MODEL_CONFIGS_LIST.
Use the vllm_url key to point to the vLLM OpenAI-compatible API endpoint. Example:
vllm_url: http://localhost:8000/v1Use the CHATAI_VLLM_API_KEY environment variable to set the vLLM server API key (defaults to EMPTY if not set).
You can pre-configure vLLM models in MODEL_CONFIGS_LIST to set custom options like extra_body or context_size:
ModelConfig(
name="meta-llama/Llama-3.1-70B-Instruct",
provider=ModelProvider.VLLM,
type="chat",
context_size=128_000,
extra_body={
"stop_token_ids": [128001, 128008, 128009]
}
)Models served by vLLM that are not in MODEL_CONFIGS_LIST will be auto-added with their reported max_model_len as context_size.