Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -84,10 +84,20 @@ embedding_model = HuggingFaceEmbeddings(
|
|
| 84 |
#)
|
| 85 |
|
| 86 |
# Initialize Hugging Face LLM
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 91 |
)
|
| 92 |
|
| 93 |
# This initializes the Chat OpenAI model with the provided endpoint, API key, deployment name, and a temperature setting of 0 (to control response variability).
|
|
@@ -569,12 +579,23 @@ class SpiritualBot:
|
|
| 569 |
#)
|
| 570 |
|
| 571 |
# Initialize Hugging Face client
|
| 572 |
-
|
| 573 |
-
|
| 574 |
-
|
| 575 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 576 |
)
|
| 577 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 578 |
# Define tools available to the chatbot, such as web search
|
| 579 |
tools = [agentic_rag]
|
| 580 |
|
|
|
|
| 84 |
#)
|
| 85 |
|
| 86 |
# Initialize Hugging Face LLM
|
| 87 |
+
from langchain_community.chat_models import ChatHuggingFace
|
| 88 |
+
from transformers import pipeline
|
| 89 |
+
|
| 90 |
+
pipe = pipeline(
|
| 91 |
+
"text-generation",
|
| 92 |
+
model="meta-llama/Meta-Llama-3-8B-Instruct",
|
| 93 |
+
token=os.environ["HF_TOKEN"],
|
| 94 |
+
max_new_tokens=512,
|
| 95 |
+
temperature=0.0
|
| 96 |
+
)
|
| 97 |
+
|
| 98 |
+
llm = ChatHuggingFace(
|
| 99 |
+
pipeline=pipe,
|
| 100 |
+
model_id="meta-llama/Meta-Llama-3-8B-Instruct"
|
| 101 |
)
|
| 102 |
|
| 103 |
# This initializes the Chat OpenAI model with the provided endpoint, API key, deployment name, and a temperature setting of 0 (to control response variability).
|
|
|
|
| 579 |
#)
|
| 580 |
|
| 581 |
# Initialize Hugging Face client
|
| 582 |
+
from langchain_community.chat_models import ChatHuggingFace
|
| 583 |
+
from transformers import pipeline
|
| 584 |
+
|
| 585 |
+
pipe = pipeline(
|
| 586 |
+
"text-generation",
|
| 587 |
+
model="meta-llama/Meta-Llama-3-8B-Instruct",
|
| 588 |
+
token=os.environ["HF_TOKEN"],
|
| 589 |
+
max_new_tokens=512,
|
| 590 |
+
temperature=0.0
|
| 591 |
)
|
| 592 |
|
| 593 |
+
# Assign to self.client
|
| 594 |
+
self.client = ChatHuggingFace(
|
| 595 |
+
pipeline=pipe,
|
| 596 |
+
model_id="meta-llama/Meta-Llama-3-8B-Instruct"
|
| 597 |
+
)
|
| 598 |
+
|
| 599 |
# Define tools available to the chatbot, such as web search
|
| 600 |
tools = [agentic_rag]
|
| 601 |
|