Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -7,6 +7,7 @@ from langchain.agents import initialize_agent, Tool
|
|
| 7 |
from langchain.agents.agent_types import AgentType
|
| 8 |
from langchain.chat_models import ChatOpenAI
|
| 9 |
from langchain.tools import DuckDuckGoSearchRun
|
|
|
|
| 10 |
|
| 11 |
# (Keep Constants as is)
|
| 12 |
# --- Constants ---
|
|
@@ -28,7 +29,12 @@ class BasicAgent: # Some times Inheritance is needed
|
|
| 28 |
print("BasicAgent with LangChain initialized.")
|
| 29 |
|
| 30 |
# Create the LLM # Temprature set to 0 because we need exact match
|
| 31 |
-
llm = ChatOpenAI(temperature=0, model="gpt-3.5-turbo") # ChatML understands roles (user, assistant, system)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
|
| 33 |
# Define tools # Description matters a lot, unless youre using @tool as a decorator and a python function (pulls docstring as tool description)
|
| 34 |
search = DuckDuckGoSearchRun()
|
|
|
|
| 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 ---
|
|
|
|
| 29 |
print("BasicAgent with LangChain initialized.")
|
| 30 |
|
| 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 |
+
repo_id="openchat/openchat-3.5",
|
| 36 |
+
model_kwargs={"temperature": 0.5, "max_new_tokens": 512}
|
| 37 |
+
)
|
| 38 |
|
| 39 |
# Define tools # Description matters a lot, unless youre using @tool as a decorator and a python function (pulls docstring as tool description)
|
| 40 |
search = DuckDuckGoSearchRun()
|