Deploy a custom model server
For your convenience, we have provided a sample model server that you can use as a reference. You can find the sample model server here We highly recommend using the sample model server as a starting point. Depending on your model is an instruct-style or chat-style model, you will need to implement eithercustom_model.py
or custom_chat_model.py
respectively.
Adding configurable fields
It is often useful to configure your model with different parameters. These might include temperature, model_name, max_tokens, etc. To make your model configurable in the LangSmith playground, you need to add configurable fields to your model server. These fields can be used to change model parameters from the playground. You can add configurable fields by implementing thewith_configurable_fields
function in the config.py
file. You can
Use the model in the LangSmith Playground
Once you have deployed a model server, you can use it in the LangSmith Playground. Enter the playground and select either theChatCustomModel
or the CustomModel
provider for chat-style model or instruct-style models.
Enter the URL
. The playground will automatically detect the available endpoints and configurable fields. You can then invoke the model with the desired parameters.

with_configurable_fields
.
See how to store your model configuration for later use here.