File tree Expand file tree Collapse file tree 2 files changed +17
-6
lines changed
label_studio_ml/examples/langchain_search_agent Expand file tree Collapse file tree 2 files changed +17
-6
lines changed Original file line number Diff line number Diff line change 44from uuid import uuid4
55from typing import List , Dict , Optional , Any
66from label_studio_ml .model import LabelStudioMLBase
7- from langchain .tools import tool
8- from langchain .utilities import GoogleSearchAPIWrapper
9- from langchain .callbacks .base import BaseCallbackHandler
10- from langchain .agents import initialize_agent
11- from langchain .agents import AgentType
12- from langchain .llms import OpenAI
7+
8+ # Try new langchain imports first (v0.1.0+), fall back to old imports
9+ try :
10+ from langchain_community .utilities import GoogleSearchAPIWrapper
11+ from langchain_core .callbacks import BaseCallbackHandler
12+ from langchain .agents import initialize_agent , AgentType
13+ from langchain_openai import OpenAI
14+ from langchain .tools import Tool
15+ except ImportError :
16+ # Fall back to old imports for older langchain versions
17+ from langchain .utilities import GoogleSearchAPIWrapper
18+ from langchain .callbacks .base import BaseCallbackHandler
19+ from langchain .agents import initialize_agent , AgentType
20+ from langchain .llms import OpenAI
21+ from langchain .tools import Tool
22+
1323from label_studio_ml .utils import match_labels
1424
1525logger = logging .getLogger (__name__ )
Original file line number Diff line number Diff line change 11langchain
22langchain_community
3+ langchain_openai
34google-api-python-client
45openai
56
You can’t perform that action at this time.
0 commit comments