print("Enter your HuggingFace Hub API key:")    os.environ["HF_API_TOKEN"] = getpass()Using LangChain with OpenLM‚ÄãHere we're going to call two models in an LLMChain, text-davinci-003 from OpenAI and gpt2 on HuggingFace.from langchain.llms import OpenLMfrom langchain.prompts import PromptTemplatefrom langchain.chains import LLMChainquestion = "What is the capital of France?"template = """Question: {question}Answer: Let's think step by step."""prompt = PromptTemplate(template=template, input_variables=["question"])for model in ["text-davinci-003", "huggingface.co/gpt2"]:    llm = OpenLM(model=model)    llm_chain = LLMChain(prompt=prompt, llm=llm)    result = llm_chain.run(question)    print(        """Model: {}Result: {}""".format(            model, result        )    )    Model: text-davinci-003    Result:  France is a country in Europe. The capital of France is Paris.    Model: huggingface.co/gpt2    Result: Question: What is the capital of France?        Answer: Let's think step by step. I am not going to lie, this is a complicated issue, and I don't see any solutions to all this, but it is still far morePreviousOpenLLMNextPetalsSetupUsing LangChain with OpenLMCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright ¬© 2023 LangChain, Inc.
OpenLM is a zero-dependency OpenAI-compatible LLM provider that can call different inference endpoints directly via HTTP.
OpenLM is a zero-dependency OpenAI-compatible LLM provider that can call different inference endpoints directly via HTTP. ->: print("Enter your HuggingFace Hub API key:")    os.environ["HF_API_TOKEN"] = getpass()Using LangChain with OpenLM‚ÄãHere we're going to call two models in an LLMChain, text-davinci-003 from OpenAI and gpt2 on HuggingFace.from langchain.llms import OpenLMfrom langchain.prompts import PromptTemplatefrom langchain.chains import LLMChainquestion = "What is the capital of France?"template = """Question: {question}Answer: Let's think step by step."""prompt = PromptTemplate(template=template, input_variables=["question"])for model in ["text-davinci-003", "huggingface.co/gpt2"]:    llm = OpenLM(model=model)    llm_chain = LLMChain(prompt=prompt, llm=llm)    result = llm_chain.run(question)    print(        """Model: {}Result: {}""".format(            model, result        )    )    Model: text-davinci-003    Result:  France is a country in Europe. The capital of France is Paris.    Model: huggingface.co/gpt2    Result: Question: What is the capital of France?        Answer: Let's think step by step. I am not going to lie, this is a complicated issue, and I don't see any solutions to all this, but it is still far morePreviousOpenLLMNextPetalsSetupUsing LangChain with OpenLMCommunityDiscordTwitterGitHubPythonJS/TSMoreHomepageBlogCopyright ¬© 2023 LangChain, Inc.