Update app.py
Browse files
app.py
CHANGED
|
@@ -1,4 +1,5 @@
|
|
| 1 |
import os, re, requests, pandas as pd, gradio as gr
|
|
|
|
| 2 |
from langchain_huggingface.llms import HuggingFacePipeline
|
| 3 |
from langchain.tools import tool
|
| 4 |
from langchain_core.output_parsers import JsonOutputParser
|
|
@@ -132,13 +133,8 @@ class BasicAgent:
|
|
| 132 |
# initialize HF inference pipeline once
|
| 133 |
if HF_TOKEN is None:
|
| 134 |
raise ValueError("HF_TOKEN not set in environment")
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
tokenizer="distilbert/distilgpt2",
|
| 138 |
-
task="text-generation",
|
| 139 |
-
max_new_tokens=16,
|
| 140 |
-
token=HF_TOKEN
|
| 141 |
-
).bind_tools(TOOLS)
|
| 142 |
# The GAIA system prompt (no "FINAL ANSWER:" at the end)
|
| 143 |
self.system_prompt = SYSTEM_MESSAGE
|
| 144 |
print("BasicAgent initialized with LLM.")
|
|
|
|
| 1 |
import os, re, requests, pandas as pd, gradio as gr
|
| 2 |
+
from transformers import pipeline
|
| 3 |
from langchain_huggingface.llms import HuggingFacePipeline
|
| 4 |
from langchain.tools import tool
|
| 5 |
from langchain_core.output_parsers import JsonOutputParser
|
|
|
|
| 133 |
# initialize HF inference pipeline once
|
| 134 |
if HF_TOKEN is None:
|
| 135 |
raise ValueError("HF_TOKEN not set in environment")
|
| 136 |
+
pipe = pipeline("text-generation", model="EleutherAI/gpt-neo-125M", max_new_tokens=16)
|
| 137 |
+
self.llm = HuggingFacePipeline(pipeline=pipe).bind_tools(TOOLS)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 138 |
# The GAIA system prompt (no "FINAL ANSWER:" at the end)
|
| 139 |
self.system_prompt = SYSTEM_MESSAGE
|
| 140 |
print("BasicAgent initialized with LLM.")
|