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