Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -60,21 +60,20 @@ client = InferenceClient(HF_MODEL_ID, token=os.getenv("HF_TOKEN"))
|
|
| 60 |
import os
|
| 61 |
from langchain_huggingface import HuggingFaceEndpoint, ChatHuggingFace
|
| 62 |
|
| 63 |
-
|
|
|
|
|
|
|
| 64 |
|
| 65 |
-
# 1. Create the endpoint with the 'conversational' task
|
| 66 |
llm_endpoint = HuggingFaceEndpoint(
|
| 67 |
-
|
| 68 |
-
repo_id = "HuggingFaceH4/zephyr-7b-beta",
|
| 69 |
task="text-generation",
|
| 70 |
max_new_tokens=512,
|
| 71 |
-
huggingfacehub_api_token=
|
| 72 |
)
|
| 73 |
|
| 74 |
-
# 2.
|
| 75 |
-
#
|
| 76 |
llm = ChatHuggingFace(llm=llm_endpoint)
|
| 77 |
-
|
| 78 |
# -------------------------
|
| 79 |
# Document loader
|
| 80 |
# -------------------------
|
|
|
|
| 60 |
import os
|
| 61 |
from langchain_huggingface import HuggingFaceEndpoint, ChatHuggingFace
|
| 62 |
|
| 63 |
+
# 1. Use a model that has high availability in the 2026 Provider network
|
| 64 |
+
# Llama-3.1-8B-Instruct is currently a 'gold standard' for this router
|
| 65 |
+
repo_id = "meta-llama/Llama-3.1-8B-Instruct"
|
| 66 |
|
|
|
|
| 67 |
llm_endpoint = HuggingFaceEndpoint(
|
| 68 |
+
repo_id=repo_id,
|
|
|
|
| 69 |
task="text-generation",
|
| 70 |
max_new_tokens=512,
|
| 71 |
+
huggingfacehub_api_token=os.getenv("HF_TOKEN"),
|
| 72 |
)
|
| 73 |
|
| 74 |
+
# 2. ChatHuggingFace will correctly route this to the /v1/chat/completions
|
| 75 |
+
# endpoint which the Llama-3.1-8B-Instruct model supports.
|
| 76 |
llm = ChatHuggingFace(llm=llm_endpoint)
|
|
|
|
| 77 |
# -------------------------
|
| 78 |
# Document loader
|
| 79 |
# -------------------------
|