mirror of
https://github.com/VinciGit00/Scrapegraph-ai.git
synced 2026-06-06 21:13:22 +08:00
fix: update langchain imports for v1.0+ compatibility
- Change ResponseSchema and StructuredOutputParser imports to use langchain_classic.output_parsers instead of langchain_core.output_parsers - Change create_extraction_chain import to use langchain_classic.chains instead of langchain.chains - Add langchain-classic>=1.0.0 as explicit dependency - Relax async-timeout requirement to >=4.0.0 for compatibility Fixes #1017 Signed-off-by: majiayu000 <1835304752@qq.com>
This commit is contained in:
parent
f3dbbcaee2
commit
621d3a5bba
@ -11,6 +11,7 @@ authors = [
|
||||
|
||||
dependencies = [
|
||||
"langchain>=1.2.0",
|
||||
"langchain-classic>=1.0.0",
|
||||
"langchain-openai>=1.1.6",
|
||||
"langchain-mistralai>=1.1.1",
|
||||
"langchain_community>=0.3.31",
|
||||
@ -26,7 +27,7 @@ dependencies = [
|
||||
"playwright>=1.57.0",
|
||||
"undetected-playwright>=0.3.0",
|
||||
"semchunk>=3.2.5",
|
||||
"async-timeout>=5.0.1",
|
||||
"async-timeout>=4.0.0",
|
||||
"simpleeval>=1.0.3",
|
||||
"jsonschema>=4.25.1",
|
||||
"duckduckgo-search>=8.1.1",
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
GraphBuilder Module
|
||||
"""
|
||||
|
||||
from langchain.chains import create_extraction_chain
|
||||
from langchain_classic.chains import create_extraction_chain
|
||||
from langchain_community.chat_models import ErnieBotChat
|
||||
from langchain_core.prompts import ChatPromptTemplate
|
||||
from langchain_openai import ChatOpenAI
|
||||
@ -113,7 +113,9 @@ class GraphBuilder:
|
||||
{nodes_description}
|
||||
|
||||
Based on the user's input: "{input}", identify the essential nodes required for the task and suggest a graph configuration that outlines the flow between the chosen nodes.
|
||||
""".format(nodes_description=self.nodes_description, input="{input}")
|
||||
""".format(
|
||||
nodes_description=self.nodes_description, input="{input}"
|
||||
)
|
||||
extraction_prompt = ChatPromptTemplate.from_template(
|
||||
create_graph_prompt_template
|
||||
)
|
||||
|
||||
@ -12,10 +12,10 @@ from typing import Any, Dict, List, Optional
|
||||
from bs4 import BeautifulSoup
|
||||
from jsonschema import ValidationError as JSONSchemaValidationError
|
||||
from jsonschema import validate
|
||||
from langchain_core.output_parsers import ResponseSchema, StructuredOutputParser
|
||||
from langchain_core.prompts import PromptTemplate
|
||||
from langchain_classic.output_parsers import ResponseSchema, StructuredOutputParser
|
||||
from langchain_community.chat_models import ChatOllama
|
||||
from langchain_core.output_parsers import StrOutputParser
|
||||
from langchain_core.prompts import PromptTemplate
|
||||
|
||||
from ..prompts import TEMPLATE_INIT_CODE_GENERATION, TEMPLATE_SEMANTIC_COMPARISON
|
||||
from ..utils import (
|
||||
|
||||
Loading…
Reference in New Issue
Block a user