77import uuid
88import warnings
99from pydantic import BaseModel
10-
1110from langchain_community .chat_models import ErnieBotChat
1211from langchain_nvidia_ai_endpoints import ChatNVIDIA
1312from langchain .chat_models import init_chat_model
14-
1513from ..helpers import models_tokens
1614from ..models import (
1715 OneApi ,
1816 DeepSeek
1917)
2018from ..utils .logging import set_verbosity_warning , set_verbosity_info
2119
22-
23-
2420class AbstractGraph (ABC ):
2521 """
2622 Scaffolding class for creating a graph representation and executing it.
@@ -53,6 +49,9 @@ class AbstractGraph(ABC):
5349 def __init__ (self , prompt : str , config : dict ,
5450 source : Optional [str ] = None , schema : Optional [BaseModel ] = None ):
5551
52+ if config .get ("llm" ).get ("temperature" ) is None :
53+ config ["llm" ]["temperature" ] = 0
54+
5655 self .prompt = prompt
5756 self .source = source
5857 self .config = config
@@ -163,7 +162,6 @@ def handle_model(model_name, provider, token_key, default_token=8192):
163162
164163 elif llm_params ["model" ].startswith ("vertexai" ):
165164 return handle_model (llm_params ["model" ], "google_vertexai" , llm_params ["model" ])
166-
167165 elif "gpt-" in llm_params ["model" ]:
168166 return handle_model (llm_params ["model" ], "openai" , llm_params ["model" ])
169167
@@ -197,6 +195,7 @@ def handle_model(model_name, provider, token_key, default_token=8192):
197195 return ErnieBotChat (llm_params )
198196
199197 elif "oneapi" in llm_params ["model" ]:
198+
200199 # take the model after the last dash
201200 llm_params ["model" ] = llm_params ["model" ].split ("/" )[- 1 ]
202201 try :
@@ -206,6 +205,7 @@ def handle_model(model_name, provider, token_key, default_token=8192):
206205 return OneApi (llm_params )
207206
208207 elif "nvidia" in llm_params ["model" ]:
208+
209209 try :
210210 self .model_token = models_tokens ["nvidia" ][llm_params ["model" ].split ("/" )[- 1 ]]
211211 llm_params ["model" ] = "/" .join (llm_params ["model" ].split ("/" )[1 :])
0 commit comments