model to settings for LLM

This commit is contained in:
SpudGunMan
2024-09-01 08:59:40 -07:00
parent 37a9fc2eb0
commit 9f7055ffd2
3 changed files with 6 additions and 3 deletions
+2
View File
@@ -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
+3 -3
View File
@@ -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', ' ')
+1
View File
@@ -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