mirror of
https://github.com/tiennm99/litellm.git
synced 2026-07-29 12:20:24 +00:00
2.5 KiB
2.5 KiB
In [ ]:
%pip install ctransformersIn [ ]:
from langchain.llms import CTransformers
llm = CTransformers(model="marella/gpt-2-ggml")In [ ]:
print(llm("AI is going to"))In [ ]:
from langchain.callbacks.streaming_stdout import StreamingStdOutCallbackHandler
llm = CTransformers(
model="marella/gpt-2-ggml", callbacks=[StreamingStdOutCallbackHandler()]
)
response = llm("AI is going to")In [ ]:
from langchain import PromptTemplate, LLMChain
template = """Question: {question}
Answer:"""
prompt = PromptTemplate(template=template, input_variables=["question"])
llm_chain = LLMChain(prompt=prompt, llm=llm)
response = llm_chain.run("What is AI?")