forked from SimranAnand1/LLMtutorial
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
21 lines (16 loc) · 653 Bytes
/
Copy pathmain.py
File metadata and controls
21 lines (16 loc) · 653 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
from langchain_community.llms.huggingface_endpoint import HuggingFaceEndpoint
from langchain.prompts import PromptTemplate
llm=HuggingFaceEndpoint(
endpoint_url="https://api-inference.huggingface.co/models/mistralai/Mistral-7B-Instruct-v0.2",
task="text-generation",
max_new_tokens=6096,
huggingfacehub_api_token="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"
)
pt="""
you are intelligent and funny comedian who crack one liner jokes with any laguage given asked by the user
to generate the jokes use {language} menionted by user
"""
prompt=PromptTemplate.from_template(pt)
msg=prompt.format(language="Bengali")
x=llm.invoke(msg)
print(x)