Spaces:
Sleeping
Sleeping
Update tools/news_reporter.py
Browse files- tools/news_reporter.py +14 -14
tools/news_reporter.py
CHANGED
|
@@ -1,23 +1,23 @@
|
|
| 1 |
from agent_state import AgentState
|
| 2 |
import os
|
| 3 |
-
|
| 4 |
-
from langchain_ollama.llms import OllamaLLM
|
| 5 |
|
| 6 |
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
|
| 16 |
-
llm = OllamaLLM(
|
| 17 |
-
|
| 18 |
|
| 19 |
-
|
| 20 |
-
|
| 21 |
|
| 22 |
def create_news_report(state: AgentState) -> AgentState:
|
| 23 |
if state.feedback:
|
|
|
|
| 1 |
from agent_state import AgentState
|
| 2 |
import os
|
| 3 |
+
from langchain_huggingface import HuggingFaceEndpoint
|
| 4 |
+
# from langchain_ollama.llms import OllamaLLM
|
| 5 |
|
| 6 |
|
| 7 |
+
## code for HF
|
| 8 |
+
MODEL_ID = "google/gemma-3n-E4B-it"
|
| 9 |
+
llm = HuggingFaceEndpoint(
|
| 10 |
+
repo_id=MODEL_ID,
|
| 11 |
+
huggingfacehub_api_token=os.environ.get("HF_TOKEN"),
|
| 12 |
+
temperature=0.7,
|
| 13 |
+
max_new_tokens=512,
|
| 14 |
+
)
|
| 15 |
|
| 16 |
+
# llm = OllamaLLM(
|
| 17 |
+
# # model="gemma3n:e4b-it-q4_K_M",
|
| 18 |
|
| 19 |
+
# model="gemma2:2b",
|
| 20 |
+
# base_url="http://127.0.0.1:11434")
|
| 21 |
|
| 22 |
def create_news_report(state: AgentState) -> AgentState:
|
| 23 |
if state.feedback:
|