fix(AbstractGraph): manually select model tokens

closes #768
This commit is contained in:
Federico Aguzzi 2024-10-28 14:51:39 +01:00
parent 62369e3e28
commit f79f399ee0

View File

@ -152,12 +152,15 @@ class AbstractGraph(ABC):
raise ValueError(f"""Provider {llm_params['model_provider']} is not supported. raise ValueError(f"""Provider {llm_params['model_provider']} is not supported.
If possible, try to use a model instance instead.""") If possible, try to use a model instance instead.""")
try: if "model_tokens" not in llm_params:
self.model_token = models_tokens[llm_params["model_provider"]][llm_params["model"]] try:
except KeyError: self.model_token = models_tokens[llm_params["model_provider"]][llm_params["model"]]
print(f"""Model {llm_params['model_provider']}/{llm_params['model']} not found, except KeyError:
using default token size (8192)""") print(f"""Model {llm_params['model_provider']}/{llm_params['model']} not found,
self.model_token = 8192 using default token size (8192)""")
self.model_token = 8192
else:
self.model_token = llm_params["model_tokens"]
try: try:
if llm_params["model_provider"] not in \ if llm_params["model_provider"] not in \