Skip to content

Instantly share code, notes, and snippets.

@fsndzomga
Created September 19, 2023 14:04
Show Gist options
  • Save fsndzomga/9458e6049f5bbf3d5f8e15d555765a5f to your computer and use it in GitHub Desktop.
Save fsndzomga/9458e6049f5bbf3d5f8e15d555765a5f to your computer and use it in GitHub Desktop.
Assumption checker using langchain
from langchain import hub, LLMChain
from langchain.chat_models import ChatOpenAI
from keys import OPENAI_API_KEY
import os
os.environ["OPENAI_API_KEY"] = OPENAI_API_KEY
assumption_template = hub.pull("smithing-gold/assumption-checker")
llm = ChatOpenAI()
llm_chain = LLMChain(llm=llm, prompt=assumption_template)
while True:
question = input("What is your question ? Type quit to leave the chat.\n\n")
if question == 'quit':
break
print("\n Response:")
response = llm_chain(question)
print(response)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment