Spaces:
Paused
Paused
## Difference between Open AI and hugging face | |
from dotenv import load_dotenv | |
load_dotenv() | |
from langchain_openai import OpenAI | |
llm = OpenAI() | |
result= llm.invoke("What is capital of India") | |
print(result) | |
## Use Huggingface to load google Model using langchain | |
from langchain import HuggingFaceHub | |
llm2 = HuggingFaceHub( | |
repo_id="google/flan-t5-large", | |
model_kwargs={"temperature":0, "max_length":180} | |
) | |
results2= llm2("what is the capital of Sri lanka") | |
print(results2) | |
## Use Google GenAI chat models using langChain | |
from langchain_google_genai import ChatGoogleGenerativeAI | |
chat = ChatGoogleGenerativeAI(model="gemini-pro") | |
results3 = chat.invoke("What is the capital of Pakistan") | |
print(results3.content) | |