mirror of
https://github.com/VinciGit00/Scrapegraph-ai.git
synced 2026-07-06 21:11:37 +08:00
feat: add json as output
This commit is contained in:
parent
cab5f6828c
commit
5d20186bf2
@ -12,7 +12,7 @@ from langchain_core.runnables import RunnableParallel
|
||||
from tqdm import tqdm
|
||||
|
||||
from ..utils.logging import get_logger
|
||||
from ..models import Ollama, Groq, OpenAI
|
||||
from ..models import Ollama
|
||||
# Imports from the library
|
||||
from .base_node import BaseNode
|
||||
from ..helpers import template_chunks, template_no_chunks, template_merge
|
||||
@ -44,7 +44,7 @@ class GenerateAnswerNode(BaseNode):
|
||||
node_name: str = "GenerateAnswer",
|
||||
):
|
||||
super().__init__(node_name, "node", input, output, 2, node_config)
|
||||
|
||||
|
||||
self.llm_model = node_config["llm_model"]
|
||||
|
||||
if isinstance(node_config["llm_model"], Ollama):
|
||||
|
||||
@ -10,7 +10,7 @@ from langchain.prompts import PromptTemplate
|
||||
from langchain_core.output_parsers import JsonOutputParser, PydanticOutputParser
|
||||
from langchain_core.runnables import RunnableParallel
|
||||
from tqdm import tqdm
|
||||
|
||||
from ..models import Ollama
|
||||
# Imports from the library
|
||||
from .base_node import BaseNode
|
||||
from ..helpers.generate_answer_node_omni_prompts import template_no_chunk_omni, template_chunks_omni, template_merge_omni
|
||||
@ -44,6 +44,9 @@ class GenerateAnswerOmniNode(BaseNode):
|
||||
super().__init__(node_name, "node", input, output, 3, node_config)
|
||||
|
||||
self.llm_model = node_config["llm_model"]
|
||||
if isinstance(node_config["llm_model"], Ollama):
|
||||
self.llm_model.format="json"
|
||||
|
||||
self.verbose = (
|
||||
False if node_config is None else node_config.get("verbose", False)
|
||||
)
|
||||
|
||||
@ -10,7 +10,7 @@ from langchain.prompts import PromptTemplate
|
||||
from langchain_core.output_parsers import JsonOutputParser, PydanticOutputParser
|
||||
from langchain_core.runnables import RunnableParallel
|
||||
from tqdm import tqdm
|
||||
|
||||
from ..models import Ollama
|
||||
from ..utils.logging import get_logger
|
||||
|
||||
# Imports from the library
|
||||
@ -59,6 +59,8 @@ class GenerateAnswerPDFNode(BaseNode):
|
||||
super().__init__(node_name, "node", input, output, 2, node_config)
|
||||
|
||||
self.llm_model = node_config["llm_model"]
|
||||
if isinstance(node_config["llm_model"], Ollama):
|
||||
self.llm_model.format="json"
|
||||
self.verbose = (
|
||||
False if node_config is None else node_config.get("verbose", False)
|
||||
)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user