Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -9,14 +9,23 @@ from llama_index.llms.huggingface_api import HuggingFaceInferenceAPI
|
|
| 9 |
# 1. SETUP LLM
|
| 10 |
hf_token = os.getenv("HF_TOKEN")
|
| 11 |
|
| 12 |
-
#
|
| 13 |
llm = HuggingFaceInferenceAPI(
|
| 14 |
model_name="Qwen/Qwen2.5-7B-Instruct",
|
| 15 |
token=hf_token,
|
| 16 |
task="text-generation",
|
|
|
|
| 17 |
is_function_calling_model=False
|
| 18 |
)
|
| 19 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
# 2. DEFINE YOUR TOOLS
|
| 21 |
def get_tokyo_time() -> str:
|
| 22 |
"""Returns the current time in Tokyo, Japan."""
|
|
|
|
| 9 |
# 1. SETUP LLM
|
| 10 |
hf_token = os.getenv("HF_TOKEN")
|
| 11 |
|
| 12 |
+
# Create the LLM with the 404 fix
|
| 13 |
llm = HuggingFaceInferenceAPI(
|
| 14 |
model_name="Qwen/Qwen2.5-7B-Instruct",
|
| 15 |
token=hf_token,
|
| 16 |
task="text-generation",
|
| 17 |
+
provider="together",
|
| 18 |
is_function_calling_model=False
|
| 19 |
)
|
| 20 |
|
| 21 |
+
# Create the Agent with a clear instruction (Context)
|
| 22 |
+
agent = ReActAgent.from_tools(
|
| 23 |
+
tools,
|
| 24 |
+
llm=llm,
|
| 25 |
+
verbose=True,
|
| 26 |
+
context="You are a helpful assistant. Always use Thought/Action/Observation format."
|
| 27 |
+
)
|
| 28 |
+
|
| 29 |
# 2. DEFINE YOUR TOOLS
|
| 30 |
def get_tokyo_time() -> str:
|
| 31 |
"""Returns the current time in Tokyo, Japan."""
|