Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -8,6 +8,7 @@ from langchain.agents.agent_types import AgentType
|
|
| 8 |
from langchain.chat_models import ChatOpenAI
|
| 9 |
from langchain.tools import DuckDuckGoSearchRun
|
| 10 |
from langchain_community.llms import HuggingFaceHub
|
|
|
|
| 11 |
|
| 12 |
# (Keep Constants as is)
|
| 13 |
# --- Constants ---
|
|
@@ -31,8 +32,14 @@ class BasicAgent: # Some times Inheritance is needed
|
|
| 31 |
# Create the LLM # Temprature set to 0 because we need exact match
|
| 32 |
#llm = ChatOpenAI(temperature=0, model="gpt-3.5-turbo") # ChatML understands roles (user, assistant, system)
|
| 33 |
# Define the LLM
|
| 34 |
-
llm = HuggingFaceHub(
|
| 35 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
model_kwargs={"temperature": 0.5, "max_new_tokens": 512}
|
| 37 |
)
|
| 38 |
|
|
|
|
| 8 |
from langchain.chat_models import ChatOpenAI
|
| 9 |
from langchain.tools import DuckDuckGoSearchRun
|
| 10 |
from langchain_community.llms import HuggingFaceHub
|
| 11 |
+
from langchain_huggingface import HuggingFaceEndpoint
|
| 12 |
|
| 13 |
# (Keep Constants as is)
|
| 14 |
# --- Constants ---
|
|
|
|
| 32 |
# Create the LLM # Temprature set to 0 because we need exact match
|
| 33 |
#llm = ChatOpenAI(temperature=0, model="gpt-3.5-turbo") # ChatML understands roles (user, assistant, system)
|
| 34 |
# Define the LLM
|
| 35 |
+
# llm = HuggingFaceHub(
|
| 36 |
+
# repo_id="tiiuae/falcon-7b-instruct",
|
| 37 |
+
# model_kwargs={"temperature": 0.5, "max_new_tokens": 512}
|
| 38 |
+
# )
|
| 39 |
+
# Define the LLM
|
| 40 |
+
llm = HuggingFaceEndpoint(
|
| 41 |
+
endpoint_url="https://api-inference.huggingface.co/models/your-model-name",
|
| 42 |
+
huggingfacehub_api_token=os.environ["HUGGINGFACEHUB_API_TOKEN"],
|
| 43 |
model_kwargs={"temperature": 0.5, "max_new_tokens": 512}
|
| 44 |
)
|
| 45 |
|