# Use `transform_input_fn` and `transform_output_fn` if the app
# expects a different input schema and does not return a JSON string,
# respectively, or you want to apply a prompt template on top.
def transform_input(**request):
    full_prompt = f"""{request["prompt"]}
    Be Concise.
    """
    request["prompt"] = full_prompt
    return request
def transform_output(response):
    return response.upper()
llm = Databricks(
  cluster_driver_port="7777",
  transform_input_fn=transform_input,
  transform_output_fn=transform_output)
llm("How are you?")
'I AM DOING GREAT THANK YOU.'
previous
C Transformers
next
DeepInfra
 Contents
  
Wrapping a serving endpoint
Wrapping a cluster driver proxy app
By Harrison Chase
    
      © Copyright 2023, Harrison Chase.
      
  Last updated on Jun 16, 2023.
rtdocs_stable/api.python.langchain.com/en/stable/modules/models/llms/integrations/databricks.html