models in the pyfunc flavor.See the API documentation and examples.Completions Example‚Äãimport mlflowfrom langchain.chains import LLMChain, PromptTemplatefrom langchain.llms import MlflowAIGatewaygateway = MlflowAIGateway(    gateway_uri="http://127.0.0.1:5000",    route="completions",    params={        "temperature": 0.0,        "top_p": 0.1,    },)llm_chain = LLMChain(    llm=gateway,    prompt=PromptTemplate(        input_variables=["adjective"],        template="Tell me a {adjective} joke",    ),)result = llm_chain.run(adjective="funny")print(result)with mlflow.start_run():    model_info = mlflow.langchain.log_model(chain, "model")model = mlflow.pyfunc.load_model(model_info.model_uri)print(model.predict([{"adjective": "funny"}]))Embeddings Example‚Äãfrom langchain.embeddings import MlflowAIGatewayEmbeddingsembeddings = MlflowAIGatewayEmbeddings(    gateway_uri="http://127.0.0.1:5000",    route="embeddings",)print(embeddings.embed_query("hello"))print(embeddings.embed_documents(["hello"]))Chat Example‚Äãfrom langchain.chat_models import ChatMLflowAIGatewayfrom langchain.schema import HumanMessage, SystemMessagechat = ChatMLflowAIGateway(    gateway_uri="http://127.0.0.1:5000",    route="chat",    params={        "temperature": 0.1    })messages = [    SystemMessage(        content="You are a helpful assistant that translates English to French."    ),    HumanMessage(        content="Translate this sentence from English to French: I love programming."    ),]print(chat(messages))Databricks MLflow AI Gateway‚ÄãDatabricks MLflow AI Gateway is in private preview.
The MLflow AI Gateway service is a powerful tool designed to streamline the usage and management of various large
The MLflow AI Gateway service is a powerful tool designed to streamline the usage and management of various large ->: models in the pyfunc flavor.See the API documentation and examples.Completions Example‚Äãimport mlflowfrom langchain.chains import LLMChain, PromptTemplatefrom langchain.llms import MlflowAIGatewaygateway = MlflowAIGateway(    gateway_uri="http://127.0.0.1:5000",    route="completions",    params={        "temperature": 0.0,        "top_p": 0.1,    },)llm_chain = LLMChain(    llm=gateway,    prompt=PromptTemplate(        input_variables=["adjective"],        template="Tell me a {adjective} joke",    ),)result = llm_chain.run(adjective="funny")print(result)with mlflow.start_run():    model_info = mlflow.langchain.log_model(chain, "model")model = mlflow.pyfunc.load_model(model_info.model_uri)print(model.predict([{"adjective": "funny"}]))Embeddings Example‚Äãfrom langchain.embeddings import MlflowAIGatewayEmbeddingsembeddings = MlflowAIGatewayEmbeddings(    gateway_uri="http://127.0.0.1:5000",    route="embeddings",)print(embeddings.embed_query("hello"))print(embeddings.embed_documents(["hello"]))Chat Example‚Äãfrom langchain.chat_models import ChatMLflowAIGatewayfrom langchain.schema import HumanMessage, SystemMessagechat = ChatMLflowAIGateway(    gateway_uri="http://127.0.0.1:5000",    route="chat",    params={        "temperature": 0.1    })messages = [    SystemMessage(        content="You are a helpful assistant that translates English to French."    ),    HumanMessage(        content="Translate this sentence from English to French: I love programming."    ),]print(chat(messages))Databricks MLflow AI Gateway‚ÄãDatabricks MLflow AI Gateway is in private preview.