Created
September 19, 2023 14:17
-
-
Save fsndzomga/0501cbfbdae38439789639f9ac1fc03c to your computer and use it in GitHub Desktop.
prompt maker from the langchain hub
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
prompt_maker_template = hub.pull("hardkothari/prompt-maker") | |
llm = ChatOpenAI() | |
llm_chain = LLMChain(llm=llm, prompt=prompt_maker_template) | |
while True: | |
task = input("What is your task ? Type quit to leave the chat.\n\n") | |
if task == 'quit': | |
break | |
lazy_prompt = input("What is your current prompt? Type quit to leave the chat.\n\n") | |
if lazy_prompt == 'quit': | |
break | |
print("\n Response:") | |
response = llm_chain({'lazy_prompt': lazy_prompt, 'task': task}) | |
print(response) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment