model_with_config.py
1 from langchain_core.prompts import PromptTemplate 2 from langchain_core.runnables import ConfigurableField 3 from langchain_openai import ChatOpenAI 4 5 from mlflow.models import set_model 6 7 model = ChatOpenAI(temperature=0).configurable_fields( 8 temperature=ConfigurableField( 9 id="temperature", 10 name="LLM temperature", 11 description="The temperature of the LLM", 12 ) 13 ) 14 15 prompt = PromptTemplate.from_template("Pick a random number above {x}") 16 chain = prompt | model 17 18 set_model(chain)