DataScience / app.py
67Ayush87's picture
Update app.py
35d3571 verified
raw
history blame
949 Bytes
import os
import langchain
import langchain_huggingface
from langchain_huggingface import HuggingFaceEndpoint,HuggingFacePipeline, ChatHuggingFace
from langchain_google_genai import GoogleGenerativeAI, ChatGoogleGenerativeAI
from langchain_core.messages import HumanMessage, SystemMessage, AIMessage
os.environ["HF_TOKEN"]=os.getenv('Ayush')
os.environ["HUGGINGFACEHUB_API_KEY"]=os.getenv('Ayush')
llama_model = HuggingFaceEndpoint(repo_id= "meta-llama/Llama-3.2-3B-Instruct",provider= "nebius",temperature=0.6, max_new_tokens=70,task="conversational")
model_d=ChatHuggingFace(llm =llama_model,repo_id= "meta-llama/Llama-3.2-3B-Instruct",provider= "nebius",temperature=0.6, max_new_tokens=70,task="conversational")
message = [SystemMessage(content = "Answer like you are a hardcore pc gamer"),
HumanMessage(content = "Give me name of top 10 pc games of all time with description")]
result = model_d.invoke(message)
print(result.content)