feat: add forcing format as json

This commit is contained in:
Marco Vinciguerra 2024-06-02 12:24:54 +02:00
parent 38d138e36f
commit 5cfc10178a
5 changed files with 4 additions and 2 deletions

View File

@ -27,7 +27,6 @@ graph_config = {
"llm": {
"model": "ollama/llama3",
"temperature": 0,
"format": "json", # Ollama needs the format to be specified explicitly
# "model_tokens": 2000, # set context length arbitrarily
"base_url": "http://localhost:11434",
},

View File

@ -59,6 +59,7 @@ class GenerateAnswerCSVNode(BaseNode):
"""
super().__init__(node_name, "node", input, output, 2, node_config)
self.llm_model = node_config["llm_model"]
self.llm_model.format="json"
self.verbose = (
False if node_config is None else node_config.get("verbose", False)
)

View File

@ -44,8 +44,8 @@ class GenerateAnswerNode(BaseNode):
node_name: str = "GenerateAnswer",
):
super().__init__(node_name, "node", input, output, 2, node_config)
self.llm_model = node_config["llm_model"]
self.llm_model.format="json"
self.verbose = (
True if node_config is None else node_config.get("verbose", False)
)

View File

@ -44,6 +44,7 @@ class GenerateAnswerOmniNode(BaseNode):
super().__init__(node_name, "node", input, output, 3, node_config)
self.llm_model = node_config["llm_model"]
self.llm_model.format="json"
self.verbose = (
False if node_config is None else node_config.get("verbose", False)
)

View File

@ -58,6 +58,7 @@ class GenerateAnswerPDFNode(BaseNode):
"""
super().__init__(node_name, "node", input, output, 2, node_config)
self.llm_model = node_config["llm_model"]
self.llm_model.format="json"
self.verbose = (
False if node_config is None else node_config.get("verbose", False)
)