AC-Angelo93 commited on
Commit
8a6c965
·
verified ·
1 Parent(s): f4f1c6c

Update agent.py

Browse files
Files changed (1) hide show
  1. agent.py +3 -1
agent.py CHANGED
@@ -126,7 +126,9 @@ with open("system_prompt.txt","r",encoding="utf-8") as f:
126
  # 2) Build your graph
127
  def build_graph(provider: str = "huggingface") -> Graph:
128
  # 2a) Instantiate your LLM endpoint
129
- api_token = os.environ["HF_API_TOKEN"]
 
 
130
  llm = LLM(provider=provider, token=api_token, model="meta-llama/Llama-2-7b-chat-hf")
131
 
132
  # 2b) Attach tools
 
126
  # 2) Build your graph
127
  def build_graph(provider: str = "huggingface") -> Graph:
128
  # 2a) Instantiate your LLM endpoint
129
+ api_token = os.getenv("HF_API_TOKEN")
130
+ if not api_token:
131
+ raise ValueError("HF_API_TOKEN not found: please add it under Settings → Secrets and variables in your Space")
132
  llm = LLM(provider=provider, token=api_token, model="meta-llama/Llama-2-7b-chat-hf")
133
 
134
  # 2b) Attach tools