Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Update app.py
Browse files
app.py
CHANGED
@@ -79,6 +79,21 @@ async def chat(query,history,sources,reports):
|
|
79 |
task="text-generation",
|
80 |
huggingfacehub_api_token=HF_token,
|
81 |
model_kwargs={})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
82 |
|
83 |
# create rag chain
|
84 |
chain = prompt | llm_qa | StrOutputParser()
|
|
|
79 |
task="text-generation",
|
80 |
huggingfacehub_api_token=HF_token,
|
81 |
model_kwargs={})
|
82 |
+
|
83 |
+
# trying llm new-prompt adapted for llama-3
|
84 |
+
# https://stackoverflow.com/questions/78429932/langchain-ollama-and-llama-3-prompt-and-response
|
85 |
+
# https://api.python.langchain.com/en/latest/llms/langchain_community.llms.huggingface_endpoint.HuggingFaceEndpoint.html#langchain_community.llms.huggingface_endpoint.HuggingFaceEndpoint.model_kwargs
|
86 |
+
# https://huggingface.co/blog/llama3#how-to-prompt-llama-3
|
87 |
+
|
88 |
+
llm_qa = HuggingFaceEndpoint(
|
89 |
+
endpoint_url= "https://mnczdhmrf7lkfd9d.eu-west-1.aws.endpoints.huggingface.cloud",
|
90 |
+
task="text-generation",
|
91 |
+
huggingfacehub_api_token=HF_token,
|
92 |
+
truncate = 1500,
|
93 |
+
stop=["<|eot_id|>"],
|
94 |
+
streaming-True,
|
95 |
+
model_kwargs={})
|
96 |
+
|
97 |
|
98 |
# create rag chain
|
99 |
chain = prompt | llm_qa | StrOutputParser()
|