mirror of
https://github.com/VinciGit00/Scrapegraph-ai.git
synced 2026-07-09 21:19:20 +08:00
fix: updated ollama structured output
This commit is contained in:
parent
7fee21724d
commit
3b9591156d
@ -12,7 +12,6 @@ graph_config = {
|
||||
"llm": {
|
||||
"model": "ollama/llama3.1",
|
||||
"temperature": 0,
|
||||
"format": "json",
|
||||
"base_url": "http://localhost:11434",
|
||||
},
|
||||
"verbose": True,
|
||||
|
||||
@ -18,7 +18,6 @@ graph_config = {
|
||||
"llm": {
|
||||
"model": "ollama/llama3.1",
|
||||
"temperature": 0,
|
||||
"format": "json", # Ollama needs the format to be specified explicitly
|
||||
"base_url": "http://localhost:11434", # set ollama URL arbitrarily
|
||||
},
|
||||
"verbose": True,
|
||||
|
||||
@ -15,7 +15,6 @@ graph_config = {
|
||||
"llm": {
|
||||
"model": "ollama/llama3.1",
|
||||
"temperature": 0,
|
||||
"format": "json", # Ollama needs the format to be specified explicitly
|
||||
"base_url": "http://localhost:11434", # set ollama URL arbitrarily
|
||||
},
|
||||
"verbose": True,
|
||||
|
||||
@ -13,7 +13,6 @@ graph_config = {
|
||||
"llm": {
|
||||
"model": "ollama/llama3.1",
|
||||
"temperature": 0,
|
||||
"format": "json", # Ollama needs the format to be specified explicitly
|
||||
# "base_url": "http://localhost:11434", # set ollama URL arbitrarily
|
||||
},
|
||||
"verbose": True,
|
||||
|
||||
@ -13,9 +13,8 @@ graph_config = {
|
||||
"llm": {
|
||||
"model": "ollama/llama3.2:3b",
|
||||
"temperature": 0,
|
||||
"format": "json", # Ollama needs the format to be specified explicitly
|
||||
# "base_url": "http://localhost:11434", # set ollama URL arbitrarily
|
||||
"model_tokens": 1024,
|
||||
"model_tokens": 4096,
|
||||
},
|
||||
"verbose": True,
|
||||
"headless": False,
|
||||
|
||||
@ -27,7 +27,6 @@ graph_config = {
|
||||
"llm": {
|
||||
"model": "ollama/llama3.1",
|
||||
"temperature": 0,
|
||||
"format": "json", # Ollama needs the format to be specified explicitly
|
||||
# "base_url": "http://localhost:11434", # set ollama URL arbitrarily
|
||||
},
|
||||
"verbose": True,
|
||||
|
||||
@ -5,6 +5,7 @@ MergeAnswersNode Module
|
||||
from typing import List, Optional
|
||||
|
||||
from langchain.prompts import PromptTemplate
|
||||
from langchain_community.chat_models import ChatOllama
|
||||
from langchain_core.output_parsers import JsonOutputParser
|
||||
from langchain_mistralai import ChatMistralAI
|
||||
from langchain_openai import ChatOpenAI
|
||||
@ -42,6 +43,13 @@ class MergeAnswersNode(BaseNode):
|
||||
super().__init__(node_name, "node", input, output, 2, node_config)
|
||||
|
||||
self.llm_model = node_config["llm_model"]
|
||||
|
||||
if isinstance(self.llm_model, ChatOllama):
|
||||
if self.node_config.get("schema", None) is None:
|
||||
self.llm_model.format = "json"
|
||||
else:
|
||||
self.llm_model.format = self.node_config["schema"].model_json_schema()
|
||||
|
||||
self.verbose = (
|
||||
False if node_config is None else node_config.get("verbose", False)
|
||||
)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user