hanshan1988 commited on
Commit
ec02a7c
·
verified ·
1 Parent(s): 92b770f

small changes

Browse files
Files changed (1) hide show
  1. app.py +3 -14
app.py CHANGED
@@ -15,7 +15,7 @@ DEFAULT_API_URL = "https://agents-course-unit4-scoring.hf.space"
15
 
16
  from typing import TypedDict, List, Dict, Any, Optional, Annotated
17
  from langgraph.graph import StateGraph, START, END
18
- # from langchain_openai import ChatOpenAI
19
  # from langchain_huggingface.llms import HuggingFaceEndpoint
20
  from langchain_core.messages import AnyMessage, SystemMessage, HumanMessage
21
  from langgraph.graph.message import add_messages
@@ -93,17 +93,6 @@ def youtube_transcript(url: str) -> str:
93
  time.sleep(1) # Import the time module
94
  return "Failed to retrieve transcript after multiple attempts."
95
 
96
- # @tool
97
- # def divide(a: int, b: int) -> float:
98
- # """Divide a and b for occasional calculations.
99
- # Args:
100
- # a: integer
101
- # b: integer
102
- # Returns:
103
- # A single float containing the result of the division.
104
- # """
105
- # return a / b
106
-
107
  # Equip llm with tools
108
  tools_list = [
109
  fetch_website,
@@ -191,8 +180,8 @@ class BasicAgent:
191
  content=question
192
  )
193
  ]
194
- messages = await agent_graph.ainvoke({"messages": messages})
195
- response_text = messages['messages'][-1].content
196
  return response_text.split('</think>')[-1]
197
 
198
 
 
15
 
16
  from typing import TypedDict, List, Dict, Any, Optional, Annotated
17
  from langgraph.graph import StateGraph, START, END
18
+ from langchain_openai import ChatOpenAI
19
  # from langchain_huggingface.llms import HuggingFaceEndpoint
20
  from langchain_core.messages import AnyMessage, SystemMessage, HumanMessage
21
  from langgraph.graph.message import add_messages
 
93
  time.sleep(1) # Import the time module
94
  return "Failed to retrieve transcript after multiple attempts."
95
 
 
 
 
 
 
 
 
 
 
 
 
96
  # Equip llm with tools
97
  tools_list = [
98
  fetch_website,
 
180
  content=question
181
  )
182
  ]
183
+ response = await agent_graph.ainvoke({"messages": messages})
184
+ response_text = response['messages'][-1].content
185
  return response_text.split('</think>')[-1]
186
 
187