Update tools.py
Browse files
tools.py
CHANGED
|
@@ -1,7 +1,9 @@
|
|
| 1 |
import base64
|
| 2 |
from langchain_core.messages import AnyMessage, HumanMessage, AIMessage
|
|
|
|
| 3 |
|
| 4 |
|
|
|
|
| 5 |
def extract_text(img_path: str) -> str:
|
| 6 |
"""
|
| 7 |
Extract text from an image file using a multimodal model.
|
|
@@ -54,6 +56,7 @@ def extract_text(img_path: str) -> str:
|
|
| 54 |
return ""
|
| 55 |
|
| 56 |
|
|
|
|
| 57 |
def describe_image(img_path: str, query: str) -> str:
|
| 58 |
"""
|
| 59 |
Generate a detailed description of an image using a multimodal model.
|
|
|
|
| 1 |
import base64
|
| 2 |
from langchain_core.messages import AnyMessage, HumanMessage, AIMessage
|
| 3 |
+
from langchain.tools import tool
|
| 4 |
|
| 5 |
|
| 6 |
+
@tool
|
| 7 |
def extract_text(img_path: str) -> str:
|
| 8 |
"""
|
| 9 |
Extract text from an image file using a multimodal model.
|
|
|
|
| 56 |
return ""
|
| 57 |
|
| 58 |
|
| 59 |
+
@tool
|
| 60 |
def describe_image(img_path: str, query: str) -> str:
|
| 61 |
"""
|
| 62 |
Generate a detailed description of an image using a multimodal model.
|