QueryYourDocs / examples /techniques /ollama_langchain.py
LVKinyanjui's picture
Another attempt to fix the permissions error
cfd39e4
raw
history blame
No virus
373 Bytes
from langchain_core.prompts import ChatPromptTemplate
from langchain_ollama.llms import OllamaLLM
template = """Question: {question}
Answer: Let's think step by step."""
prompt = ChatPromptTemplate.from_template(template)
model = OllamaLLM(model="llama3.2:1b-instruct-q4_K_M")
chain = prompt | model
res = chain.invoke({"question": "What is LangChain?"})
print(res)