Files
2023-03-26 19:49:46 -07:00

1.7 KiB

Modal

This example goes over how to use LangChain to interact with Modal models

In [ ]:
from langchain.llms import Modal
from langchain import PromptTemplate, LLMChain
In [ ]:
template = """Question: {question}

Answer: Let's think step by step."""

prompt = PromptTemplate(template=template, input_variables=["question"])
In [ ]:
llm = Modal(endpoint_url="YOUR_ENDPOINT_URL")
In [ ]:
llm_chain = LLMChain(prompt=prompt, llm=llm)
In [ ]:
question = "What NFL team won the Super Bowl in the year Justin Beiber was born?"

llm_chain.run(question)