Liao commited on
Commit
979cd0f
·
1 Parent(s): edd7ed3

updateFunction

Browse files
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -5,7 +5,7 @@ from typing import Literal, Dict, Any
5
  from typing_extensions import TypedDict, Annotated
6
 
7
  import gradio as gr
8
- from langchain.tools import tool
9
  from langchain_huggingface import HuggingFacePipeline
10
  from langchain_core.messages import HumanMessage, AIMessage, ToolMessage, BaseMessage
11
  from langgraph.graph import StateGraph, START, END
@@ -25,14 +25,17 @@ llm = HuggingFacePipeline.from_model_id(
25
  # 2) Tools
26
  @tool
27
  def multiply(a: int, b: int) -> int:
 
28
  return a * b
29
 
30
  @tool
31
  def add(a: int, b: int) -> int:
 
32
  return a + b
33
 
34
  @tool
35
  def divide(a: int, b: int) -> float:
 
36
  return a / b
37
 
38
  tools = [add, multiply, divide]
 
5
  from typing_extensions import TypedDict, Annotated
6
 
7
  import gradio as gr
8
+ from langchain_core.tools import tool # (recommended import)
9
  from langchain_huggingface import HuggingFacePipeline
10
  from langchain_core.messages import HumanMessage, AIMessage, ToolMessage, BaseMessage
11
  from langgraph.graph import StateGraph, START, END
 
25
  # 2) Tools
26
  @tool
27
  def multiply(a: int, b: int) -> int:
28
+ """Multiply a and b."""
29
  return a * b
30
 
31
  @tool
32
  def add(a: int, b: int) -> int:
33
+ """Add a and b."""
34
  return a + b
35
 
36
  @tool
37
  def divide(a: int, b: int) -> float:
38
+ """Divide a by b."""
39
  return a / b
40
 
41
  tools = [add, multiply, divide]