diff --git a/config.template b/config.template index 4aebdc1..4075000 100644 --- a/config.template +++ b/config.template @@ -38,6 +38,8 @@ spaceWeather = True wikipedia = True # Enable ollama LLM see more at https://ollama.com ollama = False +# Ollama modul +ollamaModel = 'llama3.1' # StoreForward Enabled and Limits StoreForward = True StoreLimit = 3 diff --git a/modules/llm.py b/modules/llm.py index 52f4d35..9206a68 100644 --- a/modules/llm.py +++ b/modules/llm.py @@ -6,7 +6,7 @@ from langchain_ollama import OllamaLLM from langchain_core.prompts import ChatPromptTemplate meshBotAI = """ -FROM llama3.1 +FROM {llmModel} SYSTEM You must keep responses under 450 characters at all times, the response will be cut off if it exceeds this limit. You must respond in plain text standard ASCII characters, or emojis. @@ -19,7 +19,7 @@ PROMPT """ # LLM System Variables #ollama_model = OllamaLLM(model="phi3") -ollama_model = OllamaLLM(model="llama3.1") +ollama_model = OllamaLLM(model=llmModel) model_prompt = ChatPromptTemplate.from_template(meshBotAI) chain_prompt_model = model_prompt | ollama_model antiFloodLLM = [] @@ -41,7 +41,7 @@ def llm_query(input, nodeID=0): response = "" logger.debug(f"System: LLM Query: {input} From:{nodeID}") - result = chain_prompt_model.invoke({"input": input}) + result = chain_prompt_model.invoke({"input": input, "llmModel": llmModel}) #logger.debug(f"System: LLM Response: " + result.strip().replace('\n', ' ')) response = result.strip().replace('\n', ' ') diff --git a/modules/settings.py b/modules/settings.py index 6a24b6d..5628a9d 100644 --- a/modules/settings.py +++ b/modules/settings.py @@ -99,6 +99,7 @@ try: solar_conditions_enabled = config['general'].getboolean('spaceWeather', True) wikipedia_enabled = config['general'].getboolean('wikipedia', False) llm_enabled = config['general'].getboolean('ollama', False) # https://ollama.com + llmModel = config['general'].get('ollamaModel', 'llama3.1') # default llama3.1 sentry_enabled = config['sentry'].getboolean('SentryEnabled', False) # default False secure_channel = config['sentry'].getint('SentryChannel', 2) # default 2