File size: 722 Bytes
99709e3
24c1914
99709e3
24c1914
99709e3
 
 
 
24c1914
99709e3
24c1914
99709e3
 
 
 
 
24c1914
99709e3
 
24c1914
99709e3
24c1914
99709e3
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
## 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)